All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-amdgpu 1/9] Use drmmode_crtc_scanout_free in drmmode_fini
@ 2017-03-03  9:07 Michel Dänzer
       [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Michel Dänzer @ 2017-03-03  9:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

We were leaking drmmode_crtc->scanout_damage, which caused trouble on
server reset. Fixes server reset with active separate scanout pixmaps.

(Cherry picked from radeon commit 0c29deb5a97d9a57e994cc0053c49ddf7aca6ecb)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 40439dd2b..406b5eed6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2415,13 +2415,8 @@ void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 #endif
 	}
 
-	for (c = 0; c < config->num_crtc; c++) {
-		xf86CrtcPtr crtc = config->crtc[c];
-		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-
-		drmmode_crtc_scanout_destroy(&info->drmmode, &drmmode_crtc->scanout[0]);
-		drmmode_crtc_scanout_destroy(&info->drmmode, &drmmode_crtc->scanout[1]);
-	}
+	for (c = 0; c < config->num_crtc; c++)
+		drmmode_crtc_scanout_free(config->crtc[c]->driver_private);
 }
 
 void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id,
-- 
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] 11+ messages in thread

* [PATCH xf86-video-amdgpu 2/9] present: Only call drmModeRmFB after setting modes for unflip
       [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-03-03  9:07   ` Michel Dänzer
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 3/9] present: Wait for GPU idle before " Michel Dänzer
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Michel Dänzer @ 2017-03-03  9:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Fixes display intermittently blanking when a modeset is used for unflip.

(Ported from radeon commit 3ff29e5a14451916bc66b4e0028e9a317f0723f8)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_present.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 364619084..5a345cb0a 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -351,6 +351,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
 	struct amdgpu_present_vblank_event *event;
 	PixmapPtr pixmap = screen->GetScreenPixmap(screen);
+	int old_fb_id;
 	int i;
 
 	if (!amdgpu_present_check_unflip(scrn))
@@ -374,7 +375,7 @@ modeset:
 	/* info->drmmode.fb_id still points to the FB for the last flipped BO.
 	 * Clear it, drmmode_set_mode_major will re-create it
 	 */
-	drmModeRmFB(pAMDGPUEnt->fd, info->drmmode.fb_id);
+	old_fb_id = info->drmmode.fb_id;
 	info->drmmode.fb_id = 0;
 
 	for (i = 0; i < config->num_crtc; i++) {
@@ -391,6 +392,7 @@ modeset:
 			drmmode_crtc->need_modeset = TRUE;
 	}
 
+	drmModeRmFB(pAMDGPUEnt->fd, old_fb_id);
 	present_event_notify(event_id, 0, 0);
 	info->drmmode.present_flipping = FALSE;
 }
-- 
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] 11+ messages in thread

* [PATCH xf86-video-amdgpu 3/9] present: Wait for GPU idle before setting modes for unflip
       [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 2/9] present: Only call drmModeRmFB after setting modes for unflip Michel Dänzer
@ 2017-03-03  9:07   ` Michel Dänzer
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 4/9] present: Also flush before using a flip to unflip Michel Dänzer
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Michel Dänzer @ 2017-03-03  9:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

To make sure the screen pixmap contents are up to date when it starts
being scanned out.

(Ported from radeon commit 244d4bc7f8c8f6bc90f49556c0b9344c8aa40295)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_present.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 5a345cb0a..cf6e36b2f 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -378,6 +378,7 @@ modeset:
 	old_fb_id = info->drmmode.fb_id;
 	info->drmmode.fb_id = 0;
 
+	amdgpu_glamor_finish(scrn);
 	for (i = 0; i < config->num_crtc; i++) {
 		xf86CrtcPtr crtc = config->crtc[i];
 		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-- 
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] 11+ messages in thread

* [PATCH xf86-video-amdgpu 4/9] present: Also flush before using a flip to unflip
       [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 2/9] present: Only call drmModeRmFB after setting modes for unflip Michel Dänzer
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 3/9] present: Wait for GPU idle before " Michel Dänzer
@ 2017-03-03  9:07   ` Michel Dänzer
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 5/9] present: Use async flip for unflip if possible Michel Dänzer
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Michel Dänzer @ 2017-03-03  9:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Not doing so might result in intermittently scanning out stale contents
of the screen pixmap.

(Ported from radeon commit 9a951a3e551db58ba50e7a594521ceac54d90615)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_present.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index cf6e36b2f..4048f9844 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -366,6 +366,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
 	event->event_id = event_id;
 	event->unflip = TRUE;
 
+	amdgpu_glamor_flush(scrn);
 	if (amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT, pixmap,
 			       event_id, event, -1, amdgpu_present_flip_event,
 			       amdgpu_present_flip_abort, FLIP_VSYNC, 0))
-- 
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] 11+ messages in thread

* [PATCH xf86-video-amdgpu 5/9] present: Use async flip for unflip if possible
       [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 4/9] present: Also flush before using a flip to unflip Michel Dänzer
@ 2017-03-03  9:07   ` Michel Dänzer
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 6/9] present: Flush before flipping Michel Dänzer
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Michel Dänzer @ 2017-03-03  9:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

In that case, unflip operations should finish faster in general.

(Ported from radeon commit 0a4eb0e12f0c9c653cf4cea6fd62e1a507eb261c)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_present.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 4048f9844..d381e15e0 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -48,6 +48,8 @@
 
 #include "present.h"
 
+static present_screen_info_rec amdgpu_present_screen_info;
+
 struct amdgpu_present_vblank_event {
 	uint64_t event_id;
 	Bool unflip;
@@ -351,6 +353,9 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
 	struct amdgpu_present_vblank_event *event;
 	PixmapPtr pixmap = screen->GetScreenPixmap(screen);
+	enum drmmode_flip_sync flip_sync =
+		(amdgpu_present_screen_info.capabilities & PresentCapabilityAsync) ?
+		FLIP_ASYNC : FLIP_VSYNC;
 	int old_fb_id;
 	int i;
 
@@ -369,7 +374,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
 	amdgpu_glamor_flush(scrn);
 	if (amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT, pixmap,
 			       event_id, event, -1, amdgpu_present_flip_event,
-			       amdgpu_present_flip_abort, FLIP_VSYNC, 0))
+			       amdgpu_present_flip_abort, flip_sync, 0))
 		return;
 
 modeset:
-- 
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] 11+ messages in thread

* [PATCH xf86-video-amdgpu 6/9] present: Flush before flipping
       [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 5/9] present: Use async flip for unflip if possible Michel Dänzer
@ 2017-03-03  9:07   ` Michel Dänzer
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 7/9] Call drmmode_set_desired_modes from a WindowExposures hook Michel Dänzer
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Michel Dänzer @ 2017-03-03  9:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This isn't necessary for DRI clients, but the Present extension can also
be used for presenting normal pixmaps rendered to via the X11 protocol.

(Ported from radeon commit 9035b6abea557828e672ee455f0c84e43da0906f)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_present.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index d381e15e0..3c4bc5259 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -327,6 +327,8 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
 
 	event->event_id = event_id;
 
+	amdgpu_glamor_flush(scrn);
+
 	ret = amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT,
 				 pixmap, event_id, event, crtc_id,
 				 amdgpu_present_flip_event,
-- 
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] 11+ messages in thread

* [PATCH xf86-video-amdgpu 7/9] Call drmmode_set_desired_modes from a WindowExposures hook
       [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (4 preceding siblings ...)
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 6/9] present: Flush before flipping Michel Dänzer
@ 2017-03-03  9:07   ` Michel Dänzer
       [not found]     ` <20170303090745.2254-7-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 8/9] Move DPMS check from amdgpu_scanout_do_update to amdgpu_scanout_flip Michel Dänzer
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 9/9] Don't call amdgpu_glamor_flush in drmmode_copy_fb Michel Dänzer
  7 siblings, 1 reply; 11+ messages in thread
From: Michel Dänzer @ 2017-03-03  9:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This is the earliest opportunity where the root window contents are
guaranteed to be initialized, and prevents drmmode_set_mode_major from
getting called before drmmode_set_desired_modes via AMDGPUUnblank ->
drmmode_crtc_dpms. Also, in contrast to the BlockHandler hook, this is
called when running Xorg with -pogo.

Fixes intermittently showing garbage on server startup or after server
reset.

As a bonus, this avoids trouble due to higher layers (e.g. the tigervnc
Xorg module) calling AMDGPUBlockHandler_oneshot repeatedly even after
we set pScreen->BlockHandler = AMDGPUBlockHandler_KMS.

Bugzilla: https://bugs.freedesktop.org/99457
(Ported from radeon commit 0a12bf1085505017068dfdfd31d23133e51b45b9)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_drv.h |  1 +
 src/amdgpu_kms.c | 40 ++++++++++++++++++++++++++++------------
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 2aaafe438..ae5b6f94c 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -230,6 +230,7 @@ typedef struct {
 
 	CreateScreenResourcesProcPtr CreateScreenResources;
 	CreateWindowProcPtr CreateWindow;
+	WindowExposuresProcPtr WindowExposures;
 
 	Bool IsSecondary;
 
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index bafcb9bbb..3420fd89a 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1039,17 +1039,6 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 #endif
 }
 
-static void AMDGPUBlockHandler_oneshot(BLOCKHANDLER_ARGS_DECL)
-{
-	SCREEN_PTR(arg);
-	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
-
-	AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS);
-
-	drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
-}
-
 /* This is called by AMDGPUPreInit to set up the default visual */
 static Bool AMDGPUPreInitVisual(ScrnInfoPtr pScrn)
 {
@@ -1266,6 +1255,31 @@ static Bool AMDGPUCreateWindow_oneshot(WindowPtr pWin)
 	return ret;
 }
 
+/* When the root window is mapped, set the initial modes */
+static void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+					  , RegionPtr pBSRegion
+#endif
+	)
+{
+	ScreenPtr pScreen = pWin->drawable.pScreen;
+	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
+
+	if (pWin != pScreen->root)
+		ErrorF("%s called for non-root window %p\n", __func__, pWin);
+
+	pScreen->WindowExposures = info->WindowExposures;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+	pScreen->WindowExposures(pWin, pRegion, RegionPtr pBSRegion);
+#else
+	pScreen->WindowExposures(pWin, pRegion);
+#endif
+
+	amdgpu_glamor_finish(pScrn);
+	drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
+}
+
 Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 {
 	AMDGPUInfoPtr info;
@@ -1824,6 +1838,8 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 		info->CreateWindow = pScreen->CreateWindow;
 		pScreen->CreateWindow = AMDGPUCreateWindow_oneshot;
 	}
+	info->WindowExposures = pScreen->WindowExposures;
+	pScreen->WindowExposures = AMDGPUWindowExposures_oneshot;
 
 	/* Provide SaveScreen & wrap BlockHandler and CloseScreen */
 	/* Wrap CloseScreen */
@@ -1831,7 +1847,7 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	pScreen->CloseScreen = AMDGPUCloseScreen_KMS;
 	pScreen->SaveScreen = AMDGPUSaveScreen_KMS;
 	info->BlockHandler = pScreen->BlockHandler;
-	pScreen->BlockHandler = AMDGPUBlockHandler_oneshot;
+	pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
 
 	info->CreateScreenResources = pScreen->CreateScreenResources;
 	pScreen->CreateScreenResources = AMDGPUCreateScreenResources_KMS;
-- 
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] 11+ messages in thread

* [PATCH xf86-video-amdgpu 8/9] Move DPMS check from amdgpu_scanout_do_update to amdgpu_scanout_flip
       [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (5 preceding siblings ...)
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 7/9] Call drmmode_set_desired_modes from a WindowExposures hook Michel Dänzer
@ 2017-03-03  9:07   ` Michel Dänzer
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 9/9] Don't call amdgpu_glamor_flush in drmmode_copy_fb Michel Dänzer
  7 siblings, 0 replies; 11+ messages in thread
From: Michel Dänzer @ 2017-03-03  9:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

When amdgpu_scanout_do_update is called from
drmmode_crtc_scanout_update, drmmode_crtc->pending_dpms_mode may still
be != DPMSModeOn, e.g. during server startup.

Fixes intermittently showing garbage with TearFree enabled.

(Ported from radeon commit cc9d6b7db9c2078be1e530a64af6d517c6a42024)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 3420fd89a..6fb051422 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -787,7 +787,6 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
 	BoxRec extents;
 
 	if (!xf86_crtc->enabled ||
-	    drmmode_crtc->pending_dpms_mode != DPMSModeOn ||
 	    !drmmode_crtc->scanout[scanout_id].pixmap)
 		return FALSE;
 
@@ -970,7 +969,8 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,
 	uintptr_t drm_queue_seq;
 	unsigned scanout_id;
 
-	if (drmmode_crtc->scanout_update_pending)
+	if (drmmode_crtc->scanout_update_pending ||
+	    drmmode_crtc->pending_dpms_mode != DPMSModeOn)
 		return;
 
 	scanout_id = drmmode_crtc->scanout_id ^ 1;
-- 
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] 11+ messages in thread

* [PATCH xf86-video-amdgpu 9/9] Don't call amdgpu_glamor_flush in drmmode_copy_fb
       [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (6 preceding siblings ...)
  2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 8/9] Move DPMS check from amdgpu_scanout_do_update to amdgpu_scanout_flip Michel Dänzer
@ 2017-03-03  9:07   ` Michel Dänzer
  7 siblings, 0 replies; 11+ messages in thread
From: Michel Dänzer @ 2017-03-03  9:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

AMDGPUWindowExposures_oneshot takes care of it.

(Ported from radeon commit d63881623f0686a66a2e3e3c1f84e496aa52ec6b)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 406b5eed6..2cdea90ad 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -429,8 +429,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 
 	FreeScratchGC(gc);
 
-	amdgpu_glamor_finish(pScrn);
-
 	pScreen->canDoBGNoneRoot = TRUE;
 
 	if (info->fbcon_pixmap)
-- 
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] 11+ messages in thread

* [PATCH xf86-video-amdgpu v2 7/9] Call drmmode_set_desired_modes from a WindowExposures hook
       [not found]     ` <20170303090745.2254-7-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-03-06  1:47       ` Michel Dänzer
       [not found]         ` <20170306014759.9030-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Michel Dänzer @ 2017-03-06  1:47 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This is the earliest opportunity where the root window contents are
guaranteed to be initialized, and prevents drmmode_set_mode_major from
getting called before drmmode_set_desired_modes via AMDGPUUnblank ->
drmmode_crtc_dpms. Also, in contrast to the BlockHandler hook, this is
called when running Xorg with -pogo.

Fixes intermittently showing garbage on server startup or after server
reset.

As a bonus, this avoids trouble due to higher layers (e.g. the tigervnc
Xorg module) calling AMDGPUBlockHandler_oneshot repeatedly even after
we set pScreen->BlockHandler = AMDGPUBlockHandler_KMS.

Bugzilla: https://bugs.freedesktop.org/99457
(Ported from radeon commits 0a12bf1085505017068dfdfd31d23133e51b45b9 and
f0e7948e1c0e984fc27f235f365639e9cf628291)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---

v2: Squash radeon commit f0e7948e1c0e984fc27f235f365639e9cf628291 to fix
    compile error against xserver < 1.16.99.901

Any volunteers for reviewing this series?

 src/amdgpu_drv.h |  1 +
 src/amdgpu_kms.c | 40 ++++++++++++++++++++++++++++------------
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 2aaafe438..ae5b6f94c 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -230,6 +230,7 @@ typedef struct {
 
 	CreateScreenResourcesProcPtr CreateScreenResources;
 	CreateWindowProcPtr CreateWindow;
+	WindowExposuresProcPtr WindowExposures;
 
 	Bool IsSecondary;
 
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index bafcb9bbb..ce1ae43a4 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1039,17 +1039,6 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 #endif
 }
 
-static void AMDGPUBlockHandler_oneshot(BLOCKHANDLER_ARGS_DECL)
-{
-	SCREEN_PTR(arg);
-	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
-
-	AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS);
-
-	drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
-}
-
 /* This is called by AMDGPUPreInit to set up the default visual */
 static Bool AMDGPUPreInitVisual(ScrnInfoPtr pScrn)
 {
@@ -1266,6 +1255,31 @@ static Bool AMDGPUCreateWindow_oneshot(WindowPtr pWin)
 	return ret;
 }
 
+/* When the root window is mapped, set the initial modes */
+static void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+					  , RegionPtr pBSRegion
+#endif
+	)
+{
+	ScreenPtr pScreen = pWin->drawable.pScreen;
+	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
+
+	if (pWin != pScreen->root)
+		ErrorF("%s called for non-root window %p\n", __func__, pWin);
+
+	pScreen->WindowExposures = info->WindowExposures;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+	pScreen->WindowExposures(pWin, pRegion, pBSRegion);
+#else
+	pScreen->WindowExposures(pWin, pRegion);
+#endif
+
+	amdgpu_glamor_finish(pScrn);
+	drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
+}
+
 Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 {
 	AMDGPUInfoPtr info;
@@ -1824,6 +1838,8 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 		info->CreateWindow = pScreen->CreateWindow;
 		pScreen->CreateWindow = AMDGPUCreateWindow_oneshot;
 	}
+	info->WindowExposures = pScreen->WindowExposures;
+	pScreen->WindowExposures = AMDGPUWindowExposures_oneshot;
 
 	/* Provide SaveScreen & wrap BlockHandler and CloseScreen */
 	/* Wrap CloseScreen */
@@ -1831,7 +1847,7 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	pScreen->CloseScreen = AMDGPUCloseScreen_KMS;
 	pScreen->SaveScreen = AMDGPUSaveScreen_KMS;
 	info->BlockHandler = pScreen->BlockHandler;
-	pScreen->BlockHandler = AMDGPUBlockHandler_oneshot;
+	pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
 
 	info->CreateScreenResources = pScreen->CreateScreenResources;
 	pScreen->CreateScreenResources = AMDGPUCreateScreenResources_KMS;
-- 
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] 11+ messages in thread

* Re: [PATCH xf86-video-amdgpu v2 7/9] Call drmmode_set_desired_modes from a WindowExposures hook
       [not found]         ` <20170306014759.9030-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-03-06 15:23           ` Alex Deucher
  0 siblings, 0 replies; 11+ messages in thread
From: Alex Deucher @ 2017-03-06 15:23 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx list

On Sun, Mar 5, 2017 at 8:47 PM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> This is the earliest opportunity where the root window contents are
> guaranteed to be initialized, and prevents drmmode_set_mode_major from
> getting called before drmmode_set_desired_modes via AMDGPUUnblank ->
> drmmode_crtc_dpms. Also, in contrast to the BlockHandler hook, this is
> called when running Xorg with -pogo.
>
> Fixes intermittently showing garbage on server startup or after server
> reset.
>
> As a bonus, this avoids trouble due to higher layers (e.g. the tigervnc
> Xorg module) calling AMDGPUBlockHandler_oneshot repeatedly even after
> we set pScreen->BlockHandler = AMDGPUBlockHandler_KMS.
>
> Bugzilla: https://bugs.freedesktop.org/99457
> (Ported from radeon commits 0a12bf1085505017068dfdfd31d23133e51b45b9 and
> f0e7948e1c0e984fc27f235f365639e9cf628291)
>
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
> ---
>
> v2: Squash radeon commit f0e7948e1c0e984fc27f235f365639e9cf628291 to fix
>     compile error against xserver < 1.16.99.901
>
> Any volunteers for reviewing this series?

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


>
>  src/amdgpu_drv.h |  1 +
>  src/amdgpu_kms.c | 40 ++++++++++++++++++++++++++++------------
>  2 files changed, 29 insertions(+), 12 deletions(-)
>
> diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
> index 2aaafe438..ae5b6f94c 100644
> --- a/src/amdgpu_drv.h
> +++ b/src/amdgpu_drv.h
> @@ -230,6 +230,7 @@ typedef struct {
>
>         CreateScreenResourcesProcPtr CreateScreenResources;
>         CreateWindowProcPtr CreateWindow;
> +       WindowExposuresProcPtr WindowExposures;
>
>         Bool IsSecondary;
>
> diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
> index bafcb9bbb..ce1ae43a4 100644
> --- a/src/amdgpu_kms.c
> +++ b/src/amdgpu_kms.c
> @@ -1039,17 +1039,6 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
>  #endif
>  }
>
> -static void AMDGPUBlockHandler_oneshot(BLOCKHANDLER_ARGS_DECL)
> -{
> -       SCREEN_PTR(arg);
> -       ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
> -       AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
> -
> -       AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS);
> -
> -       drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
> -}
> -
>  /* This is called by AMDGPUPreInit to set up the default visual */
>  static Bool AMDGPUPreInitVisual(ScrnInfoPtr pScrn)
>  {
> @@ -1266,6 +1255,31 @@ static Bool AMDGPUCreateWindow_oneshot(WindowPtr pWin)
>         return ret;
>  }
>
> +/* When the root window is mapped, set the initial modes */
> +static void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
> +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
> +                                         , RegionPtr pBSRegion
> +#endif
> +       )
> +{
> +       ScreenPtr pScreen = pWin->drawable.pScreen;
> +       ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
> +       AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
> +
> +       if (pWin != pScreen->root)
> +               ErrorF("%s called for non-root window %p\n", __func__, pWin);
> +
> +       pScreen->WindowExposures = info->WindowExposures;
> +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
> +       pScreen->WindowExposures(pWin, pRegion, pBSRegion);
> +#else
> +       pScreen->WindowExposures(pWin, pRegion);
> +#endif
> +
> +       amdgpu_glamor_finish(pScrn);
> +       drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
> +}
> +
>  Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
>  {
>         AMDGPUInfoPtr info;
> @@ -1824,6 +1838,8 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>                 info->CreateWindow = pScreen->CreateWindow;
>                 pScreen->CreateWindow = AMDGPUCreateWindow_oneshot;
>         }
> +       info->WindowExposures = pScreen->WindowExposures;
> +       pScreen->WindowExposures = AMDGPUWindowExposures_oneshot;
>
>         /* Provide SaveScreen & wrap BlockHandler and CloseScreen */
>         /* Wrap CloseScreen */
> @@ -1831,7 +1847,7 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>         pScreen->CloseScreen = AMDGPUCloseScreen_KMS;
>         pScreen->SaveScreen = AMDGPUSaveScreen_KMS;
>         info->BlockHandler = pScreen->BlockHandler;
> -       pScreen->BlockHandler = AMDGPUBlockHandler_oneshot;
> +       pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
>
>         info->CreateScreenResources = pScreen->CreateScreenResources;
>         pScreen->CreateScreenResources = AMDGPUCreateScreenResources_KMS;
> --
> 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] 11+ messages in thread

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

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03  9:07 [PATCH xf86-video-amdgpu 1/9] Use drmmode_crtc_scanout_free in drmmode_fini Michel Dänzer
     [not found] ` <20170303090745.2254-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 2/9] present: Only call drmModeRmFB after setting modes for unflip Michel Dänzer
2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 3/9] present: Wait for GPU idle before " Michel Dänzer
2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 4/9] present: Also flush before using a flip to unflip Michel Dänzer
2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 5/9] present: Use async flip for unflip if possible Michel Dänzer
2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 6/9] present: Flush before flipping Michel Dänzer
2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 7/9] Call drmmode_set_desired_modes from a WindowExposures hook Michel Dänzer
     [not found]     ` <20170303090745.2254-7-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-03-06  1:47       ` [PATCH xf86-video-amdgpu v2 " Michel Dänzer
     [not found]         ` <20170306014759.9030-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-03-06 15:23           ` Alex Deucher
2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 8/9] Move DPMS check from amdgpu_scanout_do_update to amdgpu_scanout_flip Michel Dänzer
2017-03-03  9:07   ` [PATCH xf86-video-amdgpu 9/9] Don't call amdgpu_glamor_flush in drmmode_copy_fb Michel Dänzer

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.