From patchwork Thu Sep 6 00:03:46 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: 10589677 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 8F0FF15E9 for ; Thu, 6 Sep 2018 00:04:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EF4E2A9E0 for ; Thu, 6 Sep 2018 00:04:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72D0A2A9FC; Thu, 6 Sep 2018 00:04:14 +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 2F27D2A9E0 for ; Thu, 6 Sep 2018 00:04:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A1B576E586; Thu, 6 Sep 2018 00:04:13 +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 714A16E580; Thu, 6 Sep 2018 00:04:11 +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:04 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp79.eng.vmware.com [10.20.88.79]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id CE3B4B0823; Wed, 5 Sep 2018 20:04:10 -0400 (EDT) From: Deepak Rawat To: , , , , Date: Wed, 5 Sep 2018 17:03:46 -0700 Message-ID: <20180906000350.2478-2-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 1/5] 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. Signed-off-by: Deepak Rawat --- lib/drmtest.c | 9 ++++++++- lib/drmtest.h | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index bfa2e0f0..563d5b8b 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; @@ -205,7 +210,7 @@ static const struct module { { DRIVER_VC4, "vc4" }, { DRIVER_VGEM, "vgem" }, { DRIVER_VIRTIO, "virtio-gpu" }, - { DRIVER_VIRTIO, "virtio_gpu" }, + { DRIVER_VMWGFX, "vmwgfx" }, {} }; @@ -335,6 +340,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 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); From patchwork Thu Sep 6 00:03:48 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: 10589679 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 541D1112B for ; Thu, 6 Sep 2018 00:04:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43E372A9E0 for ; Thu, 6 Sep 2018 00:04:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 380542A9FC; Thu, 6 Sep 2018 00:04: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 00BD02A9E0 for ; Thu, 6 Sep 2018 00:04:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 59A666E589; Thu, 6 Sep 2018 00:04: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 40D686E588; Thu, 6 Sep 2018 00:04:15 +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:07 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp79.eng.vmware.com [10.20.88.79]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 94D31B082D; Wed, 5 Sep 2018 20:04:14 -0400 (EDT) From: Deepak Rawat To: , , , , Date: Wed, 5 Sep 2018 17:03:48 -0700 Message-ID: <20180906000350.2478-4-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 3/5] tests/kms: Don't check crtc state for vmwgfx legacy set_crtc 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 a Xorg bug vmwgfx has a kernel workaround which reset the value of mode::type. This will cause crtc state not to match what is expected. Signed-off-by: Deepak Rawat --- tests/kms_atomic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c index ac02baf0..72714e12 100644 --- a/tests/kms_atomic.c +++ b/tests/kms_atomic.c @@ -237,7 +237,12 @@ static void crtc_commit(igt_pipe_t *pipe, igt_plane_t *plane, { igt_display_commit2(pipe->display, s); - crtc_check_current_state(pipe, pipe->values, plane->values, relax); + /* + * For a vmwgfx xorg driver bug kernel module reset the value of + * mode::type so crtc state check fails for legacy commit + */ + if (!is_vmwgfx_device(pipe->display->drm_fd) || !(s == COMMIT_LEGACY)) + crtc_check_current_state(pipe, pipe->values, plane->values, relax); plane_check_current_state(plane, plane->values, relax); } 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), From patchwork Thu Sep 6 00:03:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak Singh Rawat X-Patchwork-Id: 10589685 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 62F9715E9 for ; Thu, 6 Sep 2018 00:04:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5013C2A9E0 for ; Thu, 6 Sep 2018 00:04:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43E312AA1A; Thu, 6 Sep 2018 00:04:31 +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 5FB9E2A9E0 for ; Thu, 6 Sep 2018 00:04:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D7CCA6E574; Thu, 6 Sep 2018 00:04:29 +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 CAF8D6E574; Thu, 6 Sep 2018 00:04:28 +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:21 -0700 Received: from ubuntu.localdomain (promb-2n-dhcp79.eng.vmware.com [10.20.88.79]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 397F3B0823; Wed, 5 Sep 2018 20:04:28 -0400 (EDT) From: Deepak Rawat To: , , , , Date: Wed, 5 Sep 2018 17:03:50 -0700 Message-ID: <20180906000350.2478-6-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 5/5] 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 , dri-devel@lists.freedesktop.org, =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Deepak Rawat , Lukasz Spintzyk 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. Signed-off-by: Deepak Rawat Cc: dri-devel@lists.freedesktop.org Cc: Daniel Vetter Cc: Lukasz Spintzyk Cc: Rob Clark Cc: Daniel Stone Cc: Noralf Trønnes Cc: Dave Airlie --- 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 9e9414cf..46cd50e1 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -175,6 +175,7 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = { [IGT_PLANE_IN_FORMATS] = "IN_FORMATS", [IGT_PLANE_COLOR_ENCODING] = "COLOR_ENCODING", [IGT_PLANE_COLOR_RANGE] = "COLOR_RANGE", + [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 bd0c0f09..893b7cf5 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -267,6 +267,7 @@ enum igt_atomic_plane_properties { IGT_PLANE_IN_FORMATS, IGT_PLANE_COLOR_ENCODING, IGT_PLANE_COLOR_RANGE, + IGT_PLANE_FB_DAMAGE_CLIPS, IGT_NUM_PLANE_PROPS }; diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c index 72714e12..4abc0ad5 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), @@ -840,6 +858,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); @@ -956,6 +1208,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);