randr: Remove funky indirection around the xf86 screen private key

All of the null checks here are redundant, you can't get to those paths
unless RANDR's already been initialized. Delete them, and remove the
pointer too.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
Adam Jackson 2019-01-11 11:38:34 -05:00 committed by Adam Jackson
parent 30044b2253
commit 1e3f9ea14c

View File

@ -78,10 +78,9 @@ static Bool xf86RandR12CreateScreenResources12(ScreenPtr pScreen);
static int xf86RandR12Generation; static int xf86RandR12Generation;
static DevPrivateKeyRec xf86RandR12KeyRec; static DevPrivateKeyRec xf86RandR12KeyRec;
static DevPrivateKey xf86RandR12Key;
#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \ #define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key)) dixLookupPrivate(&(p)->devPrivates, &xf86RandR12KeyRec))
static int static int
xf86RandR12ModeRefresh(DisplayModePtr mode) xf86RandR12ModeRefresh(DisplayModePtr mode)
@ -859,7 +858,6 @@ xf86RandR12Init(ScreenPtr pScreen)
if (xf86RandR12Generation != serverGeneration) if (xf86RandR12Generation != serverGeneration)
xf86RandR12Generation = serverGeneration; xf86RandR12Generation = serverGeneration;
xf86RandR12Key = &xf86RandR12KeyRec;
if (!dixRegisterPrivateKey(&xf86RandR12KeyRec, PRIVATE_SCREEN, 0)) if (!dixRegisterPrivateKey(&xf86RandR12KeyRec, PRIVATE_SCREEN, 0))
return FALSE; return FALSE;
@ -889,7 +887,7 @@ xf86RandR12Init(ScreenPtr pScreen)
randrp->palette_size = 0; randrp->palette_size = 0;
randrp->palette = NULL; randrp->palette = NULL;
dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp); dixSetPrivate(&pScreen->devPrivates, &xf86RandR12KeyRec, randrp);
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
if (!xf86RandR12Init12(pScreen)) if (!xf86RandR12Init12(pScreen))
@ -903,9 +901,6 @@ xf86RandR12CloseScreen(ScreenPtr pScreen)
{ {
XF86RandRInfoPtr randrp; XF86RandRInfoPtr randrp;
if (xf86RandR12Key == NULL)
return;
randrp = XF86RANDRINFO(pScreen); randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
xf86ScreenToScrn(pScreen)->EnterVT = randrp->orig_EnterVT; xf86ScreenToScrn(pScreen)->EnterVT = randrp->orig_EnterVT;
@ -927,9 +922,6 @@ xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif #endif
if (xf86RandR12Key == NULL)
return;
randrp = XF86RANDRINFO(pScreen); randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
for (c = 0; c < config->num_crtc; c++) { for (c = 0; c < config->num_crtc; c++) {
@ -948,12 +940,7 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms)
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
int c; int c;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif
if (xf86RandR12Key == NULL)
return;
#if RANDR_13_INTERFACE
for (c = 0; c < config->num_crtc; c++) { for (c = 0; c < config->num_crtc; c++) {
xf86CrtcPtr crtc = config->crtc[c]; xf86CrtcPtr crtc = config->crtc[c];
@ -1821,9 +1808,6 @@ xf86RandR12CreateScreenResources12(ScreenPtr pScreen)
rrScrPrivPtr rp = rrGetScrPriv(pScreen); rrScrPrivPtr rp = rrGetScrPriv(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
if (xf86RandR12Key == NULL)
return TRUE;
for (c = 0; c < config->num_crtc; c++) for (c = 0; c < config->num_crtc; c++)
xf86RandR12CrtcNotify(config->crtc[c]->randr_crtc); xf86RandR12CrtcNotify(config->crtc[c]->randr_crtc);
@ -1853,9 +1837,6 @@ xf86RandR12TellChanged(ScreenPtr pScreen)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c; int c;
if (xf86RandR12Key == NULL)
return;
xf86RandR12SetInfo12(pScreen); xf86RandR12SetInfo12(pScreen);
for (c = 0; c < config->num_crtc; c++) for (c = 0; c < config->num_crtc; c++)
xf86RandR12CrtcNotify(config->crtc[c]->randr_crtc); xf86RandR12CrtcNotify(config->crtc[c]->randr_crtc);