[PATCH 08/11] DRI2: hook up vblank extrapolation to schedule_swap

Ilija Hadzic ilijahadzic at gmail.com
Sun Apr 28 13:07:53 PDT 2013


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 <ihadzic at research.bell-labs.com>
---
 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 a3efba7..4c2f06e 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -1251,14 +1251,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;
     }
 
-- 
1.8.1.5



More information about the xorg-driver-ati mailing list