anv: Fix handling of host_cached_coherent bos in gen9 lp in older kernels

Kernel versions without DRM_I915_QUERY_MEMORY_REGIONS support will
take a different code path in i915_gem_create() that lacks the
i915_gem_set_caching() call to make cached bos in gen9 lp 1 way
coherent.

Fixes: fc0acf6d90 ("anv: Move i915 specific gem_set_caching to backend")
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26457>
This commit is contained in:
José Roberto de Souza
2023-12-04 07:41:39 -08:00
committed by Marge Bot
parent d0c3556011
commit 0eac6298f2
+17
View File
@@ -59,6 +59,23 @@ i915_gem_create(struct anv_device *device,
if (intel_ioctl(device->fd, DRM_IOCTL_I915_GEM_CREATE, &gem_create))
return 0;
if (alloc_flags & ANV_BO_ALLOC_HOST_CACHED_COHERENT) {
/* We don't want to change these defaults if it's going to be shared
* with another process.
*/
assert(!(alloc_flags & ANV_BO_ALLOC_EXTERNAL));
/* Regular objects are created I915_CACHING_CACHED on LLC platforms and
* I915_CACHING_NONE on non-LLC platforms. For many internal state
* objects, we'd rather take the snooping overhead than risk forgetting
* a CLFLUSH somewhere. Userptr objects are always created as
* I915_CACHING_CACHED, which on non-LLC means snooped so there's no
* need to do this there.
*/
if (device->info->has_caching_uapi && !device->info->has_llc)
i915_gem_set_caching(device, gem_create.handle, I915_CACHING_CACHED);
}
*actual_size = gem_create.size;
return gem_create.handle;
}