From: Keith Packard Subject: [PATCH 09/12] Do more checks for proposed flip pixmaps Date: Thu, 24 Jul 2014 16:18:25 -0700 Message-ID: <1406243908-1123-10-git-send-email-keithp@keithp.com> References: <1406243908-1123-1-git-send-email-keithp@keithp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1406243908-1123-1-git-send-email-keithp@keithp.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: xorg-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org Make sure the pitch and tiling are correct. Make sure there's a BO we can get at. Signed-off-by: Keith Packard --- 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