[PATCH 2/3] present: Look at all CRTCs to determine if we can flip

Michel Dänzer michel at daenzer.net
Wed Jul 8 02:25:41 PDT 2015


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

Inspired by modesetting driver change by Kenneth Graunke.

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

diff --git a/src/radeon_present.c b/src/radeon_present.c
index bc1053e..49acb23 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -229,6 +229,9 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
     ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
     RADEONInfoPtr info = RADEONPTR(scrn);
     PixmapPtr screen_pixmap;
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+    int num_crtcs_on;
+    int i;
 
     if (!scrn->vtSema)
 	return FALSE;
@@ -250,17 +253,20 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
 	radeon_present_get_pixmap_tiling_flags(info, screen_pixmap))
 	return FALSE;
 
-    if (crtc) {
-	xf86CrtcPtr xf86_crtc = crtc->devPrivate;
-	drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
+    for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) {
+	drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private;
+
+	if (!config->crtc[i]->enabled)
+	    continue;
 
-	if (!drmmode_crtc ||
-	    drmmode_crtc->rotate.bo != NULL ||
-	    drmmode_crtc->dpms_mode != DPMSModeOn)
+	if (!drmmode_crtc || drmmode_crtc->rotate.bo != NULL)
 	    return FALSE;
+
+	if (drmmode_crtc->dpms_mode == DPMSModeOn)
+	    num_crtcs_on++;
     }
 
-    return TRUE;
+    return num_crtcs_on > 0;
 }
 
 /*
-- 
2.1.4



More information about the xorg-driver-ati mailing list