diff options
author | Ilija Hadzic <ilijahadzic@gmail.com> | 2013-05-08 22:39:48 -0400 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2013-05-29 15:27:29 +0200 |
commit | bd2557ea5ef84b975060e929d5ece53ec464336f (patch) | |
tree | 8a28237377d43f2fbf453067f3a5a4b8f56aa806 | |
parent | 385a92b4fbe8f53b359ef6c463704414d00476fa (diff) |
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>
-rw-r--r-- | src/radeon_dri2.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c index 10a614b8..fa3719d6 100644 --- a/src/radeon_dri2.c +++ b/src/radeon_dri2.c @@ -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); |