summaryrefslogtreecommitdiff
path: root/src/intel/vulkan/anv_gem.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2017-03-17 17:31:44 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2017-04-04 18:33:52 -0700
commit651ec926fc10258ddc567da44c231d5303b8740f (patch)
treeb2a09499f3c7ba382d3c38f2804aef38bc1edcc8 /src/intel/vulkan/anv_gem.c
parent439da38d184b5e9dddcfb245a2454879e7632649 (diff)
anv: Add support for 48-bit addresses
This commit adds support for using the full 48-bit address space on Broadwell and newer hardware. Thanks to certain limitations, not all objects can be placed above the 32-bit boundary. In particular, general and state base address need to live within 32 bits. (See also Wa32bitGeneralStateOffset and Wa32bitInstructionBaseOffset.) In order to handle this, we add a supports_48bit_address field to anv_bo and only set EXEC_OBJECT_SUPPORTS_48B_ADDRESS if that bit is set. We set the bit for all client-allocated memory objects but leave it false for driver-allocated objects. While this is more conservative than needed, all driver allocations should easily fit in the first 32 bits of address space and keeps things simple because we don't have to think about whether or not any given one of our allocation data structures will be used in a 48-bit-unsafe way. Reviewed-by: Kristian H. Kristensen <krh@bitplanet.net>
Diffstat (limited to 'src/intel/vulkan/anv_gem.c')
-rw-r--r--src/intel/vulkan/anv_gem.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c
index 7612f493aa..6a996ea3db 100644
--- a/src/intel/vulkan/anv_gem.c
+++ b/src/intel/vulkan/anv_gem.c
@@ -301,6 +301,24 @@ anv_gem_get_aperture(int fd, uint64_t *size)
return 0;
}
+bool
+anv_gem_supports_48b_addresses(int fd)
+{
+ struct drm_i915_gem_exec_object2 obj = {
+ .flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS,
+ };
+
+ struct drm_i915_gem_execbuffer2 execbuf = {
+ .buffers_ptr = (uintptr_t)&obj,
+ .buffer_count = 1,
+ .rsvd1 = 0xffffffu,
+ };
+
+ int ret = anv_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+
+ return ret == -1 && errno == ENOENT;
+}
+
int
anv_gem_gpu_get_reset_stats(struct anv_device *device,
uint32_t *active, uint32_t *pending)