[PATCH 13/13] DRI2: add interpolated blanks to frame number in event handlers

Ilija Hadzic ilijahadzic at gmail.com
Wed May 8 19:39:48 PDT 2013


The 'frame' argument passed to event handlers is the plain
CRTC vblank counter that stops progressing when the
associated display is in DPMS-off mode. If we have a
DPMS-off period the frame counter and MSC will
diverge, which can cause some higher-level functions
to return incorrect values.

This patch fixes the problem by adding interpolated
vblanks to the frame counter before using it in handler
functions.

Signed-off-by: Ilija Hadzic <ihadzic at research.bell-labs.com>
---
 src/radeon_dri2.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index ef9bd48..d0b808b 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -796,6 +796,9 @@ void radeon_dri2_frame_event_handler(unsigned int frame, unsigned int tv_sec,
                                M_ANY, DixWriteAccess);
     if (status != Success)
         goto cleanup;
+    if (!event->crtc)
+	goto cleanup;
+    frame += radeon_get_interpolated_vblanks(event->crtc);
 
     screen = drawable->pScreen;
     scrn = xf86ScreenToScrn(screen);
@@ -1251,6 +1254,11 @@ void radeon_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
 	free(flip);
 	return;
     }
+    if (!flip->crtc) {
+	free(flip);
+	return;
+    }
+    frame += radeon_get_interpolated_vblanks(flip->crtc);
 
     screen = drawable->pScreen;
     scrn = xf86ScreenToScrn(screen);
-- 
1.8.1.5



More information about the xorg-driver-ati mailing list