VSync

Theo Veenker T.J.G.Veenker at uu.nl
Mon Apr 20 09:44:37 PDT 2009


Olaf Ruppert wrote:
> On Mon, Apr 20, 2009 at 4:41 PM, Olaf Ruppert
>>> I believe they turn off interrupts on vblank to save power.
> 
> O.K. I checked that.  I get the vblank interrupt.
> But it does not help, here is the code:
> 
> static void swap(void)
> {
> 	static char * device = "/dev/dri/card0";
> 	static int fd = 0;
> 	drm_wait_vblank_t blank;
> 	int r = -1;
> 
> 	if (!fd) {
> 		fd = open(device, O_RDWR);
> 		if (fd < 0)
> 			die ("dri: Could not open device");
> 	}
> 	
> 	blank.request.type = _DRM_VBLANK_RELATIVE;
> 	blank.request.sequence = 1;
> 
> 	do {
> 		r = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, &blank);
> 		blank.request.type &= ~_DRM_VBLANK_RELATIVE;
> 	} while (r && errno == EINTR);
> 
> 	if (r)
> 		die("vsync failed");
> 
> 	glXSwapBuffers(dpy,stage);
> }

You could try adding the DRM_VBLANK_SECONDARY flag to the request.type
I had two systems (both laptops) where one needed this flag, the other
didn't. BTW I used the API in <xf86drm.h> but I don't suspect that makes
a difference.

I looked up what I did to the driver. Besides the modification you mentioned
(in i830_dri.c right?) I also commented out in I830DRISetVBlankInterrupt()
these lines:
	if (!pI830->want_vblank_interrupts)
		on = FALSE;

Otherwise I don't know. Maybe one of the Intel guys can give a hint. Having
vblank support (without the need tweak and compile a new driver) on intel
graphics hardware is important to many of us.

Theo



More information about the xorg mailing list