From patchwork Thu Oct 12 22:29:09 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: 10003035 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 3C6666028A for ; Thu, 12 Oct 2017 22:30:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B05E28F1C for ; Thu, 12 Oct 2017 22:30:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E48728F0E; Thu, 12 Oct 2017 22:30:10 +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 6FBC828F19 for ; Thu, 12 Oct 2017 22:30:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 779136E9B1; Thu, 12 Oct 2017 22:30:08 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E0596E048 for ; Thu, 12 Oct 2017 22:30:07 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Oct 2017 15:30:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.43,368,1503385200"; d="scan'208"; a="1205262318" Received: from relo-linux-1.fm.intel.com ([10.1.27.112]) by fmsmga001.fm.intel.com with ESMTP; 12 Oct 2017 15:29:36 -0700 From: Daniele Ceraolo Spurio To: intel-gfx@lists.freedesktop.org Date: Thu, 12 Oct 2017 15:29:09 -0700 Message-Id: <1507847349-3450-7-git-send-email-daniele.ceraolospurio@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507847349-3450-1-git-send-email-daniele.ceraolospurio@intel.com> References: <1507847349-3450-1-git-send-email-daniele.ceraolospurio@intel.com> Subject: [Intel-gfx] [PATCH i-g-t v2 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 | 117 --------------------------------------------------- lib/ioctl_wrappers.h | 16 ------- 2 files changed, 133 deletions(-) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 87511fc..92dad0f 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -479,78 +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; -} - int __gem_create(int fd, uint64_t size, uint32_t *handle) { struct drm_i915_gem_create create = { @@ -1373,51 +1301,6 @@ bool gem_has_bsd2(int fd) 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 1663b7f..49bc1e2 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); int __gem_create(int fd, uint64_t size, uint32_t *handle); 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);