VSync

Eric Anholt eric at anholt.net
Mon Apr 20 11:08:09 PDT 2009


On Mon, 2009-04-20 at 18:13 +0200, 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);
> }

If you're doing GL, why aren't you just using GLX_SGI_video_sync?

-- 
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg/attachments/20090420/bb5bd56d/attachment.pgp>


More information about the xorg mailing list