[PATCH xf86-video-amdgpu 4/7] Make sure drmmode_crtc->scanout[] are destroyed when not needed

Michel Dänzer michel at daenzer.net
Wed Jun 22 08:50:28 UTC 2016


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

We failed to do this when going back to scanning out directly from the
screen pixmap.

As a bonus, since we now destroy drmmode_crtc->scanout[] after setting
the new scanout buffer, we may avoid the CRTC turning off intermittently
in this case.

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 1c2c184..a07ada6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -697,17 +697,11 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		if (crtc->randr_crtc && crtc->randr_crtc->scanout_pixmap) {
 			x = drmmode_crtc->prime_pixmap_x;
 			y = 0;
-
-			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
-			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
 		} else
 #endif
 		if (drmmode_crtc->rotate.fb_id) {
 			fb_id = drmmode_crtc->rotate.fb_id;
 			x = y = 0;
-
-			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
-			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
 		} else if (info->tear_free ||
 #if XF86_CRTC_VERSION >= 4
 			   crtc->driverIsPerformingTransform ||
@@ -838,9 +832,15 @@ done:
 		crtc->y = saved_y;
 		crtc->rotation = saved_rotation;
 		crtc->mode = saved_mode;
-	} else
+	} else {
 		crtc->active = TRUE;
 
+		if (fb_id != drmmode_crtc->scanout[0].fb_id) {
+			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
+			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
+		}
+	}
+
 	return ret;
 }
 
-- 
2.8.1



More information about the amd-gfx mailing list