From patchwork Wed Nov 14 22:28:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 10683207 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 DAFD113B5 for ; Wed, 14 Nov 2018 22:28:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE50629D13 for ; Wed, 14 Nov 2018 22:28:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2A2D29D2A; Wed, 14 Nov 2018 22:28:46 +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 5B06829D13 for ; Wed, 14 Nov 2018 22:28:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 417696E581; Wed, 14 Nov 2018 22:28:45 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id 228906E581 for ; Wed, 14 Nov 2018 22:28:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 9DB8B10A1311; Wed, 14 Nov 2018 14:28:43 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id eME36PjFKIIB; Wed, 14 Nov 2018 14:28:42 -0800 (PST) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 1C63910A1360; Wed, 14 Nov 2018 14:28:34 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id B4CFA2FE3700; Wed, 14 Nov 2018 14:28:32 -0800 (PST) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Wed, 14 Nov 2018 14:28:29 -0800 Message-Id: <20181114222832.22839-1-eric@anholt.net> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/4] kms_content_protection: Fix log bug on 32-bit platforms. 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP long is different between 32 and 64 and should basically never be used. Fixes compiler warning about passing the wrong type. Signed-off-by: Eric Anholt --- tests/kms_content_protection.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c index 801eff66c272..bb9ecd3f4cde 100644 --- a/tests/kms_content_protection.c +++ b/tests/kms_content_protection.c @@ -89,7 +89,8 @@ wait_for_prop_value(igt_output_t *output, uint64_t expected, return true; usleep(1000); } - igt_info("prop_value mismatch %ld != %ld\n", val, expected); + igt_info("prop_value mismatch %lld != %lld\n", + (long long)val, (long long)expected); return false; } From patchwork Wed Nov 14 22:28:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 10683213 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 8CA6C14DB for ; Wed, 14 Nov 2018 22:28:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EB3729D13 for ; Wed, 14 Nov 2018 22:28:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 722C629D2A; Wed, 14 Nov 2018 22:28:52 +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 D3D6429D13 for ; Wed, 14 Nov 2018 22:28:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 191D36E5CB; Wed, 14 Nov 2018 22:28:50 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id E5A116E5C3 for ; Wed, 14 Nov 2018 22:28:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id B629410A12ED; Wed, 14 Nov 2018 14:28:48 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 8gt_baiF8hVY; Wed, 14 Nov 2018 14:28:46 -0800 (PST) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 39C7810A1376; Wed, 14 Nov 2018 14:28:34 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id B873D2FE36FF; Wed, 14 Nov 2018 14:28:32 -0800 (PST) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Wed, 14 Nov 2018 14:28:30 -0800 Message-Id: <20181114222832.22839-2-eric@anholt.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114222832.22839-1-eric@anholt.net> References: <20181114222832.22839-1-eric@anholt.net> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 2/4] v3d: Import the V3D DRM UAPI header. 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Copied from make headers_install at drm-misc-next 783195ec1cad ("drm/syncobj: disable the timeline UAPI for now v2") Signed-off-by: Eric Anholt Acked-by: Petri Latvala --- include/drm-uapi/v3d_drm.h | 204 +++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 include/drm-uapi/v3d_drm.h diff --git a/include/drm-uapi/v3d_drm.h b/include/drm-uapi/v3d_drm.h new file mode 100644 index 000000000000..f446656d00b1 --- /dev/null +++ b/include/drm-uapi/v3d_drm.h @@ -0,0 +1,204 @@ +/* + * Copyright © 2014-2018 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _V3D_DRM_H_ +#define _V3D_DRM_H_ + +#include "drm.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +#define DRM_V3D_SUBMIT_CL 0x00 +#define DRM_V3D_WAIT_BO 0x01 +#define DRM_V3D_CREATE_BO 0x02 +#define DRM_V3D_MMAP_BO 0x03 +#define DRM_V3D_GET_PARAM 0x04 +#define DRM_V3D_GET_BO_OFFSET 0x05 + +#define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl) +#define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo) +#define DRM_IOCTL_V3D_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_CREATE_BO, struct drm_v3d_create_bo) +#define DRM_IOCTL_V3D_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_MMAP_BO, struct drm_v3d_mmap_bo) +#define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param) +#define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset) + +/** + * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D + * engine. + * + * This asks the kernel to have the GPU execute an optional binner + * command list, and a render command list. + */ +struct drm_v3d_submit_cl { + /* Pointer to the binner command list. + * + * This is the first set of commands executed, which runs the + * coordinate shader to determine where primitives land on the screen, + * then writes out the state updates and draw calls necessary per tile + * to the tile allocation BO. + * + * This BCL will block on any previous BCL submitted on the + * same FD, but not on any RCL or BCLs submitted by other + * clients -- that is left up to the submitter to control + * using in_sync_bcl if necessary. + */ + __u32 bcl_start; + + /** End address of the BCL (first byte after the BCL) */ + __u32 bcl_end; + + /* Offset of the render command list. + * + * This is the second set of commands executed, which will either + * execute the tiles that have been set up by the BCL, or a fixed set + * of tiles (in the case of RCL-only blits). + * + * This RCL will block on this submit's BCL, and any previous + * RCL submitted on the same FD, but not on any RCL or BCLs + * submitted by other clients -- that is left up to the + * submitter to control using in_sync_rcl if necessary. + */ + __u32 rcl_start; + + /** End address of the RCL (first byte after the RCL) */ + __u32 rcl_end; + + /** An optional sync object to wait on before starting the BCL. */ + __u32 in_sync_bcl; + /** An optional sync object to wait on before starting the RCL. */ + __u32 in_sync_rcl; + /** An optional sync object to place the completion fence in. */ + __u32 out_sync; + + /* Offset of the tile alloc memory + * + * This is optional on V3D 3.3 (where the CL can set the value) but + * required on V3D 4.1. + */ + __u32 qma; + + /** Size of the tile alloc memory. */ + __u32 qms; + + /** Offset of the tile state data array. */ + __u32 qts; + + /* Pointer to a u32 array of the BOs that are referenced by the job. + */ + __u64 bo_handles; + + /* Number of BO handles passed in (size is that times 4). */ + __u32 bo_handle_count; + + /* Pad, must be zero-filled. */ + __u32 pad; +}; + +/** + * struct drm_v3d_wait_bo - ioctl argument for waiting for + * completion of the last DRM_V3D_SUBMIT_CL on a BO. + * + * This is useful for cases where multiple processes might be + * rendering to a BO and you want to wait for all rendering to be + * completed. + */ +struct drm_v3d_wait_bo { + __u32 handle; + __u32 pad; + __u64 timeout_ns; +}; + +/** + * struct drm_v3d_create_bo - ioctl argument for creating V3D BOs. + * + * There are currently no values for the flags argument, but it may be + * used in a future extension. + */ +struct drm_v3d_create_bo { + __u32 size; + __u32 flags; + /** Returned GEM handle for the BO. */ + __u32 handle; + /** + * Returned offset for the BO in the V3D address space. This offset + * is private to the DRM fd and is valid for the lifetime of the GEM + * handle. + * + * This offset value will always be nonzero, since various HW + * units treat 0 specially. + */ + __u32 offset; +}; + +/** + * struct drm_v3d_mmap_bo - ioctl argument for mapping V3D BOs. + * + * This doesn't actually perform an mmap. Instead, it returns the + * offset you need to use in an mmap on the DRM device node. This + * means that tools like valgrind end up knowing about the mapped + * memory. + * + * There are currently no values for the flags argument, but it may be + * used in a future extension. + */ +struct drm_v3d_mmap_bo { + /** Handle for the object being mapped. */ + __u32 handle; + __u32 flags; + /** offset into the drm node to use for subsequent mmap call. */ + __u64 offset; +}; + +enum drm_v3d_param { + DRM_V3D_PARAM_V3D_UIFCFG, + DRM_V3D_PARAM_V3D_HUB_IDENT1, + DRM_V3D_PARAM_V3D_HUB_IDENT2, + DRM_V3D_PARAM_V3D_HUB_IDENT3, + DRM_V3D_PARAM_V3D_CORE0_IDENT0, + DRM_V3D_PARAM_V3D_CORE0_IDENT1, + DRM_V3D_PARAM_V3D_CORE0_IDENT2, +}; + +struct drm_v3d_get_param { + __u32 param; + __u32 pad; + __u64 value; +}; + +/** + * Returns the offset for the BO in the V3D address space for this DRM fd. + * This is the same value returned by drm_v3d_create_bo, if that was called + * from this DRM fd. + */ +struct drm_v3d_get_bo_offset { + __u32 handle; + __u32 offset; +}; + +#if defined(__cplusplus) +} +#endif + +#endif /* _V3D_DRM_H_ */ From patchwork Wed Nov 14 22:28:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 10683209 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 874C617F3 for ; Wed, 14 Nov 2018 22:28:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7919829D13 for ; Wed, 14 Nov 2018 22:28:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D7E129D2A; Wed, 14 Nov 2018 22:28:49 +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 CCA7D29D15 for ; Wed, 14 Nov 2018 22:28:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2405A6E585; Wed, 14 Nov 2018 22:28:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id D05B26E585 for ; Wed, 14 Nov 2018 22:28:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 8ABB510A1311; Wed, 14 Nov 2018 14:28:46 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id GLTH3s9K9u_E; Wed, 14 Nov 2018 14:28:43 -0800 (PST) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 2ECED10A1363; Wed, 14 Nov 2018 14:28:34 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id C01D62FE3704; Wed, 14 Nov 2018 14:28:32 -0800 (PST) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Wed, 14 Nov 2018 14:28:31 -0800 Message-Id: <20181114222832.22839-3-eric@anholt.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114222832.22839-1-eric@anholt.net> References: <20181114222832.22839-1-eric@anholt.net> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 3/4] Add v3d helper library 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Just a few little ioctl wrappers that v3d tests will use. Signed-off-by: Eric Anholt Acked-by: Petri Latvala --- lib/Makefile.sources | 2 + lib/drmtest.c | 3 + lib/drmtest.h | 1 + lib/igt_v3d.c | 130 +++++++++++++++++++++++++++++++++++++++++++ lib/igt_v3d.h | 46 +++++++++++++++ lib/meson.build | 1 + 6 files changed, 183 insertions(+) create mode 100644 lib/igt_v3d.c create mode 100644 lib/igt_v3d.h diff --git a/lib/Makefile.sources b/lib/Makefile.sources index e98989ff8ed9..808b9617eca2 100644 --- a/lib/Makefile.sources +++ b/lib/Makefile.sources @@ -107,6 +107,8 @@ lib_source_list = \ igt_syncobj.h \ igt_psr.c \ igt_psr.h \ + igt_v3d.c \ + igt_v3d.h \ $(NULL) .PHONY: version.h.tmp diff --git a/lib/drmtest.c b/lib/drmtest.c index fee9d33ad2a5..d2aa1c19154f 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -202,6 +202,7 @@ static const struct module { } modules[] = { { DRIVER_AMDGPU, "amdgpu" }, { DRIVER_INTEL, "i915", modprobe_i915 }, + { DRIVER_V3D, "v3d" }, { DRIVER_VC4, "vc4" }, { DRIVER_VGEM, "vgem" }, { DRIVER_VIRTIO, "virtio-gpu" }, @@ -340,6 +341,8 @@ static const char *chipset_to_str(int chipset) switch (chipset) { case DRIVER_INTEL: return "intel"; + case DRIVER_V3D: + return "v3d"; case DRIVER_VC4: return "vc4"; case DRIVER_VGEM: diff --git a/lib/drmtest.h b/lib/drmtest.h index 949865ee54dd..96ee517e2ec1 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_V3D (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 diff --git a/lib/igt_v3d.c b/lib/igt_v3d.c new file mode 100644 index 000000000000..1a5ede1bd5fc --- /dev/null +++ b/lib/igt_v3d.c @@ -0,0 +1,130 @@ +/* + * Copyright © 2016 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "drmtest.h" +#include "igt_aux.h" +#include "igt_core.h" +#include "igt_v3d.h" +#include "ioctl_wrappers.h" +#include "intel_reg.h" +#include "intel_chipset.h" +#include "v3d_drm.h" + +#if NEW_CONTEXT_PARAM_NO_ERROR_CAPTURE_API +#define LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 +#endif + +/** + * SECTION:igt_v3d + * @short_description: V3D support library + * @title: V3D + * @include: igt.h + * + * This library provides various auxiliary helper functions for writing V3D + * tests. + */ + +struct v3d_bo * +igt_v3d_create_bo(int fd, size_t size) +{ + struct v3d_bo *bo = calloc(1, sizeof(*bo)); + + struct drm_v3d_create_bo create = { + .size = size, + }; + + do_ioctl(fd, DRM_IOCTL_V3D_CREATE_BO, &create); + + bo->handle = create.handle; + bo->offset = create.offset; + bo->size = size; + + return bo; +} + +void +igt_v3d_free_bo(int fd, struct v3d_bo *bo) +{ + if (bo->map) + munmap(bo->map, bo->size); + gem_close(fd, bo->handle); + free(bo); +} + +uint32_t +igt_v3d_get_bo_offset(int fd, uint32_t handle) +{ + struct drm_v3d_get_bo_offset get = { + .handle = handle, + }; + + do_ioctl(fd, DRM_IOCTL_V3D_GET_BO_OFFSET, &get); + + return get.offset; +} + +uint32_t +igt_v3d_get_param(int fd, enum drm_v3d_param param) +{ + struct drm_v3d_get_param get = { + .param = param, + }; + + do_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &get); + + return get.value; +} + +void * +igt_v3d_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot) +{ + struct drm_v3d_mmap_bo mmap_bo = { + .handle = handle, + }; + void *ptr; + + do_ioctl(fd, DRM_IOCTL_V3D_MMAP_BO, &mmap_bo); + + ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_bo.offset); + if (ptr == MAP_FAILED) + return NULL; + else + return ptr; +} + +void igt_v3d_bo_mmap(int fd, struct v3d_bo *bo) +{ + bo->map = igt_v3d_mmap_bo(fd, bo->handle, bo->size, + PROT_READ | PROT_WRITE); + igt_assert(bo->map); +} diff --git a/lib/igt_v3d.h b/lib/igt_v3d.h new file mode 100644 index 000000000000..bdbcb2dbc5cc --- /dev/null +++ b/lib/igt_v3d.h @@ -0,0 +1,46 @@ +/* + * Copyright © 2016 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef IGT_V3D_H +#define IGT_V3D_H + +#include "v3d_drm.h" + +struct v3d_bo *igt_v3d_create_bo(int fd, size_t size); +void igt_v3d_free_bo(int fd, struct v3d_bo *bo); + +/* IOCTL wrappers */ +uint32_t igt_v3d_get_bo_offset(int fd, uint32_t handle); +uint32_t igt_v3d_get_param(int fd, enum drm_v3d_param param); +void *igt_v3d_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot); + +void igt_v3d_bo_mmap(int fd, struct v3d_bo *bo); + +struct v3d_bo { + int handle; + uint32_t offset; + uint32_t size; + void *map; +}; + +#endif /* IGT_V3D_H */ diff --git a/lib/meson.build b/lib/meson.build index 8961ca494af8..19f5d51ceead 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -48,6 +48,7 @@ lib_sources = [ 'igt_dummyload.c', 'uwildmat/uwildmat.c', 'igt_kmod.c', + 'igt_v3d.c', 'igt_vc4.c', 'igt_psr.c', ] From patchwork Wed Nov 14 22:28:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 10683211 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 9E87613B5 for ; Wed, 14 Nov 2018 22:28:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 901EB29D13 for ; Wed, 14 Nov 2018 22:28:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81E5229D2A; Wed, 14 Nov 2018 22:28:51 +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 B45FB29D13 for ; Wed, 14 Nov 2018 22:28:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED2646E5C3; Wed, 14 Nov 2018 22:28:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id 78A976E5C3 for ; Wed, 14 Nov 2018 22:28:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 2489A10A1311; Wed, 14 Nov 2018 14:28:48 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dTGHjUfX8WIN; Wed, 14 Nov 2018 14:28:42 -0800 (PST) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 1934310A135E; Wed, 14 Nov 2018 14:28:34 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id C43362FE3705; Wed, 14 Nov 2018 14:28:32 -0800 (PST) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Wed, 14 Nov 2018 14:28:32 -0800 Message-Id: <20181114222832.22839-4-eric@anholt.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114222832.22839-1-eric@anholt.net> References: <20181114222832.22839-1-eric@anholt.net> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 4/4] igt/v3d_*: Add new tests for the V3D UABI. 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP These are basic non-rendering tests of the UABI. Signed-off-by: Eric Anholt Acked-by: Petri Latvala --- lib/igt_v3d.c | 4 -- tests/Makefile.am | 2 + tests/Makefile.sources | 6 +++ tests/meson.build | 3 ++ tests/v3d_ci/README | 26 +++++++++++++ tests/v3d_ci/v3d.testlist | 6 +++ tests/v3d_get_bo_offset.c | 78 ++++++++++++++++++++++++++++++++++++++ tests/v3d_get_param.c | 80 +++++++++++++++++++++++++++++++++++++++ tests/v3d_mmap.c | 55 +++++++++++++++++++++++++++ 9 files changed, 256 insertions(+), 4 deletions(-) create mode 100644 tests/v3d_ci/README create mode 100644 tests/v3d_ci/v3d.testlist create mode 100644 tests/v3d_get_bo_offset.c create mode 100644 tests/v3d_get_param.c create mode 100644 tests/v3d_mmap.c diff --git a/lib/igt_v3d.c b/lib/igt_v3d.c index 1a5ede1bd5fc..619c072c0e47 100644 --- a/lib/igt_v3d.c +++ b/lib/igt_v3d.c @@ -40,10 +40,6 @@ #include "intel_chipset.h" #include "v3d_drm.h" -#if NEW_CONTEXT_PARAM_NO_ERROR_CAPTURE_API -#define LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 -#endif - /** * SECTION:igt_v3d * @short_description: V3D support library diff --git a/tests/Makefile.am b/tests/Makefile.am index 3d1ce0bc1af8..a6b2ba51ea4f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,6 +14,8 @@ if BUILD_VC4 TESTS_progs += $(VC4_TESTS) endif +TESTS_progs += $(V3D_TESTS) + if HAVE_CHAMELIUM TESTS_progs += \ kms_chamelium \ diff --git a/tests/Makefile.sources b/tests/Makefile.sources index d007ebc74ab9..3ed60e7c30c7 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -15,6 +15,12 @@ VC4_TESTS = \ vc4_wait_seqno \ $(NULL) +V3D_TESTS = \ + v3d_get_bo_offset \ + v3d_get_param \ + v3d_mmap \ + $(NULL) + AMDGPU_TESTS = \ amdgpu/amd_basic \ amdgpu/amd_cs_nop \ diff --git a/tests/meson.build b/tests/meson.build index 3020f7984d7a..4472536aef65 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -85,6 +85,9 @@ test_progs = [ 'syncobj_wait', 'template', 'tools_test', + 'v3d_get_bo_offset', + 'v3d_get_param', + 'v3d_mmap', 'vc4_create_bo', 'vc4_dmabuf_poll', 'vc4_label_bo', diff --git a/tests/v3d_ci/README b/tests/v3d_ci/README new file mode 100644 index 000000000000..e03c552fb972 --- /dev/null +++ b/tests/v3d_ci/README @@ -0,0 +1,26 @@ +This directory contains test lists to be used for v3d's DRM support. The files +are passed to piglit with the --test-list parameter directly. + +The test lists are contained in the IGT repository for several +reasons: + +- The lists stay synchronized with the IGT codebase. +- Public availability. Kernel developers can see what tests are run, + and can see what changes are done to the set, when, and why. +- Explicit test lists in general make it possible to implement a new + test without having it run by everyone else before the tests and / or setup + are ready for it. + +Changing the test lists should only happen with approval from the v3d +maintainer, Eric Anholt (eric@anholt.net). + +============ +v3d.testlist +============ + +This test list is meant as a general test suite without any time +restriction for the v3d DRM driver, combining generic DRM and KMS +tests. As a reminder, you can run this with the meson build using: + +./build/runner/igt_runner --test-list tests/v3d_ci/v3d.testlist \ + build/tests -o results diff --git a/tests/v3d_ci/v3d.testlist b/tests/v3d_ci/v3d.testlist new file mode 100644 index 000000000000..b55e8e571d7d --- /dev/null +++ b/tests/v3d_ci/v3d.testlist @@ -0,0 +1,6 @@ +igt@v3d_get_bo_offset@create-get-offsets +igt@v3d_get_bo_offset@get-bad-handle +igt@v3d_get_param@base-params +igt@v3d_get_param@get-bad-param +igt@v3d_get_param@get-bad-flags +igt@v3d_mmap@mmap-bad-handle diff --git a/tests/v3d_get_bo_offset.c b/tests/v3d_get_bo_offset.c new file mode 100644 index 000000000000..0923dc85f0d0 --- /dev/null +++ b/tests/v3d_get_bo_offset.c @@ -0,0 +1,78 @@ +/* + * Copyright © 2017 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "igt.h" +#include "igt_v3d.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "v3d_drm.h" +#include "igt_v3d.h" + +igt_main +{ + int fd; + + igt_fixture + fd = drm_open_driver(DRIVER_V3D); + + igt_subtest("create-get-offsets") { + struct v3d_bo *bos[2] = { + igt_v3d_create_bo(fd, 4096), + igt_v3d_create_bo(fd, 4096), + }; + uint32_t offsets[2] = { + igt_v3d_get_bo_offset(fd, bos[0]->handle), + igt_v3d_get_bo_offset(fd, bos[1]->handle), + }; + + igt_assert_neq(bos[0]->handle, bos[1]->handle); + igt_assert_neq(bos[0]->offset, bos[1]->offset); + igt_assert_eq(bos[0]->offset, offsets[0]); + igt_assert_eq(bos[1]->offset, offsets[1]); + + /* 0 is an invalid offset for BOs to be placed at. */ + igt_assert_neq(bos[0]->offset, 0); + igt_assert_neq(bos[1]->offset, 0); + + igt_v3d_free_bo(fd, bos[0]); + igt_v3d_free_bo(fd, bos[1]); + } + + igt_subtest("get-bad-handle") { + struct drm_v3d_get_bo_offset get = { + .handle = 0xd0d0d0d0, + }; + do_ioctl_err(fd, DRM_IOCTL_V3D_GET_BO_OFFSET, &get, ENOENT); + } + + igt_fixture + close(fd); +} diff --git a/tests/v3d_get_param.c b/tests/v3d_get_param.c new file mode 100644 index 000000000000..76563406c0a1 --- /dev/null +++ b/tests/v3d_get_param.c @@ -0,0 +1,80 @@ +/* + * Copyright © 2017 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "igt.h" +#include "igt_v3d.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "v3d_drm.h" +#include "igt_v3d.h" + +igt_main +{ + int fd; + + igt_fixture + fd = drm_open_driver(DRIVER_V3D); + + igt_subtest("base-params") { + enum drm_v3d_param last_base_param = + DRM_V3D_PARAM_V3D_CORE0_IDENT2; + + uint32_t results[last_base_param]; + + for (int i = 0; i < ARRAY_SIZE(results); i++) + results[i] = igt_v3d_get_param(fd, i); + + /* HUB TVER field */ + igt_assert_lte(3, results[DRM_V3D_PARAM_V3D_HUB_IDENT1] & 0xf); + + /* CORE's ident, has VER field but also an ID. */ + igt_assert_eq(results[DRM_V3D_PARAM_V3D_CORE0_IDENT0] & 0xffffff, + 0x443356 /* "V3D" */); + } + + igt_subtest("get-bad-param") { + struct drm_v3d_get_param get = { + .param = 0xd0d0d0d0, + }; + do_ioctl_err(fd, DRM_IOCTL_V3D_GET_PARAM, &get, EINVAL); + } + + igt_subtest("get-bad-flags") { + struct drm_v3d_get_param get = { + .param = DRM_V3D_PARAM_V3D_HUB_IDENT1, + .pad = 1, + }; + do_ioctl_err(fd, DRM_IOCTL_V3D_GET_PARAM, &get, EINVAL); + } + + igt_fixture + close(fd); +} diff --git a/tests/v3d_mmap.c b/tests/v3d_mmap.c new file mode 100644 index 000000000000..a6fe7e5a7322 --- /dev/null +++ b/tests/v3d_mmap.c @@ -0,0 +1,55 @@ +/* + * Copyright © 2017 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "igt.h" +#include "igt_v3d.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "v3d_drm.h" +#include "igt_v3d.h" + +igt_main +{ + int fd; + + igt_fixture + fd = drm_open_driver(DRIVER_V3D); + + igt_subtest("mmap-bad-handle") { + struct drm_v3d_mmap_bo get = { + .handle = 0xd0d0d0d0, + }; + do_ioctl_err(fd, DRM_IOCTL_V3D_MMAP_BO, &get, ENOENT); + } + + igt_fixture + close(fd); +}