[Intel-gfx] [PATCH 09/12] Do more checks for proposed flip pixmaps

Keith Packard keithp at keithp.com
Fri Jul 25 01:18:25 CEST 2014


Make sure the pitch and tiling are correct.
Make sure there's a BO we can get at.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 src/uxa/intel_present.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/uxa/intel_present.c b/src/uxa/intel_present.c
index c53d71d..b901fb1 100644
--- a/src/uxa/intel_present.c
+++ b/src/uxa/intel_present.c
@@ -248,6 +248,8 @@ intel_present_check_flip(RRCrtcPtr              crtc,
 	ScreenPtr               screen = window->drawable.pScreen;
 	ScrnInfoPtr             scrn = xf86ScreenToScrn(screen);
 	intel_screen_private    *intel = intel_get_screen_private(scrn);
+        dri_bo                  *bo;
+        uint32_t                tiling, swizzle;
 
 	if (!scrn->vtSema)
 		return FALSE;
@@ -261,6 +263,22 @@ intel_present_check_flip(RRCrtcPtr              crtc,
 	if (crtc && !intel_crtc_on(crtc->devPrivate))
 		return FALSE;
 
+        /* Check stride, can't change that on flip */
+        if (pixmap->devKind != intel->front_pitch)
+                return FALSE;
+
+        /* Make sure there's a bo we can get to */
+        bo = intel_get_pixmap_bo(pixmap);
+        if (!bo)
+                return FALSE;
+
+        /* Check tiling, can't change that on flip */
+        if (drm_intel_bo_get_tiling((drm_intel_bo *) bo, &tiling, &swizzle) != 0)
+                return FALSE;
+
+        if (tiling != intel->front_tiling)
+                return FALSE;
+
 	return TRUE;
 }
 
-- 
2.0.1




More information about the Intel-gfx mailing list