From patchwork Thu Jul 24 23:18:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 4620461 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EB7A29F375 for ; Thu, 24 Jul 2014 23:18:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 449C4201CD for ; Thu, 24 Jul 2014 23:18:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7F47A20170 for ; Thu, 24 Jul 2014 23:18:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A8D56E787; Thu, 24 Jul 2014 16:18:49 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F52D6E77B; Thu, 24 Jul 2014 16:18:47 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id 9ECC2760130; Thu, 24 Jul 2014 16:18:46 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from keithp.com ([127.0.0.1]) by localhost (keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rvjfUGOJCeb8; Thu, 24 Jul 2014 16:18:43 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1033) id CAD86760133; Thu, 24 Jul 2014 16:18:34 -0700 (PDT) Received: from hiro.keithp.com (localhost [127.0.0.1]) by keithp.com (Postfix) with ESMTP id 749FD76012D; Thu, 24 Jul 2014 16:18:34 -0700 (PDT) Received: by hiro.keithp.com (Postfix, from userid 1001) id 84ED174A67E; Thu, 24 Jul 2014 16:18:32 -0700 (PDT) From: Keith Packard To: xorg-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Thu, 24 Jul 2014 16:18:25 -0700 Message-Id: <1406243908-1123-10-git-send-email-keithp@keithp.com> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1406243908-1123-1-git-send-email-keithp@keithp.com> References: <1406243908-1123-1-git-send-email-keithp@keithp.com> Subject: [Intel-gfx] [PATCH 09/12] Do more checks for proposed flip pixmaps X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }