From: Michel Dänzer <michel.daenzer@xxxxxxx> Fixes crash with Xinerama enabled, which disables RandR. Fixes: https://bugs.debian.org/827984 (Ported from radeon commit 3be841d0ae7d505cef325993205b12d15e98dba9) Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> --- src/amdgpu_kms.c | 21 ++++++++++++--------- src/drmmode_display.c | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c index f25f1bf..d1d86cd 100644 --- a/src/amdgpu_kms.c +++ b/src/amdgpu_kms.c @@ -167,7 +167,6 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); AMDGPUInfoPtr info = AMDGPUPTR(pScrn); - rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen); PixmapPtr pixmap; pScreen->CreateScreenResources = info->CreateScreenResources; @@ -176,17 +175,21 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen) pScreen->CreateScreenResources = AMDGPUCreateScreenResources_KMS; /* Set the RandR primary output if Xorg hasn't */ - if ( + if (dixPrivateKeyRegistered(rrPrivKey)) { + rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen); + + if ( #ifdef AMDGPU_PIXMAP_SHARING - !pScreen->isGPU && + !pScreen->isGPU && #endif - !rrScrPriv->primaryOutput) - { - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + !rrScrPriv->primaryOutput) + { + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - rrScrPriv->primaryOutput = xf86_config->output[0]->randr_output; - RROutputChanged(rrScrPriv->primaryOutput, FALSE); - rrScrPriv->layoutChanged = TRUE; + rrScrPriv->primaryOutput = xf86_config->output[0]->randr_output; + RROutputChanged(rrScrPriv->primaryOutput, FALSE); + rrScrPriv->layoutChanged = TRUE; + } } if (!drmmode_set_desired_modes(pScrn, &info->drmmode, pScrn->is_gpu)) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index fb01581..feea5bd 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -2382,7 +2382,7 @@ restart_destroy: changed = TRUE; } - if (changed) { + if (changed && dixPrivateKeyRegistered(rrPrivKey)) { #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0) RRSetChanged(xf86ScrnToScreen(scrn)); #else -- 2.8.1