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

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

 



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

Signed-off-by: Keith Packard <keithp@xxxxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




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