DRI2: add interpolated blanks to frame number in event handlers

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@research.bell-labs.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Ilija Hadzic
2013-05-08 22:39:48 -04:00
committed by Michel Dänzer
parent 385a92b4fb
commit bd2557ea5e

View File

@@ -799,6 +799,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);
@@ -1254,6 +1257,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);