diff options
author | Keith Packard <keithp@keithp.com> | 2009-08-25 18:07:00 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-08-25 20:12:17 -0700 |
commit | 76a1839b0a7dcb82e46c43533d252288677c6dbb (patch) | |
tree | 6f2dc92277621fa041718c943478350ce27dfced | |
parent | 31dc4fe0be57da4e9458ee490811fbd92598b7a7 (diff) |
Ensure that rotation updates happen frequently
The smart scheduler is designed to minimize scheduler overhead by
increasing the interval between WaitForSomething calls when a single
client is running. However, the software rotation code depends on
its BlockHandler being invoked for screen updates; the long delays
caused by the smart scheduler optimizations means that screen updates
can be delayed a long time as well.
The change is simple -- prevent the smart scheduler from increasing
the scheduling interval while any screen is using software rotation.
(cherry picked from commit e7dd1efef408effe52d0bd3d3aa0b5d4ee10ed90)
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | dix/dispatch.c | 22 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86Rotate.c | 2 | ||||
-rw-r--r-- | include/dix.h | 6 |
3 files changed, 29 insertions, 1 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c index 1ca08b641..7e16589da 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -247,6 +247,7 @@ long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE; long SmartScheduleTime; +int SmartScheduleLatencyLimited = 0; static ClientPtr SmartLastClient; static int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; @@ -317,7 +318,7 @@ SmartScheduleClient (int *clientReady, int nready) /* * Adjust slice */ - if (nready == 1) + if (nready == 1 && SmartScheduleLatencyLimited == 0) { /* * If it's been a long time since another client @@ -337,6 +338,23 @@ SmartScheduleClient (int *clientReady, int nready) return best; } +void +EnableLimitedSchedulingLatency(void) +{ + ++SmartScheduleLatencyLimited; + SmartScheduleSlice = SmartScheduleInterval; +} + +void +DisableLimitedSchedulingLatency(void) +{ + --SmartScheduleLatencyLimited; + + /* protect against bugs */ + if (SmartScheduleLatencyLimited < 0) + SmartScheduleLatencyLimited = 0; +} + #define MAJOROP ((xReq *)client->requestBuffer)->reqType void @@ -356,6 +374,7 @@ Dispatch(void) if (!clientReady) return; + SmartScheduleSlice = SmartScheduleInterval; while (!dispatchException) { if (*icheck[0] != *icheck[1]) @@ -466,6 +485,7 @@ Dispatch(void) KillAllClients(); xfree(clientReady); dispatchException &= ~DE_RESET; + SmartScheduleLatencyLimited = 0; } #undef MAJOROP diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index 0af96c285..bb17df431 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -198,6 +198,7 @@ xf86RotatePrepare (ScreenPtr pScreen) DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, xf86_config->rotation_damage); xf86_config->rotation_damage_registered = TRUE; + EnableLimitedSchedulingLatency(); } xf86CrtcDamageShadow (crtc); @@ -308,6 +309,7 @@ xf86RotateDestroy (xf86CrtcPtr crtc) DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, xf86_config->rotation_damage); xf86_config->rotation_damage_registered = FALSE; + DisableLimitedSchedulingLatency(); } DamageDestroy (xf86_config->rotation_damage); xf86_config->rotation_damage = NULL; diff --git a/include/dix.h b/include/dix.h index 66af953b2..9c2c73fb7 100644 --- a/include/dix.h +++ b/include/dix.h @@ -229,6 +229,12 @@ extern void WakeupHandler( int /*result*/, pointer /*pReadmask*/); +void +EnableLimitedSchedulingLatency(void); + +void +DisableLimitedSchedulingLatency(void); + typedef void (* WakeupHandlerProcPtr)( pointer /* blockData */, int /* result */, |