diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-07-06 17:46:56 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-07-12 16:04:43 +0900 |
commit | b5e2b964b7884c205a7c0fa578e05e867c176fcc (patch) | |
tree | 219cfa54dc29da411097e7b6c112628c6096292e | |
parent | 84496ebc89a9973347c774c13ff6f4667fcdbe69 (diff) |
Only use RandR APIs if RandR is enabled
Fixes crash with Xinerama enabled, which disables RandR.
Fixes: https://bugs.debian.org/827984
(Ported from radeon commit 3be841d0ae7d505cef325993205b12d15e98dba9)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/amdgpu_kms.c | 21 | ||||
-rw-r--r-- | 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 da009d1..9ee48df 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 f5d73c4..bcb4340 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -2369,7 +2369,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 |