cosam
Active Member
Yes, because what you've actually written there is the same as:EvilDragon said:This is part of the code like I currently have changed it:
Code:void vid_end() { if (overlay) { SDL_UnlockYUVOverlay(overlay); if (fb.enabled) int arg = 0; ioctl(fbdev, FBIO_WAITFORVSYNC, &arg); SDL_DisplayYUVOverlay(overlay, &overlay_rect); return; } SDL_UnlockSurface(screen); if (fb.enabled) { SDL_Flip(screen); } }
That does lead to:
Code:sys/sdl/sdl.c: In function 'vid_end': sys/sdl/sdl.c:440: error: expected expression before 'int' sys/sdl/sdl.c:441: error: 'arg' undeclared (first use in this function) sys/sdl/sdl.c:441: error: (Each undeclared identifier is reported only once sys/sdl/sdl.c:441: error: for each function it appears in.) make: *** [sys/sdl/sdl.o] Error 1
Code:
if (fb.enabled) {
int arg = 0; // arg is defined here
}
// arg is no longer defined here!
ioctl(fbdev, FBIO_WAITFORVSYNC, &arg);
SDL_DisplayYUVOverlay(overlay, &overlay_rect);
return;
The ioctl takes a pointer as an argument, so it probably won't work (unless address 0 happens to contain zero). Is it that SDL_Flip() isn't being called or that you just don't see any difference? Does fb.enabled evaluate to true? I'm not sure (would need to experiment) but it would probably be better to put the v-sync call right at the start of the vid_end() function.If I do it like this:
Code:void vid_end() { if (overlay) { SDL_UnlockYUVOverlay(overlay); if (fb.enabled) ioctl(fbdev, FBIO_WAITFORVSYNC, 0); SDL_DisplayYUVOverlay(overlay, &overlay_rect); return; } SDL_UnlockSurface(screen); if (fb.enabled) { SDL_Flip(screen); } }
I get no errors, but no VSync either...
Putting this in front of SDL_Flip also doesn't work.
I guess SDL_Flip is not even used here - if I remove it, GnuBoy still works fine.
If I remove SDL_DisplayYUVOverlay(overlay, &overlay_rect); however, there's no video anymore... so I guess the WAITFORSYNC is okay before that?
Last edited by a moderator: