From 5cb330cd5d887b20351604ac080e8b71a4e28be7 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 24 Jan 2018 15:24:00 -0500 Subject: [PATCH] Revert "xfree86: Remove broken RANDR disabling logic (v3)" Tsk. This broke vesa for me, the rrGetScrPriv in InitOutput will crash if randr's screen private key hasn't been initialized yet. That seems dumb, but let's not leave it broken. This reverts commit c08d7c1cdde6a844338ed4c3645b00bf25843a31. --- 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 | 9 +++------ hw/xfree86/common/xf86Mode.c | 6 +++++- hw/xfree86/common/xf86Privstr.h | 2 ++ hw/xfree86/modes/xf86Crtc.c | 3 +++ 8 files changed, 36 insertions(+), 7 deletions(-) diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 5743f0cd4..1c2546894 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -305,6 +305,8 @@ 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 diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 2f72c2f76..053cac168 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -634,6 +634,7 @@ typedef enum { FLAG_XINERAMA, FLAG_LOG, FLAG_RENDER_COLORMAP_MODE, + FLAG_RANDR, FLAG_IGNORE_ABI, FLAG_ALLOW_EMPTY_INPUT, FLAG_USE_DEFAULT_FONT_PATH, @@ -682,6 +683,8 @@ 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, @@ -824,6 +827,15 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) } } +#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; diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index e890f05c2..85efe3fc1 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -117,6 +117,8 @@ xf86InfoRec xf86Info = { .miscModInDevEnabled = TRUE, .miscModInDevAllowNonLocal = FALSE, .pmFlag = TRUE, + .disableRandR = FALSE, + .randRFrom = X_DEFAULT, #if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) .forceInputDevices = FALSE, .autoAddDevices = TRUE, diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 95a90ad88..393a7aa88 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1458,6 +1458,13 @@ xf86GetAllowMouseOpenFail(void) return xf86Info.allowMouseOpenFail; } +void +xf86DisableRandR(void) +{ + xf86Info.disableRandR = TRUE; + xf86Info.randRFrom = X_PROBED; +} + CARD32 xf86GetModuleVersion(void *module) { diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 66dcd52fa..57b38d07e 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -77,7 +77,6 @@ #include "xf86Xinput.h" #include "xf86InPriv.h" #include "picturestr.h" -#include "randrstr.h" #include "xf86Bus.h" #ifdef XSERVER_LIBPCIACCESS @@ -811,12 +810,10 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) SubPixelUnknown); } #ifdef RANDR - /* - * If the driver hasn't set up its own RANDR support, install the - * fallback support. - */ - if (!rrGetScrPriv(xf86Screens[i]->pScreen)) + if (!xf86Info.disableRandR) xf86RandRInit(screenInfo.screens[scr_index]); + xf86Msg(xf86Info.randRFrom, "RandR %s\n", + xf86Info.disableRandR ? "disabled" : "enabled"); #endif } diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index 40d09a9f4..ceba87f78 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -1643,8 +1643,12 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, } /* Lookup each mode */ +#ifdef RANDR + if (!xf86Info.disableRandR #ifdef PANORAMIX - if (noPanoramiXExtension) + && noPanoramiXExtension +#endif + ) validateAllDefaultModes = TRUE; #endif diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 0842e1ebb..c5048a399 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -81,6 +81,8 @@ typedef struct { Bool miscModInDevAllowNonLocal; Bool useSIGIO; /* Use SIGIO for handling DRI1 swaps */ Bool pmFlag; + Bool disableRandR; + MessageType randRFrom; MessageType iglxFrom; XF86_GlxVisuals glxVisuals; MessageType glxVisualsFrom; diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 80aebce8a..80a009e08 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -771,6 +771,9 @@ 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 */