xserver: Branch 'master' - 3 commits

Keith Packard keithp at kemper.freedesktop.org
Tue Aug 25 19:34:51 PDT 2009


 dix/dispatch.c                 |   22 +++++++++++++++++++++-
 hw/xfree86/modes/xf86Cursors.c |    6 ++++--
 hw/xfree86/modes/xf86Rotate.c  |    7 +++++--
 include/dix.h                  |    6 ++++++
 4 files changed, 36 insertions(+), 5 deletions(-)

New commits:
commit e7dd1efef408effe52d0bd3d3aa0b5d4ee10ed90
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Aug 25 18:07:00 2009 -0700

    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.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 31c6961..414bd04 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -242,6 +242,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];
 
@@ -312,7 +313,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
@@ -332,6 +333,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
@@ -351,6 +369,7 @@ Dispatch(void)
     if (!clientReady)
 	return;
 
+    SmartScheduleSlice = SmartScheduleInterval;
     while (!dispatchException)
     {
         if (*icheck[0] != *icheck[1])
@@ -455,6 +474,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 e0ea274..d9face1 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -228,6 +228,7 @@ xf86RotatePrepare (ScreenPtr pScreen)
 		DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
 				xf86_config->rotation_damage);
 		xf86_config->rotation_damage_registered = TRUE;
+		EnableLimitedSchedulingLatency();
 	    }
 	    
 	    xf86CrtcDamageShadow (crtc);
@@ -338,6 +339,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 e2db6b6..49dfe37 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -229,6 +229,12 @@ extern _X_EXPORT void WakeupHandler(
     int /*result*/,
     pointer /*pReadmask*/);
 
+void
+EnableLimitedSchedulingLatency(void);
+
+void
+DisableLimitedSchedulingLatency(void);
+
 typedef void (* WakeupHandlerProcPtr)(
     pointer /* blockData */,
     int /* result */,
commit 1740cda7a37abc7d0a169ab4555b446adaa62211
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Aug 25 16:58:07 2009 -0700

    Perform rotation redisplay before calling driver block handler (which may flush rendering)
    
    The rotation block handler uses regular driver rendering functions to
    repaint the screen, if those functions queue commands in the driver,
    it's important that the driver block handler be invoked after the
    rotated image is drawn.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index e808434..e0ea274 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -293,11 +293,12 @@ xf86RotateBlockHandler(int screenNum, pointer blockData,
     ScreenPtr		pScreen = screenInfo.screens[screenNum];
     ScrnInfoPtr		pScrn = xf86Screens[screenNum];
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    Bool		rotation_active;
 
+    rotation_active = xf86RotateRedisplay(pScreen);
     pScreen->BlockHandler = xf86_config->BlockHandler;
     (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
-    if (xf86RotateRedisplay(pScreen))
-    {
+    if (rotation_active) {
 	/* Re-wrap if rotation is still happening */
 	xf86_config->BlockHandler = pScreen->BlockHandler;
 	pScreen->BlockHandler = xf86RotateBlockHandler;
commit 4aab05e3b3231f1ec9795a66a075d17a722634a7
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Aug 25 16:54:16 2009 -0700

    xf86_reload_cursors: fix cursor position to eliminate jumping after mode set
    
    xf86_reload_cursors restores the cursor to the correct position, but
    that must adjust for cursor hot spot and frame before calling down to
    the hardware function, otherwise the cursor jumps to the wrong
    position until it is repositioned by the user.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 8c5a94c..fc4df84 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -639,9 +639,11 @@ xf86_reload_cursors (ScreenPtr screen)
 	    (*cursor_info->LoadCursorARGB) (scrn, cursor);
 	else if (src)
 #endif
-	    (*cursor_info->LoadCursorImage)(cursor_info->pScrn, src);
+	    (*cursor_info->LoadCursorImage)(scrn, src);
 
-	(*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y);
+	x += scrn->frameX0 + cursor_screen_priv->HotX;
+	y += scrn->frameY0 + cursor_screen_priv->HotY;
+	(*cursor_info->SetCursorPosition)(scrn, x, y);
     }
 }
 


More information about the xorg-commit mailing list