Skip to contentSkip to conversation

Don't set modes before AMDGPUWindowExposures_oneshot is called

PATCH In review Michel Dänzer 2 participants 2 messages Mar 23, 2017 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't set modes before AMDGPUWindowExposures_oneshot is called

From: Michel Dänzer <[email protected]>

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

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

Bugzilla: https://bugs.freedesktop.org/100276

---
 src/amdgpu_drv.h      | 5 +++++
 src/amdgpu_kms.c      | 6 +++---
 src/drmmode_display.c | 6 ++++++
 3 files changed, 14 insertions(+), 3 deletions(-)
src/amdgpu_drv.h +5 -0
index 532d99daa..e5c44dc36 100644
@@ -315,6 +315,11 @@ Bool amdgpu_dri3_screen_init(ScreenPtr screen);
 
 /* amdgpu_kms.c */
 Bool amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id);
+void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+				   , RegionPtr pBSRegion
+#endif
+				   );
 
 /* amdgpu_present.c */
 Bool amdgpu_present_screen_init(ScreenPtr screen);
src/amdgpu_kms.c +3 -3
index 4821e932f..90d0288af 100644
@@ -1258,11 +1258,11 @@ static Bool AMDGPUCreateWindow_oneshot(WindowPtr pWin)
 }
 
 /* When the root window is mapped, set the initial modes */
-static void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
+void AMDGPUWindowExposures_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);
src/drmmode_display.c +6 -0
index 2cdea90ad..a041e8b67 100644
@@ -779,6 +779,12 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	drmModeModeInfo kmode;
 	uint32_t bo_handle;
 
+	/* 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 == AMDGPUWindowExposures_oneshot)
+		return FALSE;
+
 	saved_mode = crtc->mode;
 	saved_x = crtc->x;
 	saved_y = crtc->y;
Signature · 6 lines
2.11.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170323095355.7041-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by Alex Deucher
#2 lore raw
Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Thursday, March 23, 2017 5:54 AM
To: [email protected]
Subject: [PATCH xf86-video-amdgpu] Don't set modes before AMDGPUWindowExposures_oneshot is called

From: Michel Dänzer <[email protected]>

Quoted 8 lines

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

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

Bugzilla: https://bugs.freedesktop.org/100276

Quoted 68 lines
---
 src/amdgpu_drv.h      | 5 +++++
 src/amdgpu_kms.c      | 6 +++---
 src/drmmode_display.c | 6 ++++++
 3 files changed, 14 insertions(+), 3 deletions(-)
src/amdgpu_drv.h +1 -0
index 532d99daa..e5c44dc36 100644
@@ -315,6 +315,11 @@ Bool amdgpu_dri3_screen_init(ScreenPtr screen);
 
 /* amdgpu_kms.c */
 Bool amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id);
+void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr

pRegion

src/amdgpu_drv.h +4 -0
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+				   , RegionPtr pBSRegion
+#endif
+				   );
 
 /* amdgpu_present.c */
 Bool amdgpu_present_screen_init(ScreenPtr screen);
src/amdgpu_kms.c +0 -1
index 4821e932f..90d0288af 100644
@@ -1258,11 +1258,11 @@ static Bool
 AMDGPUCreateWindow_oneshot(WindowPtr pWin)
 }
 
 /* When the root window is mapped, set the initial modes */
-static void AMDGPUWindowExposures_oneshot(WindowPtr pWin,

RegionPtr pRegion
+void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)

src/amdgpu_kms.c +2 -2
-					  , RegionPtr pBSRegion
+				   , RegionPtr pBSRegion
 #endif
-	)
+				   )
 {
 	ScreenPtr pScreen = pWin->drawable.pScreen;
 	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
src/drmmode_display.c +1 -0
index 2cdea90ad..a041e8b67 100644
@@ -779,6 +779,12 @@ drmmode_set_mode_major(xf86CrtcPtr crtc,
 DisplayModePtr mode,
 	drmModeModeInfo kmode;
 	uint32_t bo_handle;
 
+	/* The root window contents may be undefined before the

WindowExposures

src/drmmode_display.c +3 -0
+	 * hook is called for it, so bail if we get here before that
+	 */
+	if (pScreen->WindowExposures ==

AMDGPUWindowExposures_oneshot)

src/drmmode_display.c +2 -1
+		return FALSE;
+
 	saved_mode = crtc->mode;
 	saved_x = crtc->x;
 	saved_y = crtc->y;
--

2.11.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx