diff options
author | Ilija Hadzic <ilijahadzic@gmail.com> | 2013-05-08 22:39:47 -0400 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2013-05-29 15:27:29 +0200 |
commit | 385a92b4fbe8f53b359ef6c463704414d00476fa (patch) | |
tree | b4e96d7403aadc315c13c82cfd4097c0de9b4e32 | |
parent | e87b52e6ad41ad7a87e43b818d80e7d522d9c68d (diff) |
DRI2: support scheduling emulated events with zero delay
Now that we fully emulating a running CRTC through DPMS-off state
it is possible to come up with a zero delay when scheduling
a swap or MSC-wait (e.g., if a call into respective wait function
was entered very late). This patch wraps the TimerSet function
into our own radeon_dri2_schedule_event such that the latter
calls the event right away if zero delay is specified.
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 | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c index 9a58219a..10a614b8 100644 --- a/src/radeon_dri2.c +++ b/src/radeon_dri2.c @@ -1076,6 +1076,18 @@ CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data) return 0; } +static +void radeon_dri2_schedule_event(CARD32 delay, pointer arg) +{ + OsTimerPtr timer; + + timer = TimerSet(NULL, 0, delay, radeon_dri2_deferred_event, arg); + if (delay == 0) { + CARD32 now = GetTimeInMillis(); + radeon_dri2_deferred_event(timer, now, arg); + } +} + /* * Request a DRM event when the requested conditions will be satisfied. * @@ -1132,7 +1144,7 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw, delay = radeon_dri2_extrapolate_msc_delay(crtc, &target_msc, divisor, remainder); wait_info->frame = target_msc; - TimerSet(NULL, 0, delay, radeon_dri2_deferred_event, wait_info); + radeon_dri2_schedule_event(delay, wait_info); DRI2BlockClient(client, draw); return TRUE; } @@ -1364,7 +1376,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, delay = radeon_dri2_extrapolate_msc_delay(crtc, target_msc, divisor, remainder); swap_info->frame = *target_msc; - TimerSet(NULL, 0, delay, radeon_dri2_deferred_event, swap_info); + radeon_dri2_schedule_event(delay, swap_info); return TRUE; } @@ -1377,9 +1389,8 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, xf86DrvMsg(scrn->scrnIndex, X_WARNING, "first get vblank counter failed: %s\n", strerror(errno)); - TimerSet(NULL, 0, FALLBACK_SWAP_DELAY, radeon_dri2_deferred_event, - swap_info); *target_msc = 0; + radeon_dri2_schedule_event(FALLBACK_SWAP_DELAY, swap_info); return TRUE; } @@ -1431,9 +1442,8 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, xf86DrvMsg(scrn->scrnIndex, X_WARNING, "divisor 0 get vblank counter failed: %s\n", strerror(errno)); - TimerSet(NULL, 0, FALLBACK_SWAP_DELAY, radeon_dri2_deferred_event, - swap_info); *target_msc = 0; + radeon_dri2_schedule_event(FALLBACK_SWAP_DELAY, swap_info); return TRUE; } @@ -1481,9 +1491,8 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw, xf86DrvMsg(scrn->scrnIndex, X_WARNING, "final get vblank counter failed: %s\n", strerror(errno)); - TimerSet(NULL, 0, FALLBACK_SWAP_DELAY, radeon_dri2_deferred_event, - swap_info); *target_msc = 0; + radeon_dri2_schedule_event(FALLBACK_SWAP_DELAY, swap_info); return TRUE; } |