From patchwork Thu Sep 6 00:03:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Singh Rawat X-Patchwork-Id: 10589681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF22E112B for ; Thu, 6 Sep 2018 00:04:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE4FB2A9E0 for ; Thu, 6 Sep 2018 00:04:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2AF22AA1A; Thu, 6 Sep 2018 00:04:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5BF762A9E0 for ; Thu, 6 Sep 2018 00:04:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D12CE6E58B; Thu, 6 Sep 2018 00:04:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from EX13-EDG-OU-001.vmware.com (ex13-edg-ou-001.vmware.com [208.91.0.189]) by gabe.freedesktop.org (Postfix) with ESMTPS id BE1516E58B; Thu, 6 Sep 2018 00:04:17 +0000 (UTC) Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Wed, 5 Sep 2018 17:04:11 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp79.eng.vmware.com [10.20.88.79]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 0062BB0823; Wed, 5 Sep 2018 20:04:16 -0400 (EDT) From: Deepak Rawat To: , , , , Date: Wed, 5 Sep 2018 17:03:49 -0700 Message-ID: <20180906000350.2478-5-drawat@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180906000350.2478-1-drawat@vmware.com> References: <20180906000350.2478-1-drawat@vmware.com> MIME-Version: 1.0 Received-SPF: None (EX13-EDG-OU-001.vmware.com: drawat@vmware.com does not designate permitted sender hosts) Subject: [Intel-gfx] [PATCH i-g-t 4/5] lib/igt_fb: Check for stride before creating cairo surface X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Deepak Rawat Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Cairo surface creation will fail if stride of provided buffer is not same as expected by cairo. This fails for vmwgfx odd length framebuffer as in vmwgfx stride is always width * bpp. Signed-off-by: Deepak Rawat --- lib/igt_fb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index ba995a1a..2724e323 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -1349,6 +1349,9 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb) ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size, PROT_READ | PROT_WRITE); + igt_require(fb->stride == cairo_format_stride_for_width( + drm_format_to_cairo(fb->drm_format), fb->width)); + fb->cairo_surface = cairo_image_surface_create_for_data(ptr, drm_format_to_cairo(fb->drm_format),