[PATCH xf86-video-ati] Don't set modes before RADEONWindowExposures_oneshot is called

Michel Dänzer michel at daenzer.net
Mon Apr 17 09:39:59 UTC 2017


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

The root window contents may be undefined before that, so we don't want
to show anything yet.

Fixes a crash on startup with rotation and virtual resolution set in
xorg.conf.

Bugzilla: https://bugs.freedesktop.org/100276
Fixes: cc9d6b7db9c2 ("Move DPMS check from radeon_scanout_do_update to
                      radeon_scanout_flip")
(Ported from amdgpu commit 981bac185cfd74ae50dffc28f57cf34623a9595f)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 6 ++++++
 src/radeon.h          | 5 +++++
 src/radeon_kms.c      | 6 +++---
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9911c0a6a..84e7ef967 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -833,6 +833,12 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	int fb_id;
 	drmModeModeInfo kmode;
 
+	/* The root window contents may be undefined before the WindowExposures
+	 * hook is called for it, so bail if we get here before that
+	 */
+	if (pScreen->WindowExposures == RADEONWindowExposures_oneshot)
+		return FALSE;
+
 	saved_mode = crtc->mode;
 	saved_x = crtc->x;
 	saved_y = crtc->y;
diff --git a/src/radeon.h b/src/radeon.h
index 737441155..2d84c4ede 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -634,6 +634,11 @@ Bool radeon_dri3_screen_init(ScreenPtr screen);
 
 /* radeon_kms.c */
 Bool radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id);
+void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+		   , RegionPtr pBSRegion
+#endif
+		   );
 
 /* radeon_present.c */
 Bool radeon_present_screen_init(ScreenPtr screen);
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 424f9f724..157e72800 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1627,11 +1627,11 @@ static Bool RADEONCreateWindow_oneshot(WindowPtr pWin)
 }
 
 /* When the root window is mapped, set the initial modes */
-static void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
+void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
 #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
-					  , RegionPtr pBSRegion
+		   , RegionPtr pBSRegion
 #endif
-    )
+		   )
 {
     ScreenPtr pScreen = pWin->drawable.pScreen;
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-- 
2.11.0



More information about the amd-gfx mailing list