I can seem to get the Double buffering system to work
Here is my init code:
CODE
gRegGP2X2DEng = (TRegGp2x2DEng*)mmap(0, 0x200, PROT_READ|PROT_WRITE, MAP_SHARED, gDevMem, 0xE0020000);
vmem = (u16*)mmap(NULL, 8*1024*1024, PROT_READ|PROT_WRITE, MAP_SHARED, gDevMem, 0x3101000);
m_pFB = vmem;
m_pBB = vmem + 0x280000;
gRegGP2X->LCD_DisplayAdressLow = u32((m_pFB - vmem) + 0x3101000) & 0xFFFF;
gRegGP2X->LCD_DisplayAdressHigh = u32((m_pFB - vmem) + 0x3101000) >> 16;
gRegGP2X->LCD_DisplayAdressInterlacedLow = u32((m_pFB - vmem) + 0x3101000) & 0xFFFF;
gRegGP2X->LCD_DisplayAdressInterlacedHigh = u32((m_pFB - vmem) + 0x3101000) >> 16;
gRegGP2X is a bitfield by the way
and here is my flipping :
CODE
while(gRegGP2X->m_regGPIO_In.LCD_VSync);
printf("Wait VSync1\n");
printf("Going to set 0x%x\n", uint((m_pBB - vmem) + 0x3101000));
gRegGP2X->LCD_DisplayAdressLow = u32((m_pBB - vmem) + 0x3101000) & 0xFFFF;
gRegGP2X->LCD_DisplayAdressHigh = u32((m_pBB - vmem) + 0x3101000) >> 16;
gRegGP2X->LCD_DisplayAdressInterlacedLow = u32((m_pBB - vmem) + 0x3101000) & 0xFFFF;
gRegGP2X->LCD_DisplayAdressInterlacedHigh = u32((m_pBB - vmem) + 0x3101000) >> 16;
u16* temp = m_pFB;
m_pFB = m_pBB;
m_pBB = temp;
while(!gRegGP2X->m_regGPIO_In.LCD_VSync);
printf("Wait VSync2\n");
in the client code I keep writing to m_pBB ... but all I see is the screen flicker Black/Frame/Black/Frame/
so i suspect that one of them is not fine.
Thx very much
Here is my init code:
CODE
gRegGP2X2DEng = (TRegGp2x2DEng*)mmap(0, 0x200, PROT_READ|PROT_WRITE, MAP_SHARED, gDevMem, 0xE0020000);
vmem = (u16*)mmap(NULL, 8*1024*1024, PROT_READ|PROT_WRITE, MAP_SHARED, gDevMem, 0x3101000);
m_pFB = vmem;
m_pBB = vmem + 0x280000;
gRegGP2X->LCD_DisplayAdressLow = u32((m_pFB - vmem) + 0x3101000) & 0xFFFF;
gRegGP2X->LCD_DisplayAdressHigh = u32((m_pFB - vmem) + 0x3101000) >> 16;
gRegGP2X->LCD_DisplayAdressInterlacedLow = u32((m_pFB - vmem) + 0x3101000) & 0xFFFF;
gRegGP2X->LCD_DisplayAdressInterlacedHigh = u32((m_pFB - vmem) + 0x3101000) >> 16;
gRegGP2X is a bitfield by the way
and here is my flipping :
CODE
while(gRegGP2X->m_regGPIO_In.LCD_VSync);
printf("Wait VSync1\n");
printf("Going to set 0x%x\n", uint((m_pBB - vmem) + 0x3101000));
gRegGP2X->LCD_DisplayAdressLow = u32((m_pBB - vmem) + 0x3101000) & 0xFFFF;
gRegGP2X->LCD_DisplayAdressHigh = u32((m_pBB - vmem) + 0x3101000) >> 16;
gRegGP2X->LCD_DisplayAdressInterlacedLow = u32((m_pBB - vmem) + 0x3101000) & 0xFFFF;
gRegGP2X->LCD_DisplayAdressInterlacedHigh = u32((m_pBB - vmem) + 0x3101000) >> 16;
u16* temp = m_pFB;
m_pFB = m_pBB;
m_pBB = temp;
while(!gRegGP2X->m_regGPIO_In.LCD_VSync);
printf("Wait VSync2\n");
in the client code I keep writing to m_pBB ... but all I see is the screen flicker Black/Frame/Black/Frame/
so i suspect that one of them is not fine.
Thx very much