RandR fix for next revision
Hi,
please apply the attached patch to your tree. It fixes the following
issues with the RandR extension (name of submitter in parentheses):
568. The call to xf86RandRSetMode() from f86RandRCreateScreenResources()
doesn't appear to be necessary. Removing it restores the
documented ViewPort behaviour when RandR is enabled (David Dawes).
Applied: Fri Nov 7 23:40:13 2003 UTC (7 months, 1 week ago) by dawes
562. Fix RandR initialization problem when default screen resolution is
different from the virtual resolution. (Bugzilla #853, Bob
Paauwe).
Applied: Thu Nov 6 13:03:10 2003 UTC (7 months, 1 week ago) by alanh
338. Fixed rounding of refresh rate in RandR, updated Xrandr man page
(BugzillaR #527, Egbert Eich).
Applied Mon Aug 4 09:32:24 2003 UTC (10 months, 2 weeks ago) by eich
Of specific interest is 562. This lead to a BadImplementation error when
calling GetScreenInfo if the virtual screen is larger than the current
display mode. Easy to reproduce: Press CTRL-ALT-+ to switch to a smaller
mode and start the xrandr program. You will receive a X Window system
error from the RandR extension (major 154, minor 5). Other programs
querying the RandR extension behave in the same way.
All these patches were commited to the XFree86 CVS before the license
change occured. Hence, that should not be a problem.
Here is a direct link to the history of these changes:
http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/hw/xfree86/common/xf86RandR.c
Fix tested and found working by me.
Thomas
--
Thomas Winischhofer
Vienna/Austria
thomas AT winischhofer DOT net *** http://www.winischhofer.net/
twini AT xfree86 DOT org
--- programs/Xserver/hw/xfree86/common/xf86RandR.c-old 2003-03-02 05:27:23.000000000 +0100
+++ programs/Xserver/hw/xfree86/common/xf86RandR.c 2004-04-23 21:20:32.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.4 2003/02/13 10:49:38 eich Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.7tsi Exp $
*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
@@ -48,9 +49,9 @@
xf86RandRModeRefresh (DisplayModePtr mode)
{
if (mode->VRefresh)
- return (int) mode->VRefresh;
+ return (int) (mode->VRefresh + 0.5);
else
- return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal);
+ return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
}
static Bool
@@ -60,7 +61,6 @@
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
- Bool reportVirtual = TRUE;
int refresh0 = 60;
*rotations = RR_Rotate_0;
@@ -75,9 +75,6 @@
pScreen->mmWidth, pScreen->mmHeight);
if (!pSize)
return FALSE;
- if (mode->HDisplay == randrp->virtualX &&
- mode->VDisplay == randrp->virtualY)
- reportVirtual = FALSE;
RRRegisterRate (pScreen, pSize, refresh);
if (mode == scrp->currentMode &&
mode->HDisplay == pScreen->width && mode->VDisplay == pScreen->height)
@@ -85,13 +82,14 @@
if (mode->next == scrp->modes)
break;
}
- if (reportVirtual)
+ if (scrp->currentMode->HDisplay != randrp->virtualX ||
+ scrp->currentMode->VDisplay != randrp->virtualY)
{
mode = scrp->modes;
pSize = RRRegisterSize (pScreen,
randrp->virtualX, randrp->virtualY,
- pScreen->mmWidth * randrp->virtualX / mode->HDisplay,
- pScreen->mmHeight * randrp->virtualY / mode->VDisplay);
+ pScreen->mmWidth * randrp->virtualX / scrp->currentMode->HDisplay,
+ pScreen->mmHeight * randrp->virtualY / scrp->currentMode->VDisplay);
if (!pSize)
return FALSE;
RRRegisterRate (pScreen, pSize, refresh0);
@@ -202,17 +200,21 @@
static Bool
xf86RandRCreateScreenResources (ScreenPtr pScreen)
{
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+#if 0
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
DisplayModePtr mode;
+#endif
pScreen->CreateScreenResources = randrp->CreateScreenResources;
if (!(*pScreen->CreateScreenResources) (pScreen))
return FALSE;
+#if 0
mode = scrp->currentMode;
if (mode)
xf86RandRSetMode (pScreen, mode, TRUE);
+#endif
return TRUE;
}
Reply to: