From: Eric Engestrom Date: Wed, 15 May 2019 10:20:06 +0000 (+0100) Subject: anv: pass the fd directly to anv_gem_reg_read() X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=commitdiff_plain;h=e27f311c859652e11d5e793a7041efc50cdbb2b3 anv: pass the fd directly to anv_gem_reg_read() This allows its use without the need for an anv_device. Signed-off-by: Eric Engestrom Reviewed-by: Lionel Landwerlin Reviewed-by: Jason Ekstrand Part-of: --- diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index e3e3d755d81..8004b0fbc5b 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -4448,7 +4448,7 @@ VkResult anv_GetCalibratedTimestampsEXT( for (d = 0; d < timestampCount; d++) { switch (pTimestampInfos[d].timeDomain) { case VK_TIME_DOMAIN_DEVICE_EXT: - ret = anv_gem_reg_read(device, TIMESTAMP | 1, + ret = anv_gem_reg_read(device->fd, TIMESTAMP | 1, &pTimestamps[d]); if (ret != 0) { diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c index 30774292b15..b1c727fb5ec 100644 --- a/src/intel/vulkan/anv_gem.c +++ b/src/intel/vulkan/anv_gem.c @@ -436,13 +436,13 @@ anv_gem_fd_to_handle(struct anv_device *device, int fd) } int -anv_gem_reg_read(struct anv_device *device, uint32_t offset, uint64_t *result) +anv_gem_reg_read(int fd, uint32_t offset, uint64_t *result) { struct drm_i915_reg_read args = { .offset = offset }; - int ret = gen_ioctl(device->fd, DRM_IOCTL_I915_REG_READ, &args); + int ret = gen_ioctl(fd, DRM_IOCTL_I915_REG_READ, &args); *result = args.val; return ret; diff --git a/src/intel/vulkan/anv_gem_stubs.c b/src/intel/vulkan/anv_gem_stubs.c index aca54e64152..d232ff4e905 100644 --- a/src/intel/vulkan/anv_gem_stubs.c +++ b/src/intel/vulkan/anv_gem_stubs.c @@ -242,8 +242,7 @@ anv_gem_syncobj_wait(struct anv_device *device, } int -anv_gem_reg_read(struct anv_device *device, - uint32_t offset, uint64_t *result) +anv_gem_reg_read(int fd, uint32_t offset, uint64_t *result) { unreachable("Unused"); } diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 7e9270d62f3..3994b21b962 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1550,8 +1550,7 @@ bool anv_gem_get_bit6_swizzle(int fd, uint32_t tiling); int anv_gem_gpu_get_reset_stats(struct anv_device *device, uint32_t *active, uint32_t *pending); int anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle); -int anv_gem_reg_read(struct anv_device *device, - uint32_t offset, uint64_t *result); +int anv_gem_reg_read(int fd, uint32_t offset, uint64_t *result); uint32_t anv_gem_fd_to_handle(struct anv_device *device, int fd); int anv_gem_set_caching(struct anv_device *device, uint32_t gem_handle, uint32_t caching); int anv_gem_set_domain(struct anv_device *device, uint32_t gem_handle,