[PATCH xf86-video-ati] Only use RandR APIs if RandR is enabled

Michel Dänzer michel at daenzer.net
Mon Jun 27 02:19:56 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

Fixes crash with Xinerama enabled, which disables RandR.

Fixes: https://bugs.debian.org/827984
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c |  2 +-
 src/radeon_kms.c      | 21 ++++++++++++---------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b5d3dc9..2555465 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2613,7 +2613,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
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 940aad2..41ee597 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -241,7 +241,6 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info   = RADEONPTR(pScrn);
-    rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
     PixmapPtr pixmap;
     struct radeon_surface *surface;
 
@@ -251,17 +250,21 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
     pScreen->CreateScreenResources = RADEONCreateScreenResources_KMS;
 
     /* Set the RandR primary output if Xorg hasn't */
-    if (
+    if (dixPrivateKeyRegistered(rrPrivKey)) {
+	rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
+
+	if (
 #ifdef RADEON_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, FALSE))
-- 
2.8.1



More information about the xorg-driver-ati mailing list