From patchwork Thu Sep 6 00:03:47 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: 10589683 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 3F88C15E9 for ; Thu, 6 Sep 2018 00:04:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E29B2A9E0 for ; Thu, 6 Sep 2018 00:04:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 225BA2AA1A; Thu, 6 Sep 2018 00:04:21 +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 CA0D92A9E0 for ; Thu, 6 Sep 2018 00:04:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6BD8B6E58D; Thu, 6 Sep 2018 00:04:19 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from EX13-EDG-OU-002.vmware.com (ex13-edg-ou-002.vmware.com [208.91.0.190]) by gabe.freedesktop.org (Postfix) with ESMTPS id 741BA6E583; Thu, 6 Sep 2018 00:04:13 +0000 (UTC) Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Wed, 5 Sep 2018 17:04:06 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp79.eng.vmware.com [10.20.88.79]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id BFE12B0823; Wed, 5 Sep 2018 20:04:12 -0400 (EDT) From: Deepak Rawat To: , , , , Date: Wed, 5 Sep 2018 17:03:47 -0700 Message-ID: <20180906000350.2478-3-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-002.vmware.com: drawat@vmware.com does not designate permitted sender hosts) Subject: [Intel-gfx] [PATCH i-g-t 2/5] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers 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 vmwgfx does not support GEM interface so calling gem_close on vmwgfx results in error. Call dumb destroy IOCTL in case have dumb buffer. Signed-off-by: Deepak Rawat --- lib/igt_fb.c | 5 ++++- lib/igt_kms.c | 15 +++++++++++++++ lib/igt_kms.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index ae71d967..ba995a1a 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -1920,7 +1920,10 @@ void igt_remove_fb(int fd, struct igt_fb *fb) cairo_surface_destroy(fb->cairo_surface); do_or_die(drmModeRmFB(fd, fb->fb_id)); - gem_close(fd, fb->gem_handle); + if (fb->is_dumb) + kmstest_dumb_destroy(fd, fb->gem_handle); + else + gem_close(fd, fb->gem_handle); fb->fb_id = 0; } diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 62d84684..9e9414cf 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -639,6 +639,21 @@ void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size, return ptr; } +/** + * kmstest_dumb_destroy: + * @fd: Opened drm file descriptor + * @handle: Offset in the file referred to by fd + */ +void kmstest_dumb_destroy(int fd, uint32_t handle) +{ + struct drm_mode_destroy_dumb arg = {}; + + igt_assert_neq(handle, 0); + + arg.handle = handle; + do_ioctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg); +} + /* * Returns: the previous mode, or KD_GRAPHICS if no /dev/tty0 was * found and nothing was done. diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 3a12f278..bd0c0f09 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -222,6 +222,7 @@ uint32_t kmstest_dumb_create(int fd, int width, int height, int bpp, void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size, unsigned prot); +void kmstest_dumb_destroy(int fd, uint32_t handle); void kmstest_wait_for_pageflip(int fd); unsigned int kmstest_get_vblank(int fd, int pipe, unsigned int flags); void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility);