From patchwork Tue Oct 13 15:16:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Morton X-Patchwork-Id: 7386161 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A4140BEEA4 for ; Tue, 13 Oct 2015 15:17:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63FD220673 for ; Tue, 13 Oct 2015 15:17:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1C9832065A for ; Tue, 13 Oct 2015 15:17:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A37406E3DB; Tue, 13 Oct 2015 08:17:06 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 94F916E3DB for ; Tue, 13 Oct 2015 08:17:05 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 13 Oct 2015 08:16:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,678,1437462000"; d="scan'208";a="810013131" Received: from djmorton-linux2.isw.intel.com ([10.102.226.90]) by fmsmga001.fm.intel.com with ESMTP; 13 Oct 2015 08:16:25 -0700 From: Derek Morton To: intel-gfx@lists.freedesktop.org Date: Tue, 13 Oct 2015 16:16:18 +0100 Message-Id: <1444749378-27655-1-git-send-email-derek.j.morton@intel.com> X-Mailer: git-send-email 1.9.1 Cc: thomas.wood@intel.com Subject: [Intel-gfx] [PATCH i-g-t] core_prop_blob ioctl_wrappers: Fix new tests/benchmarks for android X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Changes since #1b492e311 have broken the Android build. This patch fixes the build for Android. core_prop_blob was using ioctls not in the android kernel. Added a igt_require_propblob() function and local defines/structures so the test will compile and skip on kernels where the feature is unsupported. gem_blt - included igt.h Signed-off-by: Derek Morton --- benchmarks/gem_blt.c | 4 +--- lib/ioctl_wrappers.c | 13 +++++++++++++ lib/ioctl_wrappers.h | 22 ++++++++++++++++++++++ tests/core_prop_blob.c | 37 ++++++++++++++++++------------------- 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/benchmarks/gem_blt.c b/benchmarks/gem_blt.c index 181a5f1..8ab5302 100644 --- a/benchmarks/gem_blt.c +++ b/benchmarks/gem_blt.c @@ -25,6 +25,7 @@ * */ +#include "igt.h" #include #include #include @@ -39,9 +40,6 @@ #include #include "drm.h" -#include "ioctl_wrappers.h" -#include "drmtest.h" -#include "intel_chipset.h" #define LOCAL_I915_EXEC_NO_RELOC (1<<11) #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 80e1ec6..cf34f25 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1219,6 +1219,19 @@ void igt_require_fb_modifiers(int fd) igt_require(has_modifiers); } +void igt_require_propblob(int fd) +{ + struct local_drm_mode_create_blob c; + struct local_drm_mode_destroy_blob d; + uint32_t blob_data; + c.data = &blob_data; + c.length = sizeof(blob_data); + + igt_require(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB, &c) == 0); + d.blob_id = c.blob_id; + igt_require(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB, &d) == 0); +} + int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height, uint32_t stride, uint32_t pixel_format, uint64_t modifier, uint32_t flags, uint32_t *buf_id) diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index f4deca6..aeb224c 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -149,6 +149,20 @@ struct local_drm_mode_fb_cmd2 { uint64_t modifier[4]; }; +struct local_drm_mode_get_blob { + uint32_t blob_id; + uint32_t length; + uint64_t data; +}; +struct local_drm_mode_create_blob { + uint64_t data; + uint32_t length; + uint32_t blob_id; +}; +struct local_drm_mode_destroy_blob { + uint32_t blob_id; +}; + #define LOCAL_DRM_MODE_FB_MODIFIERS (1<<1) #define LOCAL_DRM_FORMAT_MOD_VENDOR_INTEL 0x01 @@ -165,9 +179,17 @@ struct local_drm_mode_fb_cmd2 { #define LOCAL_DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, \ struct local_drm_mode_fb_cmd2) +#define LOCAL_DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, \ + struct local_drm_mode_get_blob) +#define LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, \ + struct local_drm_mode_create_blob) +#define LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, \ + struct local_drm_mode_destroy_blob) + #define LOCAL_DRM_CAP_ADDFB2_MODIFIERS 0x10 void igt_require_fb_modifiers(int fd); +void igt_require_propblob(int fd); /** * __kms_addfb: diff --git a/tests/core_prop_blob.c b/tests/core_prop_blob.c index d704158..ff56482 100644 --- a/tests/core_prop_blob.c +++ b/tests/core_prop_blob.c @@ -25,16 +25,12 @@ * Daniel Stone */ +#include "igt.h" #include #include #include #include -#include "drmtest.h" -#include "igt_debugfs.h" -#include "igt_kms.h" -#include "igt_aux.h" - IGT_TEST_DESCRIPTION("Tests behaviour of mass-data 'blob' properties."); static const struct drm_mode_modeinfo test_mode_valid = { @@ -64,19 +60,19 @@ static const struct drm_mode_modeinfo test_mode_valid = { static int validate_prop(int fd, uint32_t prop_id) { - struct drm_mode_get_blob get; + struct local_drm_mode_get_blob get; struct drm_mode_modeinfo ret_mode; get.blob_id = prop_id; get.length = 0; get.data = (uintptr_t) 0; - ioctl_or_ret_errno(fd, DRM_IOCTL_MODE_GETPROPBLOB, &get); + ioctl_or_ret_errno(fd, LOCAL_DRM_IOCTL_MODE_GETPROPBLOB, &get); if (get.length != sizeof(test_mode_valid)) return ENOMEM; get.data = (uintptr_t) &ret_mode; - ioctl_or_ret_errno(fd, DRM_IOCTL_MODE_GETPROPBLOB, &get); + ioctl_or_ret_errno(fd, LOCAL_DRM_IOCTL_MODE_GETPROPBLOB, &get); if (memcmp(&ret_mode, &test_mode_valid, sizeof(test_mode_valid)) != 0) return EINVAL; @@ -87,12 +83,12 @@ validate_prop(int fd, uint32_t prop_id) static uint32_t create_prop(int fd) { - struct drm_mode_create_blob create; + struct local_drm_mode_create_blob create; create.length = sizeof(test_mode_valid); create.data = (uintptr_t) &test_mode_valid; - do_ioctl(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create); + do_ioctl(fd, LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB, &create); igt_assert_neq_u32(create.blob_id, 0); return create.blob_id; @@ -101,10 +97,10 @@ create_prop(int fd) static int destroy_prop(int fd, uint32_t prop_id) { - struct drm_mode_destroy_blob destroy; + struct local_drm_mode_destroy_blob destroy; destroy.blob_id = prop_id; - ioctl_or_ret_errno(fd, DRM_IOCTL_MODE_DESTROYPROPBLOB, &destroy); + ioctl_or_ret_errno(fd, LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB, &destroy); return 0; } @@ -112,8 +108,8 @@ destroy_prop(int fd, uint32_t prop_id) static void test_validate(int fd) { - struct drm_mode_create_blob create; - struct drm_mode_get_blob get; + struct local_drm_mode_create_blob create; + struct local_drm_mode_get_blob get; char too_small[32]; uint32_t prop_id; @@ -122,24 +118,24 @@ test_validate(int fd) /* Outlandish size. */ create.length = 0x10000; create.data = (uintptr_t) &too_small; - do_ioctl_err(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create, EFAULT); + do_ioctl_err(fd, LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB, &create, EFAULT); /* Outlandish address. */ create.length = sizeof(test_mode_valid); create.data = (uintptr_t) 0xdeadbeee; - do_ioctl_err(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create, EFAULT); + do_ioctl_err(fd, LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB, &create, EFAULT); /* When we pass an incorrect size, the kernel should correct us. */ prop_id = create_prop(fd); get.blob_id = prop_id; get.length = sizeof(too_small); get.data = (uintptr_t) too_small; - do_ioctl(fd, DRM_IOCTL_MODE_GETPROPBLOB, &get); + do_ioctl(fd, LOCAL_DRM_IOCTL_MODE_GETPROPBLOB, &get); igt_assert_eq_u32(get.length, sizeof(test_mode_valid)); get.blob_id = prop_id; get.data = (uintptr_t) 0xdeadbeee; - do_ioctl_err(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, &create, EFAULT); + do_ioctl_err(fd, LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB, &create, EFAULT); } static void @@ -211,9 +207,12 @@ igt_main igt_fixture { fd = drm_open_driver(DRIVER_ANY); igt_require(fd >= 0); - test_basic(fd); + igt_require_propblob(fd); } + igt_subtest("basic") + test_basic(fd); + igt_subtest("blob-prop-core") test_core(fd);