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>
(Cherry picked from commit b5e2b964b7)
This commit is contained in:
Michel Dänzer
2016-09-14 17:17:39 +09:00
committed by Michel Dänzer
parent 01565e4427
commit 2e6e81aa8d
2 changed files with 15 additions and 12 deletions

View File

@@ -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 (
#ifdef AMDGPU_PIXMAP_SHARING
!pScreen->isGPU &&
#endif
!rrScrPriv->primaryOutput)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
if (dixPrivateKeyRegistered(rrPrivKey)) {
rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
rrScrPriv->primaryOutput = xf86_config->output[0]->randr_output;
RROutputChanged(rrScrPriv->primaryOutput, FALSE);
rrScrPriv->layoutChanged = TRUE;
if (
#ifdef AMDGPU_PIXMAP_SHARING
!pScreen->isGPU &&
#endif
!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;
}
}
if (!drmmode_set_desired_modes(pScrn, &info->drmmode, pScrn->is_gpu))

View File

@@ -2452,7 +2452,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