File U_xfree86-Remove-broken-RANDR-disabling-logic-v4.patch of Package xorg-x11-server

Git-commit: dd00e5466a0e4ea313d1860824da4123692827ed
Author: Adam Jackson <ajax@redhat.com>
Subject: xfree86: Remove broken RANDR disabling logic (v4)
Patch-mainline: Upstream
References: bnc#1068961
Signed-off-by: Michal Srb <msrb@suse.com>

The only way to get at xf86Info.disableRandR from configuration is
Option "RANDR" "foo" in ServerFlags, which probably nobody is using
seeing as it's not documented. The other way it could be set is if a
screen supports RANDR 1.2, in which case we set it to avoid trying to
use the RANDR 1.1 compat code. If the second screen is not 1.2-aware
then this would mean we don't do RANDR setup on the second screen at
all, which would almost certainly crash the first time you try to do
RANDR operations on the second screen.

Fix that all by deletion, and just check whether the screen already has
RANDR initialized before installing the stub support. If you want to
disable RANDR, use the Extensions section of xorg.conf instead.

v2: Also remove a now entirely pointless log message, telling you to
ignore a line we will no longer print.

v3: Explain the fallback path in InitOutput. (Keith Packard)

v4: Check whether the RANDR private key is initialized before trying to
use it to look up the screen private.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
---
 hw/xfree86/common/xf86.h        |  2 --
 hw/xfree86/common/xf86Config.c  | 12 ------------
 hw/xfree86/common/xf86Globals.c |  2 --
 hw/xfree86/common/xf86Helper.c  |  7 -------
 hw/xfree86/common/xf86Init.c    | 23 +++++++++++++++++------
 hw/xfree86/common/xf86Mode.c    |  6 +-----
 hw/xfree86/common/xf86Privstr.h |  2 --
 hw/xfree86/modes/xf86Crtc.c     |  3 ---
 8 files changed, 18 insertions(+), 39 deletions(-)

Index: xorg-server-1.19.6/hw/xfree86/common/xf86.h
===================================================================
--- xorg-server-1.19.6.orig/hw/xfree86/common/xf86.h
+++ xorg-server-1.19.6/hw/xfree86/common/xf86.h
@@ -319,8 +319,6 @@ extern _X_EXPORT Bool
 xf86GetModInDevEnabled(void);
 extern _X_EXPORT Bool
 xf86GetAllowMouseOpenFail(void);
-extern _X_EXPORT void
-xf86DisableRandR(void);
 extern _X_EXPORT CARD32
 xorgGetVersion(void);
 extern _X_EXPORT CARD32
Index: xorg-server-1.19.6/hw/xfree86/common/xf86Config.c
===================================================================
--- xorg-server-1.19.6.orig/hw/xfree86/common/xf86Config.c
+++ xorg-server-1.19.6/hw/xfree86/common/xf86Config.c
@@ -710,7 +710,6 @@ typedef enum {
     FLAG_XINERAMA,
     FLAG_LOG,
     FLAG_RENDER_COLORMAP_MODE,
-    FLAG_RANDR,
     FLAG_IGNORE_ABI,
     FLAG_ALLOW_EMPTY_INPUT,
     FLAG_USE_DEFAULT_FONT_PATH,
@@ -763,8 +762,6 @@ static OptionInfoRec FlagOptions[] = {
      {0}, FALSE},
     {FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING,
      {0}, FALSE},
-    {FLAG_RANDR, "RandR", OPTV_BOOLEAN,
-     {0}, FALSE},
     {FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
      {0}, FALSE},
     {FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
@@ -909,15 +906,6 @@ configServerFlags(XF86ConfFlagsPtr flags
         }
     }
 
-#ifdef RANDR
-    xf86Info.disableRandR = FALSE;
-    xf86Info.randRFrom = X_DEFAULT;
-    if (xf86GetOptValBool(FlagOptions, FLAG_RANDR, &value)) {
-        xf86Info.disableRandR = !value;
-        xf86Info.randRFrom = X_CONFIG;
-    }
-#endif
-
 #ifdef GLXEXT
     xf86Info.glxVisuals = XF86_GlxVisualsTypical;
     xf86Info.glxVisualsFrom = X_DEFAULT;
Index: xorg-server-1.19.6/hw/xfree86/common/xf86Globals.c
===================================================================
--- xorg-server-1.19.6.orig/hw/xfree86/common/xf86Globals.c
+++ xorg-server-1.19.6/hw/xfree86/common/xf86Globals.c
@@ -121,8 +121,6 @@ xf86InfoRec xf86Info = {
     .pixmap24 = Pix24DontCare,
     .pix24From = X_DEFAULT,
     .pmFlag = TRUE,
-    .disableRandR = FALSE,
-    .randRFrom = X_DEFAULT,
 #if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
     .forceInputDevices = FALSE,
     .autoAddDevices = TRUE,
Index: xorg-server-1.19.6/hw/xfree86/common/xf86Helper.c
===================================================================
--- xorg-server-1.19.6.orig/hw/xfree86/common/xf86Helper.c
+++ xorg-server-1.19.6/hw/xfree86/common/xf86Helper.c
@@ -1572,13 +1572,6 @@ xf86GetAllowMouseOpenFail(void)
     return xf86Info.allowMouseOpenFail;
 }
 
-void
-xf86DisableRandR(void)
-{
-    xf86Info.disableRandR = TRUE;
-    xf86Info.randRFrom = X_PROBED;
-}
-
 CARD32
 xf86GetModuleVersion(void *module)
 {
Index: xorg-server-1.19.6/hw/xfree86/common/xf86Init.c
===================================================================
--- xorg-server-1.19.6.orig/hw/xfree86/common/xf86Init.c
+++ xorg-server-1.19.6/hw/xfree86/common/xf86Init.c
@@ -77,6 +77,7 @@
 #include "xf86Xinput.h"
 #include "xf86InPriv.h"
 #include "picturestr.h"
+#include "randrstr.h"
 
 #include "xf86Bus.h"
 #ifdef XSERVER_LIBPCIACCESS
@@ -380,6 +381,16 @@ xf86ScreenInit(ScreenPtr pScreen, int ar
     return pScrn->ScreenInit (pScreen, argc, argv);
 }
 
+static void
+xf86EnsureRANDR(ScreenPtr pScreen)
+{
+#ifdef RANDR
+        if (!dixPrivateKeyRegistered(rrPrivKey) ||
+            !rrGetScrPriv(pScreen))
+            xf86RandRInit(pScreen);
+#endif
+}
+
 /*
  * InitOutput --
  *	Initialize screenInfo for all actually accessible framebuffers.
@@ -871,12 +882,12 @@ InitOutput(ScreenInfo * pScreenInfo, int
                                      SubPixelHorizontalRGB : SubPixelNone) :
                                     SubPixelUnknown);
         }
-#ifdef RANDR
-        if (!xf86Info.disableRandR)
-            xf86RandRInit(screenInfo.screens[scr_index]);
-        xf86Msg(xf86Info.randRFrom, "RandR %s\n",
-                xf86Info.disableRandR ? "disabled" : "enabled");
-#endif
+
+        /*
+         * If the driver hasn't set up its own RANDR support, install the
+         * fallback support.
+         */
+        xf86EnsureRANDR(xf86Screens[i]->pScreen);
     }
 
     for (i = 0; i < xf86NumGPUScreens; i++)
Index: xorg-server-1.19.6/hw/xfree86/common/xf86Mode.c
===================================================================
--- xorg-server-1.19.6.orig/hw/xfree86/common/xf86Mode.c
+++ xorg-server-1.19.6/hw/xfree86/common/xf86Mode.c
@@ -1664,12 +1664,8 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
     }
 
     /* Lookup each mode */
-#ifdef RANDR
-    if (!xf86Info.disableRandR
 #ifdef PANORAMIX
-        && noPanoramiXExtension
-#endif
-        )
+    if (noPanoramiXExtension)
         validateAllDefaultModes = TRUE;
 #endif
 
Index: xorg-server-1.19.6/hw/xfree86/common/xf86Privstr.h
===================================================================
--- xorg-server-1.19.6.orig/hw/xfree86/common/xf86Privstr.h
+++ xorg-server-1.19.6/hw/xfree86/common/xf86Privstr.h
@@ -85,8 +85,6 @@ typedef struct {
     Pix24Flags pixmap24;
     MessageType pix24From;
     Bool pmFlag;
-    Bool disableRandR;
-    MessageType randRFrom;
     MessageType iglxFrom;
     XF86_GlxVisuals glxVisuals;
     MessageType glxVisualsFrom;
Index: xorg-server-1.19.6/hw/xfree86/modes/xf86Crtc.c
===================================================================
--- xorg-server-1.19.6.orig/hw/xfree86/modes/xf86Crtc.c
+++ xorg-server-1.19.6/hw/xfree86/modes/xf86Crtc.c
@@ -773,9 +773,6 @@ xf86CrtcScreenInit(ScreenPtr screen)
     int c;
 
     /* Rotation */
-    xf86DrvMsg(scrn->scrnIndex, X_INFO,
-               "RandR 1.2 enabled, ignore the following RandR disabled message.\n");
-    xf86DisableRandR();         /* Disable old RandR extension support */
     xf86RandR12Init(screen);
 
     /* support all rotations if every crtc has the shadow alloc funcs */
openSUSE Build Service is sponsored by