VSync

Olaf Ruppert oruppert at googlemail.com
Mon Apr 20 09:13:05 PDT 2009


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);
}


Thanks for your help.

 olaf



More information about the xorg mailing list