Author Topic: Vsync...well sort of  (Read 2534 times)

Reesy (OP)

  • Posts: 57
Vsync...well sort of
« on: January 24, 2010, 03:50:52 pm »

I've been messing around with trying to improve the double buffering on the dingoo.  There's a few techniques floating about but nobody's mentioned this way so I thought I'd suggest it.  Basically it involves checking the busy status of the SLCD, if its busy performing a DMA from a previous frame buffer update then you wait until it finishes.  Then when its done you wait alittle while longer to give the LCD a chance to update.

Below is some example code which highlights the registers involved.

Code: [Select]
#include "jz4740.h"

void sal_VideoFlip(s32 vsync)
int x;
u16 *fb=mFbVirt[mCurrFb];

//Wait for any previous DMA to finish

//If x is 1 then previous DMA was running
//It will take X milliseconds before LCD will update
//with contents of DMA, so wait awhile.
sal_Sleep(40);  //40 seems ok but 50 might be better.

memcpy(_lcd_get_frame(), fb, SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(u16));


u32 sal_TimerRead()
return GetTickCount();

void sal_Sleep(u32 delay)
u32 timerStart=sal_TimerRead();


Anyway it appears to do a good job, FPS takes a hammering though.  Without sync I can get 107 fps, with sync the code code gives 85 fps.  So still fast enough for most things. 



  • Guest
Re: Vsync...well sort of
« Reply #1 on: January 24, 2010, 04:47:55 pm »
Good to see your looking at the little machine!

Have loved some of your previous work



Post a new topic