All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-amdgpu] Don't set modes before AMDGPUWindowExposures_oneshot is called
@ 2017-03-23  9:53 Michel Dänzer
       [not found] ` <20170323095355.7041-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Michel Dänzer @ 2017-03-23  9:53 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

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
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_drv.h      | 5 +++++
 src/amdgpu_kms.c      | 6 +++---
 src/drmmode_display.c | 6 ++++++
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 532d99daa..e5c44dc36 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -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);
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 4821e932f..90d0288af 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -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);
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2cdea90ad..a041e8b67 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -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;
-- 
2.11.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH xf86-video-amdgpu] Don't set modes before AMDGPUWindowExposures_oneshot is called
       [not found] ` <20170323095355.7041-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-03-23 12:43   ` Deucher, Alexander
  0 siblings, 0 replies; 2+ messages in thread
From: Deucher, Alexander @ 2017-03-23 12:43 UTC (permalink / raw)
  To: 'Michel Dänzer', amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
> Of Michel Dänzer
> Sent: Thursday, March 23, 2017 5:54 AM
> To: amd-gfx@lists.freedesktop.org
> Subject: [PATCH xf86-video-amdgpu] Don't set modes before
> AMDGPUWindowExposures_oneshot is called
> 
> From: Michel Dänzer <michel.daenzer@amd.com>
> 
> 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
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  src/amdgpu_drv.h      | 5 +++++
>  src/amdgpu_kms.c      | 6 +++---
>  src/drmmode_display.c | 6 ++++++
>  3 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
> index 532d99daa..e5c44dc36 100644
> --- a/src/amdgpu_drv.h
> +++ b/src/amdgpu_drv.h
> @@ -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);
> diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
> index 4821e932f..90d0288af 100644
> --- a/src/amdgpu_kms.c
> +++ b/src/amdgpu_kms.c
> @@ -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);
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 2cdea90ad..a041e8b67 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -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;
> --
> 2.11.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-23 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23  9:53 [PATCH xf86-video-amdgpu] Don't set modes before AMDGPUWindowExposures_oneshot is called Michel Dänzer
     [not found] ` <20170323095355.7041-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-03-23 12:43   ` Deucher, Alexander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.