[PATCH] Update screen layout after initial setting of the screen size

Mark Kettenis mark.kettenis at xs4all.nl
Sat Aug 28 12:43:36 PDT 2010


Short explanation from my git commit message:

Some drivers change the screen size after xf86InitOrigins() has been called.
In that case, the "edges" describing the layout may get out of sync with
the screen size.  As a result, the mouse may get stuck on one of the screens.
Recalculating the "edges" by calling xf86ReconfigureLayout() fixes this.

Longer explanation:

Some drivers set a screen size early on, and then later, based on
physical dimensions of the screen from the EDID information, readjust
the screen size.  This happens *after* xf86InitOrigins() has been
called.  As a result, the "edges" that describe the screen layout are
out of sync with the actual screen size.

In my case my ATI Radeon 7500, using the radeon driver, starts out at
1280x1024, but gets later set to 1024x768.  The other screen is an ATI
Rage3D II, using the mach64 driver, which I configured as being
"RightOf" the radeon screen.  Because the initial screen sizes, the
Mach64 screen has an edge at x-offset 1280.  When I move the mouse
from the radeon screen to the Mach64 screen everything seems to work
fine.  But when I try to get back, I can't.  My mouse is stuck on the
Mach64 screen.

The code in hw/xfree86/common/xf86Cursor.c notices that the mouse
pointers moves off the Mach64 screen, switches to the radeon screen,
and adds 1280 to the current (small negative) x-position.  However,
the new x-position ends up being bigger than 1024 (the new size of the
radeon screen), so it throws me right back on the mach64 screen (the x
< 0 check happens before the x >= (*pScreen)->width check).

The fix is to call xf86ReconfigureLayout() after updating the screen
size, like in the diff below.  I'm wondering if this call should be
moved inside xf86RandR12ScreenSetSize() though.


Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
---
 hw/xfree86/modes/xf86RandR12.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 043ceee..772a612 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -836,11 +836,8 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
 	 */
 	pScreen->width  = width;
 	pScreen->height = height;
-	xf86RandR12ScreenSetSize (pScreen,
-				  width,
-				  height,
-				  mmWidth,
-				  mmHeight);
+	xf86RandR12ScreenSetSize(pScreen, width, height, mmWidth, mmHeight);
+	xf86ReconfigureLayout();
     }
 
 #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
-- 
1.7.1



More information about the xorg-devel mailing list