From patchwork Thu Oct 11 00:20:59 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: 10635553 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 94983933 for ; Thu, 11 Oct 2018 00:21:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78AC62ACCF for ; Thu, 11 Oct 2018 00:21:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C85D2ACE1; Thu, 11 Oct 2018 00:21: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 2B5FB2ACCF for ; Thu, 11 Oct 2018 00:21:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9BB46E388; Thu, 11 Oct 2018 00:21:16 +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 84E996E383; Thu, 11 Oct 2018 00:21:14 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Wed, 10 Oct 2018 17:21:05 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp77.eng.vmware.com [10.20.88.77]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id DDBCB40881; Wed, 10 Oct 2018 17:21:13 -0700 (PDT) From: Deepak Rawat To: , , , , Date: Wed, 10 Oct 2018 17:20:59 -0700 Message-ID: <20181011002104.1845-1-drawat@vmware.com> X-Mailer: git-send-email 2.17.1 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 1/6] lib/igt_vmwgfx: Add vmwgfx device 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 Add DRIVER_VMWGFX to represent vmwgfx device for running igt tests. v2: Don't remove second virtio_gpu Signed-off-by: Deepak Rawat --- lib/drmtest.c | 8 ++++++++ lib/drmtest.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/lib/drmtest.c b/lib/drmtest.c index fee9d33a..9d013a00 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -105,6 +105,11 @@ bool is_i915_device(int fd) return __is_device(fd, "i915"); } +bool is_vmwgfx_device(int fd) +{ + return __is_device(fd, "vmwg"); +} + static bool has_known_intel_chipset(int fd) { struct drm_i915_getparam gp; @@ -206,6 +211,7 @@ static const struct module { { DRIVER_VGEM, "vgem" }, { DRIVER_VIRTIO, "virtio-gpu" }, { DRIVER_VIRTIO, "virtio_gpu" }, + { DRIVER_VMWGFX, "vmwgfx" }, {} }; @@ -348,6 +354,8 @@ static const char *chipset_to_str(int chipset) return "virtio"; case DRIVER_AMDGPU: return "amdgpu"; + case DRIVER_VMWGFX: + return "vmwgfx"; case DRIVER_ANY: return "any"; default: diff --git a/lib/drmtest.h b/lib/drmtest.h index 949865ee..0213fb51 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -43,6 +43,7 @@ #define DRIVER_VGEM (1 << 2) #define DRIVER_VIRTIO (1 << 3) #define DRIVER_AMDGPU (1 << 4) +#define DRIVER_VMWGFX (1 << 5) /* * Exclude DRVER_VGEM from DRIVER_ANY since if you run on a system * with vgem as well as a supported driver, you can end up with a @@ -80,6 +81,8 @@ void igt_require_intel(int fd); bool is_i915_device(int fd); +bool is_vmwgfx_device(int fd); + /** * do_or_die: * @x: command From patchwork Thu Oct 11 00:21:00 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: 10635551 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 435A317E1 for ; Thu, 11 Oct 2018 00:21:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27C092ACDA for ; Thu, 11 Oct 2018 00:21:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 189B72ACCF; Thu, 11 Oct 2018 00:21:17 +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 BE01D2ACCF for ; Thu, 11 Oct 2018 00:21:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 38DA26E384; Thu, 11 Oct 2018 00:21:16 +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 BEF8F6E383; Thu, 11 Oct 2018 00:21:15 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Wed, 10 Oct 2018 17:21:06 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp77.eng.vmware.com [10.20.88.77]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 20AAE4087E; Wed, 10 Oct 2018 17:21:15 -0700 (PDT) From: Deepak Rawat To: , , , , Date: Wed, 10 Oct 2018 17:21:00 -0700 Message-ID: <20181011002104.1845-2-drawat@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011002104.1845-1-drawat@vmware.com> References: <20181011002104.1845-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/6] 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. v2: Use drmIoctl with error when ioctl() failed. v3: Seperate ioctl wrapper. Signed-off-by: Deepak Rawat --- lib/igt_fb.c | 5 ++++- lib/igt_kms.c | 22 ++++++++++++++++++++++ lib/igt_kms.h | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 35be2e88..335ece69 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -2121,7 +2121,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 b2cbaa11..6e499f48 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -641,6 +641,28 @@ void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size, return ptr; } +static int __kmstest_dumb_destroy(int fd, uint32_t handle) +{ + struct drm_mode_destroy_dumb arg = { handle }; + int err = 0; + + if (drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg)) + err = -errno; + + errno = 0; + return err; +} + +/** + * 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) +{ + igt_assert_eq(__kmstest_dumb_destroy(fd, handle), 0); +} + /* * 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 38fa944e..cbfcced9 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); From patchwork Thu Oct 11 00:21:01 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: 10635555 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 A00CC933 for ; Thu, 11 Oct 2018 00:21:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82E4B2ACDA for ; Thu, 11 Oct 2018 00:21:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 776BF2ACEA; Thu, 11 Oct 2018 00:21: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 3E8DD2ACDA for ; Thu, 11 Oct 2018 00:21:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 844D36E38B; Thu, 11 Oct 2018 00:21:19 +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 7EEFE6E386; Thu, 11 Oct 2018 00:21:17 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Wed, 10 Oct 2018 17:20:58 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp77.eng.vmware.com [10.20.88.77]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id E9DA54087D; Wed, 10 Oct 2018 17:21:15 -0700 (PDT) From: Deepak Rawat To: , , , , Date: Wed, 10 Oct 2018 17:21:01 -0700 Message-ID: <20181011002104.1845-3-drawat@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011002104.1845-1-drawat@vmware.com> References: <20181011002104.1845-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 3/6] lib/igt_fb: Check for cairo surface success 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 For vmwgfx cairo surface creation fails due to stride mismatch, add a igt_require_f() for surface. v2: Check for surface creation failure. Signed-off-by: Deepak Rawat --- lib/igt_fb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 335ece69..1bb6d324 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -1433,6 +1433,10 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb) cairo_image_surface_create_for_data(ptr, drm_format_to_cairo(fb->drm_format), fb->width, fb->height, fb->strides[0]); + igt_require_f(cairo_surface_status(fb->cairo_surface) == CAIRO_STATUS_SUCCESS, + "Unable to create a cairo surface: %s\n", + cairo_status_to_string(cairo_surface_status(fb->cairo_surface))); + fb->domain = I915_GEM_DOMAIN_GTT; cairo_surface_set_user_data(fb->cairo_surface, From patchwork Thu Oct 11 00:21:02 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: 10635557 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 7835E5CAF for ; Thu, 11 Oct 2018 00:21:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D4552ACE1 for ; Thu, 11 Oct 2018 00:21:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51D1E2ACF4; Thu, 11 Oct 2018 00:21:22 +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 1C7DF2ACE1 for ; Thu, 11 Oct 2018 00:21:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C87F26E392; Thu, 11 Oct 2018 00:21:20 +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 B39C16E38A; Thu, 11 Oct 2018 00:21:17 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Wed, 10 Oct 2018 17:20:59 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp77.eng.vmware.com [10.20.88.77]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id B2ED94087D; Wed, 10 Oct 2018 17:21:16 -0700 (PDT) From: Deepak Rawat To: , , , , Date: Wed, 10 Oct 2018 17:21:02 -0700 Message-ID: <20181011002104.1845-4-drawat@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011002104.1845-1-drawat@vmware.com> References: <20181011002104.1845-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/6] lib: Don't call igt_require_fb_modifiers() when no modifier 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 doesn't support fb modifier so skip igt_require_fb_modifiers() when modifier are not passed. Signed-off-by: Deepak Rawat --- lib/ioctl_wrappers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 0929c43f..3a11cb6e 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1678,7 +1678,10 @@ int __kms_addfb(int fd, uint32_t handle, struct drm_mode_fb_cmd2 f; int ret, i; - igt_require_fb_modifiers(fd); + if (modifier) + igt_require_fb_modifiers(fd); + else + flags &= ~DRM_MODE_FB_MODIFIERS; memset(&f, 0, sizeof(f)); From patchwork Thu Oct 11 00:21:03 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: 10635561 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 BCED2933 for ; Thu, 11 Oct 2018 00:21:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5FB42ACE1 for ; Thu, 11 Oct 2018 00:21:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99B772ACF7; Thu, 11 Oct 2018 00:21:25 +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 D9BA42ACE1 for ; Thu, 11 Oct 2018 00:21:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 474186E394; Thu, 11 Oct 2018 00:21:24 +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 7C52F6E386; Thu, 11 Oct 2018 00:21:18 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Wed, 10 Oct 2018 17:21:00 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp77.eng.vmware.com [10.20.88.77]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id AB1FD4087D; Wed, 10 Oct 2018 17:21:17 -0700 (PDT) From: Deepak Rawat To: , , , , Date: Wed, 10 Oct 2018 17:21:03 -0700 Message-ID: <20181011002104.1845-5-drawat@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011002104.1845-1-drawat@vmware.com> References: <20181011002104.1845-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 5/6] tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property 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: Daniel Vetter , Pekka Paalanen , Deepak Rawat Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Some simple test cases to use FB_DAMAGE_CLIPS plane property. Cc: ville.syrjala@linux.intel.com Cc: Daniel Vetter Cc: Pekka Paalanen Cc: Daniel Stone Signed-off-by: Deepak Rawat --- lib/igt_kms.c | 1 + lib/igt_kms.h | 1 + tests/kms_atomic.c | 260 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 262 insertions(+) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 6e499f48..7a3ce2f6 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -177,6 +177,7 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = { [IGT_PLANE_COLOR_RANGE] = "COLOR_RANGE", [IGT_PLANE_PIXEL_BLEND_MODE] = "pixel blend mode", [IGT_PLANE_ALPHA] = "alpha", + [IGT_PLANE_FB_DAMAGE_CLIPS] = "FB_DAMAGE_CLIPS", }; const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = { diff --git a/lib/igt_kms.h b/lib/igt_kms.h index cbfcced9..e1c9a6a5 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -269,6 +269,7 @@ enum igt_atomic_plane_properties { IGT_PLANE_COLOR_RANGE, IGT_PLANE_PIXEL_BLEND_MODE, IGT_PLANE_ALPHA, + IGT_PLANE_FB_DAMAGE_CLIPS, IGT_NUM_PLANE_PROPS }; diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c index 3aad2d9a..20dfc978 100644 --- a/tests/kms_atomic.c +++ b/tests/kms_atomic.c @@ -56,6 +56,24 @@ IGT_TEST_DESCRIPTION("Test atomic modesetting API"); +/* signed32 drm_mode_rect declared here for use with drm damage for page-flip */ +struct damage_rect { + int x1; + int y1; + int x2; + int y2; +}; + +static inline int damage_rect_width(struct damage_rect *r) +{ + return r->x2 - r->x1; +} + +static inline int damage_rect_height(struct damage_rect *r) +{ + return r->y2 - r->y1; +} + enum kms_atomic_check_relax { ATOMIC_RELAX_NONE = 0, CRTC_RELAX_MODE = (1 << 0), @@ -835,6 +853,240 @@ static void atomic_invalid_params(igt_pipe_t *pipe, do_ioctl_err(display->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc, EFAULT); } +static void atomic_plane_damage(igt_pipe_t *pipe, igt_plane_t *plane, struct igt_fb *fb) +{ + struct damage_rect *damage; + struct igt_fb fb_1; + struct igt_fb fb_2; + cairo_t *cr_1; + cairo_t *cr_2; + + damage = malloc(sizeof(*damage) * 2); + igt_assert(damage); + + /* Color fb with white rect at center */ + igt_create_color_fb(pipe->display->drm_fd, fb->width, fb->height, + fb->drm_format, I915_TILING_NONE, 0.2, 0.2, 0.2, + &fb_1); + cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1); + igt_paint_color(cr_1, fb->width/4, fb->height/4, fb->width/2, + fb->height/2, 1.0, 1.0, 1.0); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1); + + /* + * Flip the primary plane to new color fb using atomic API and check the + * state. + */ + igt_plane_set_fb(plane, &fb_1); + crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE); + + /* + * Change the color of top left clip from center and issue plane update + * with damage and verify the state. + */ + damage[0].x1 = 0; + damage[0].y1 = 0; + damage[0].x2 = fb->width/2; + damage[0].y2 = fb->height/2; + + cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1); + igt_paint_color(cr_1, damage[0].x1, damage[0].y1, + damage_rect_width(&damage[0]), + damage_rect_height(&damage[0]), 1.0, 0, 0); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1); + + igt_plane_set_fb(plane, &fb_1); + igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage, + sizeof(*damage)); + crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE); + + /* + * Change the color of top left and bottom right clip from center and + * issue plane update with damage and verify the state. + */ + damage[0].x1 = 0; + damage[0].y1 = 0; + damage[0].x2 = fb->width/2; + damage[0].y2 = fb->height/2; + + damage[1].x1 = fb->width/2; + damage[1].y1 = fb->height/2; + damage[1].x2 = fb->width; + damage[1].y2 = fb->height; + + cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1); + igt_paint_color(cr_1, damage[0].x1, damage[0].y1, + damage_rect_width(&damage[0]), + damage_rect_height(&damage[0]), 1.0, 0, 1.0); + igt_paint_color(cr_1, damage[1].x1, damage[1].y1, + damage_rect_width(&damage[1]), + damage_rect_height(&damage[1]), 0, 0, 1.0); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1); + + igt_plane_set_fb(plane, &fb_1); + igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage, + sizeof(*damage) * 2); + crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE); + + /* + * Issue a plane update with damage on a seperate fb with damage to + * upper right clip from center. + */ + igt_create_color_fb(pipe->display->drm_fd, fb->width, fb->height, + fb->drm_format, I915_TILING_NONE, 0.2, 0.2, 0.2, + &fb_2); + + damage[0].x1 = fb->width/2; + damage[0].y1 = 0; + damage[0].x2 = fb->width; + damage[0].y2 = fb->height/2; + + cr_2 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_2); + cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1); + cairo_set_source_surface(cr_2, fb_1.cairo_surface, 0, 0); + cairo_paint(cr_2); + igt_paint_color(cr_2, damage[0].x1, damage[0].y1, + damage_rect_width(&damage[0]), + damage_rect_height(&damage[0]), 0, 1.0, 0); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_2, cr_2); + igt_plane_set_fb(plane, &fb_2); + igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage, + sizeof(*damage)); + crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE); + + /* + * Issue plane update with damage with a clip outside of plane src. + * NOTE: This will result in no update on plane as damage is outside, so + * will see no change on the screen. + */ + /* Reszie fb_1 to be bigger than plane */ + igt_remove_fb(pipe->display->drm_fd, &fb_1); + igt_create_color_fb(pipe->display->drm_fd, fb->width * 2, fb->height, + fb->drm_format, I915_TILING_NONE, 0.2, 0.2, 0.2, + &fb_1); + + damage[0].x1 = fb->width; + damage[0].y1 = 0; + damage[0].x2 = fb->width + fb->width/2; + damage[0].y2 = fb->height/2; + + cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1); + cr_2 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_2); + cairo_set_source_surface(cr_1, fb_2.cairo_surface, 0, 0); + cairo_paint(cr_1); + igt_paint_color(cr_1, damage[0].x1, damage[0].y1, + damage_rect_width(&damage[0]), + damage_rect_height(&damage[0]), 0, 1.0, 0); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_2, cr_2); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1); + igt_plane_set_fb(plane, &fb_1); + igt_plane_set_size(plane, fb->width, fb->height); + igt_fb_set_position(&fb_1, plane, 0, 0); + igt_fb_set_size(&fb_1, plane, fb->width, fb->height); + igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage, + sizeof(*damage)); + crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE); + + /* + * Issue a plane update with damage with a clip that overlap with plane + * src (Top right from center extending outside src in below case). + * NOTE: Here drm core should take care of intersecting the clip to + * plane src. + */ + damage[0].x1 = fb->width/2; + damage[0].y1 = 0; + damage[0].x2 = fb->width/2 + fb->width; + damage[0].y2 = fb->height/2; + + cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1); + igt_paint_color(cr_1, damage[0].x1, damage[0].y1, + damage_rect_width(&damage[0]), + damage_rect_height(&damage[0]), 1.0, 1.0, 0); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1); + igt_plane_set_fb(plane, &fb_1); + igt_plane_set_size(plane, fb->width, fb->height); + igt_fb_set_position(&fb_1, plane, 0, 0); + igt_fb_set_size(&fb_1, plane, fb->width, fb->height); + igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage, + sizeof(*damage)); + crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE); + + /* + * Issue a plane update with damage with two clips one inside plane src + * and one outside + * NOTE: This will result in plane update with clip inside plane src. + */ + damage[0].x1 = 0; + damage[0].y1 = fb->height/2; + damage[0].x2 = fb->width/2; + damage[0].y2 = fb->height; + + damage[1].x1 = fb->width + fb->width/2; + damage[1].y1 = fb->height/2; + damage[1].x2 = fb->width * 2; + damage[1].y2 = fb->height; + + cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1); + igt_paint_color(cr_1, damage[0].x1, damage[0].y1, + damage_rect_width(&damage[0]), + damage_rect_height(&damage[0]), 0, 1.0, 1.0); + igt_paint_color(cr_1, damage[1].x1, damage[1].y1, + damage_rect_width(&damage[1]), + damage_rect_height(&damage[1]), 0, 1.0, 0); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1); + igt_plane_set_fb(plane, &fb_1); + igt_plane_set_size(plane, fb->width, fb->height); + igt_fb_set_position(&fb_1, plane, 0, 0); + igt_fb_set_size(&fb_1, plane, fb->width, fb->height); + igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage, + sizeof(*damage) * 2); + crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE); + + /* + * Issue a plane update with overlapping damage clips. White rect in + * center overlap partially with top left red rect. + * NOTE: Drm core does not error for overlapping damage clips so if any + * driver does not support overlapping should have their own + * validations. + */ + damage[0].x1 = 0; + damage[0].y1 = 0; + damage[0].x2 = fb->width/2; + damage[0].y2 = fb->height/2; + + damage[1].x1 = fb->width/4; + damage[1].y1 = fb->height/4; + damage[1].x2 = fb->width/4 + fb->width/2; + damage[1].y2 = fb->height/4 + fb->height/2; + + cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1); + igt_paint_color(cr_1, damage[0].x1, damage[0].y1, + damage_rect_width(&damage[0]), + damage_rect_height(&damage[0]), 1.0, 0, 0); + igt_paint_color(cr_1, damage[1].x1, damage[1].y1, + damage_rect_width(&damage[1]), + damage_rect_height(&damage[1]), 1.0, 1.0, 1.0); + igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1); + igt_plane_set_fb(plane, &fb_1); + igt_plane_set_size(plane, fb->width, fb->height); + igt_fb_set_position(&fb_1, plane, 0, 0); + igt_fb_set_size(&fb_1, plane, fb->width, fb->height); + igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage, + sizeof(*damage) * 2); + crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE); + + /* Restore the primary plane */ + igt_plane_set_fb(plane, fb); + plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE); + + /* Remove the fb created for this test */ + igt_remove_fb(pipe->display->drm_fd, &fb_1); + igt_remove_fb(pipe->display->drm_fd, &fb_2); + + free(damage); +} + static void atomic_setup(igt_display_t *display, enum pipe pipe, igt_output_t *output, igt_plane_t *primary, struct igt_fb *fb) { igt_output_set_pipe(output, pipe); @@ -950,6 +1202,14 @@ igt_main atomic_invalid_params(pipe_obj, primary, output, &fb); } + igt_subtest("atomic_plane_damage") { + igt_require(igt_plane_has_prop(primary, IGT_PLANE_FB_DAMAGE_CLIPS)); + + atomic_setup(&display, pipe, output, primary, &fb); + + atomic_plane_damage(pipe_obj, primary, &fb); + } + igt_fixture { atomic_clear(&display, pipe, primary, output); igt_remove_fb(display.drm_fd, &fb); From patchwork Thu Oct 11 00:21:04 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: 10635559 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 ACC04933 for ; Thu, 11 Oct 2018 00:21:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F1062ACCF for ; Thu, 11 Oct 2018 00:21:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8331A2ACF4; Thu, 11 Oct 2018 00:21:23 +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 261922ACE1 for ; Thu, 11 Oct 2018 00:21:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E54196E393; Thu, 11 Oct 2018 00:21:20 +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 22F946E386; Thu, 11 Oct 2018 00:21:19 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Wed, 10 Oct 2018 17:21:09 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp77.eng.vmware.com [10.20.88.77]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 767954087F; Wed, 10 Oct 2018 17:21:18 -0700 (PDT) From: Deepak Rawat To: , , , , Date: Wed, 10 Oct 2018 17:21:04 -0700 Message-ID: <20181011002104.1845-6-drawat@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011002104.1845-1-drawat@vmware.com> References: <20181011002104.1845-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 6/6] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper 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: Daniel Vetter , Pekka Paalanen , Deepak Rawat Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Call kernel selftest module test-drm_damage_helper from igt. v2: - Add test alphabetically. - Add test to meson build. Cc: ville.syrjala@linux.intel.com Cc: Daniel Vetter Cc: Pekka Paalanen Cc: Daniel Stone Signed-off-by: Deepak Rawat --- tests/Makefile.sources | 1 + tests/drm_plane_damage.c | 10 ++++++++++ tests/igt_command_line.sh | 2 +- tests/meson.build | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/drm_plane_damage.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 001f1a2b..eae5f39e 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -32,6 +32,7 @@ TESTS_progs = \ debugfs_test \ drm_import_export \ drm_mm \ + drm_plane_damage \ drm_read \ drv_getparams_basic \ drv_hangman \ diff --git a/tests/drm_plane_damage.c b/tests/drm_plane_damage.c new file mode 100644 index 00000000..c2b793cc --- /dev/null +++ b/tests/drm_plane_damage.c @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include "igt.h" +#include "igt_kmod.h" + +IGT_TEST_DESCRIPTION("Basic sanity check of DRM's plane damage helper iterator."); + +igt_main +{ + igt_kselftests("test-drm_damage_helper", NULL, NULL, NULL); +} diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh index 8285ba62..621b2cbd 100755 --- a/tests/igt_command_line.sh +++ b/tests/igt_command_line.sh @@ -90,7 +90,7 @@ check_test () # Subtest enumeration of kernel selftest launchers depends # on the running kernel. If selftests are not enabled, # they will output nothing and exit with 0. - if [ "$testname" != "drv_selftest" -a "$testname" != "drm_mm" ]; then + if [ "$testname" != "drv_selftest" -a "$testname" != "drm_mm" -a "$testname" != "drm_plane_damage" ]; then fail $test fi fi diff --git a/tests/meson.build b/tests/meson.build index 697ff515..5acd7aa2 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -9,6 +9,7 @@ test_progs = [ 'debugfs_test', 'drm_import_export', 'drm_mm', + 'drm_plane_damage', 'drm_read', 'drv_getparams_basic', 'drv_hangman',