From e40d5390b3efdea3e02267413350410d8e6a2970 Mon Sep 17 00:00:00 2001 From: Ilija Hadzic Date: Wed, 8 May 2013 22:39:43 -0400 Subject: DRI2: hook up vblank extrapolation to schedule_swap This patch hooks up swap-scheduling function with vblank-extrapolation function. Rather than waiting for fixed time, we calculate exactly how much we should wait and what we should update target_msc to using radeon_dri2_extrapolate_msc_delay helper function and schedule the swap completion using DIX's timer facility. Signed-off-by: Ilija Hadzic Reviewed-by: Alex Deucher --- src/radeon_dri2.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c index d113486a..c6f271e3 100644 --- a/src/radeon_dri2.c +++ b/src/radeon_dri2.c @@ -1258,14 +1258,16 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, } /* - * CRTC is in DPMS off state, fallback to blit, but pace the - * application at the rate that roughly approximates the - * nominal frame rate of the relevant CRTC + * CRTC is in DPMS off state, fallback to blit, but calculate + * wait time from current time, target_msc and last vblank + * time/sequence when CRTC was turned off */ if (!radeon_crtc_is_enabled(crtc)) { - TimerSet(NULL, 0, FALLBACK_SWAP_DELAY, radeon_dri2_deferred_swap, - swap_info); - *target_msc = 0; + CARD32 delay; + delay = radeon_dri2_extrapolate_msc_delay(crtc, target_msc, + divisor, remainder); + swap_info->frame = *target_msc; + TimerSet(NULL, 0, delay, radeon_dri2_deferred_swap, swap_info); return TRUE; } -- cgit v1.2.3