[PATCH xf86-video-amdgpu 7/7] present: Separate checks for flips vs unflips

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

All unflip checks apply to flips as well, but not vice versa.

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

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index c0b2f17..b0ee580 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -210,16 +210,9 @@ amdgpu_present_flush(WindowPtr window)
 	amdgpu_glamor_flush(xf86ScreenToScrn(window->drawable.pScreen));
 }
 
-/*
- * Test to see if page flipping is possible on the target crtc
- */
 static Bool
-amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
-			  Bool sync_flip)
+amdgpu_present_check_unflip(ScrnInfoPtr scrn)
 {
-	ScreenPtr screen = window->drawable.pScreen;
-	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-	AMDGPUInfoPtr info = AMDGPUPTR(scrn);
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
 	int num_crtcs_on;
 	int i;
@@ -227,15 +220,6 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
 	if (!scrn->vtSema)
 		return FALSE;
 
-	if (!info->allowPageFlip)
-		return FALSE;
-
-	if (info->hwcursor_disabled)
-		return FALSE;
-
-	if (info->drmmode.dri2_flipping)
-		return FALSE;
-
 	for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) {
 		drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private;
 
@@ -254,6 +238,29 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
 }
 
 /*
+ * Test to see if page flipping is possible on the target crtc
+ */
+static Bool
+amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
+			  Bool sync_flip)
+{
+	ScreenPtr screen = window->drawable.pScreen;
+	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+	AMDGPUInfoPtr info = AMDGPUPTR(scrn);
+
+	if (!info->allowPageFlip)
+		return FALSE;
+
+	if (info->hwcursor_disabled)
+		return FALSE;
+
+	if (info->drmmode.dri2_flipping)
+		return FALSE;
+
+	return amdgpu_present_check_unflip(scrn);
+}
+
+/*
  * Once the flip has been completed on all CRTCs, notify the
  * extension code telling it when that happened
  */
@@ -333,7 +340,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
 	PixmapPtr pixmap = screen->GetScreenPixmap(screen);
 	int i;
 
-	if (!amdgpu_present_check_flip(NULL, screen->root, pixmap, TRUE))
+	if (!amdgpu_present_check_unflip(scrn))
 		goto modeset;
 
 	event = calloc(1, sizeof(struct amdgpu_present_vblank_event));
-- 
2.8.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux