[PATCH xf86-video-ati 10/15] present: Separate checks for flips vs unflips
Michel Dänzer
michel at daenzer.net
Wed Sep 21 09:50:49 UTC 2016
From: Michel Dänzer <michel.daenzer at amd.com>
All unflip checks apply to flips as well, but not vice versa.
(Ported from amdgpu commit 4d506c23c9a628204fa23607931557b07ada3e31)
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/radeon_present.c | 58 +++++++++++++++++++++++++++++++---------------------
1 file changed, 35 insertions(+), 23 deletions(-)
diff --git a/src/radeon_present.c b/src/radeon_present.c
index ff4045a..59f3c6b 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -225,16 +225,13 @@ radeon_present_get_pixmap_tiling_flags(RADEONInfoPtr info, PixmapPtr pixmap)
}
/*
- * Test to see if page flipping is possible on the target crtc
+ * Test to see if unflipping is possible
+ *
+ * These tests have to pass for flips as well
*/
static Bool
-radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
- Bool sync_flip)
+radeon_present_check_unflip(ScrnInfoPtr scrn)
{
- ScreenPtr screen = window->drawable.pScreen;
- ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
- RADEONInfoPtr info = RADEONPTR(scrn);
- PixmapPtr screen_pixmap;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int num_crtcs_on;
int i;
@@ -242,6 +239,35 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
if (!scrn->vtSema)
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;
+
+ if (!config->crtc[i]->enabled)
+ continue;
+
+ if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
+ drmmode_crtc->scanout[0].bo)
+ return FALSE;
+
+ if (drmmode_crtc->pending_dpms_mode == DPMSModeOn)
+ num_crtcs_on++;
+ }
+
+ return num_crtcs_on > 0;
+}
+
+/*
+ * Test to see if page flipping is possible on the target crtc
+ */
+static Bool
+radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
+ Bool sync_flip)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ RADEONInfoPtr info = RADEONPTR(scrn);
+ PixmapPtr screen_pixmap;
+
if (!info->allowPageFlip)
return FALSE;
@@ -259,21 +285,7 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
radeon_present_get_pixmap_tiling_flags(info, screen_pixmap))
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;
-
- if (!config->crtc[i]->enabled)
- continue;
-
- if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
- drmmode_crtc->scanout[0].bo)
- return FALSE;
-
- if (drmmode_crtc->pending_dpms_mode == DPMSModeOn)
- num_crtcs_on++;
- }
-
- return num_crtcs_on > 0;
+ return radeon_present_check_unflip(scrn);
}
/*
@@ -360,7 +372,7 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)
uint32_t handle;
int i;
- if (!radeon_present_check_flip(NULL, screen->root, pixmap, TRUE))
+ if (!radeon_present_check_unflip(scrn))
goto modeset;
if (!radeon_get_pixmap_handle(pixmap, &handle)) {
--
2.9.3
More information about the amd-gfx
mailing list