From patchwork Mon Oct 2 23:00:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Ceraolo Spurio X-Patchwork-Id: 9981319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BBF2660375 for ; Mon, 2 Oct 2017 23:01:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF69428A17 for ; Mon, 2 Oct 2017 23:01:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A281828A12; Mon, 2 Oct 2017 23:01:02 +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=-4.2 required=2.0 tests=BAYES_00, 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 30C5F289F7 for ; Mon, 2 Oct 2017 23:01:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6C636E39B; Mon, 2 Oct 2017 23:01:01 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id DB2BA6E39B for ; Mon, 2 Oct 2017 23:01:00 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Oct 2017 16:01:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,471,1500966000"; d="scan'208"; a="1020845793" Received: from relo-linux-1.fm.intel.com ([10.1.27.112]) by orsmga003.jf.intel.com with ESMTP; 02 Oct 2017 16:01:00 -0700 From: Daniele Ceraolo Spurio To: intel-gfx@lists.freedesktop.org Date: Mon, 2 Oct 2017 16:00:18 -0700 Message-Id: <1506985218-28880-7-git-send-email-daniele.ceraolospurio@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1506985218-28880-1-git-send-email-daniele.ceraolospurio@intel.com> References: <1506985218-28880-1-git-send-email-daniele.ceraolospurio@intel.com> Subject: [Intel-gfx] [RFC i-g-t 6/6] lib/ioctl_wrappers: drop stolen memory related wrappers 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-Virus-Scanned: ClamAV using ClamSMTP The feature was never merged and there has been no progress in the last year. The wrappers are using a wrong ioctl number (38 is HAS_POOLED_EU and not CREATE_VERSION) and extensions of the gem_create and get_aperture ioctl structures that never made it into the kernel. Tests that were using the wrappers have already been removed by previous patches so it is now safe to remove the wrappers themselves. Signed-off-by: Daniele Ceraolo Spurio --- lib/ioctl_wrappers.c | 119 --------------------------------------------------- lib/ioctl_wrappers.h | 16 ------- 2 files changed, 135 deletions(-) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 51b6b7b..fdf6cc5 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -479,79 +479,6 @@ void gem_sync(int fd, uint32_t handle) errno = 0; } - -bool gem_create__has_stolen_support(int fd) -{ - static int has_stolen_support = -1; - struct drm_i915_getparam gp; - int val = -1; - - if (has_stolen_support < 0) { - memset(&gp, 0, sizeof(gp)); - gp.param = 38; /* CREATE_VERSION */ - gp.value = &val; - - /* Do we have the extended gem_create_ioctl? */ - ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); - has_stolen_support = val >= 2; - } - - return has_stolen_support; -} - -struct local_i915_gem_create_v2 { - uint64_t size; - uint32_t handle; - uint32_t pad; -#define I915_CREATE_PLACEMENT_STOLEN (1<<0) - uint32_t flags; -}; - -#define LOCAL_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct local_i915_gem_create_v2) -uint32_t __gem_create_stolen(int fd, uint64_t size) -{ - struct local_i915_gem_create_v2 create; - int ret; - - memset(&create, 0, sizeof(create)); - create.handle = 0; - create.size = size; - create.flags = I915_CREATE_PLACEMENT_STOLEN; - ret = igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create); - - if (ret < 0) - return 0; - - errno = 0; - return create.handle; -} - -/** - * gem_create_stolen: - * @fd: open i915 drm file descriptor - * @size: desired size of the buffer - * - * This wraps the new GEM_CREATE ioctl, which allocates a new gem buffer - * object of @size and placement in stolen memory region. - * - * Returns: The file-private handle of the created buffer object - */ - -uint32_t gem_create_stolen(int fd, uint64_t size) -{ - struct local_i915_gem_create_v2 create; - - memset(&create, 0, sizeof(create)); - create.handle = 0; - create.size = size; - create.flags = I915_CREATE_PLACEMENT_STOLEN; - do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create); - igt_assert(create.handle); - - return create.handle; -} - - uint32_t __gem_create(int fd, int size) { struct drm_i915_gem_create create; @@ -1378,52 +1305,6 @@ bool gem_has_bsd2(int fd) has_bsd2 = has_param(fd, LOCAL_I915_PARAM_HAS_BSD2); return has_bsd2; } - -struct local_i915_gem_get_aperture { - __u64 aper_size; - __u64 aper_available_size; - __u64 version; - __u64 map_total_size; - __u64 stolen_total_size; -}; -#define DRM_I915_GEM_GET_APERTURE 0x23 -#define LOCAL_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct local_i915_gem_get_aperture) -/** - * gem_total_mappable_size: - * @fd: open i915 drm file descriptor - * - * Feature test macro to query the kernel for the total mappable size. - * - * Returns: Total mappable address space size. - */ -uint64_t gem_total_mappable_size(int fd) -{ - struct local_i915_gem_get_aperture aperture; - - memset(&aperture, 0, sizeof(aperture)); - do_ioctl(fd, LOCAL_IOCTL_I915_GEM_GET_APERTURE, &aperture); - - return aperture.map_total_size; -} - -/** - * gem_total_stolen_size: - * @fd: open i915 drm file descriptor - * - * Feature test macro to query the kernel for the total stolen size. - * - * Returns: Total stolen memory. - */ -uint64_t gem_total_stolen_size(int fd) -{ - struct local_i915_gem_get_aperture aperture; - - memset(&aperture, 0, sizeof(aperture)); - do_ioctl(fd, LOCAL_IOCTL_I915_GEM_GET_APERTURE, &aperture); - - return aperture.stolen_total_size; -} - /** * gem_available_aperture_size: * @fd: open i915 drm file descriptor diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 090c125..008747a 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -70,9 +70,6 @@ int __gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write); void gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write); int gem_wait(int fd, uint32_t handle, int64_t *timeout_ns); void gem_sync(int fd, uint32_t handle); -bool gem_create__has_stolen_support(int fd); -uint32_t __gem_create_stolen(int fd, uint64_t size); -uint32_t gem_create_stolen(int fd, uint64_t size); uint32_t __gem_create(int fd, int size); uint32_t gem_create(int fd, uint64_t size); void gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf); @@ -97,17 +94,6 @@ void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, un int gem_munmap(void *ptr, uint64_t size); /** - * gem_require_stolen_support: - * @fd: open i915 drm file descriptor - * - * Test macro to query whether support for allocating objects from stolen - * memory is available. Automatically skips through igt_require() if not. - */ -#define gem_require_stolen_support(fd) \ - igt_require(gem_create__has_stolen_support(fd) && \ - (gem_total_stolen_size(fd) > 0)) - -/** * gem_require_mmap_wc: * @fd: open i915 drm file descriptor * @@ -171,8 +157,6 @@ int gem_gpu_reset_type(int fd); bool gem_gpu_reset_enabled(int fd); bool gem_engine_reset_enabled(int fd); int gem_available_fences(int fd); -uint64_t gem_total_mappable_size(int fd); -uint64_t gem_total_stolen_size(int fd); uint64_t gem_available_aperture_size(int fd); uint64_t gem_aperture_size(int fd); uint64_t gem_global_aperture_size(int fd);