summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_gem.c
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2015-12-03 12:09:33 -0800
committerKristian Høgsberg Kristensen <[email protected]>2015-12-04 09:51:47 -0800
commitb431cf59a3f0412b7b7dd2660a793912a550bfc4 (patch)
treefe0a558d928f5a26802bb941b5d46b6c138cad68 /src/vulkan/anv_gem.c
parente0b5f0308c78ff5e6f7459a0f7d05e3fb376a104 (diff)
vk: Set I915_CACHING_NONE for userptr BOs when !llc
Regular objects are created I915_CACHING_CACHED on LLC platforms and I915_CACHING_NONE on non-LLC platforms. However, userptr objects are always created as I915_CACHING_CACHED, which on non-LLC means snooped. That can be useful but comes with a bit of overheard. Since we're eplicitly clflushing and don't want the overhead we need to turn it off.
Diffstat (limited to 'src/vulkan/anv_gem.c')
-rw-r--r--src/vulkan/anv_gem.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/vulkan/anv_gem.c b/src/vulkan/anv_gem.c
index 01671d2ea50..57b8505e156 100644
--- a/src/vulkan/anv_gem.c
+++ b/src/vulkan/anv_gem.c
@@ -137,6 +137,32 @@ anv_gem_userptr(struct anv_device *device, void *mem, size_t size)
return userptr.handle;
}
+int
+anv_gem_set_caching(struct anv_device *device, int gem_handle, uint32_t caching)
+{
+ struct drm_i915_gem_caching gem_caching;
+
+ VG_CLEAR(gem_caching);
+ gem_caching.handle = gem_handle;
+ gem_caching.caching = caching;
+
+ return anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_SET_CACHING, &gem_caching);
+}
+
+int
+anv_gem_set_domain(struct anv_device *device, int gem_handle,
+ uint32_t read_domains, uint32_t write_domain)
+{
+ struct drm_i915_gem_set_domain gem_set_domain;
+
+ VG_CLEAR(gem_set_domain);
+ gem_set_domain.handle = gem_handle;
+ gem_set_domain.read_domains = read_domains;
+ gem_set_domain.write_domain = write_domain;
+
+ return anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &gem_set_domain);
+}
+
/**
* On error, \a timeout_ns holds the remaining time.
*/