iris: Fail BO allocation if we can't enable snooping properly.

If the caller has asked for a coherent BO with snooping, and the kernel
fails to set it for whatever reason, we were happily returning them a
non-coherent buffer.  This isn't what they wanted and could lead to
surprising results.

Better to simply fail the allocation.  Probably.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11644>
This commit is contained in:
Kenneth Graunke
2021-06-28 11:38:08 -07:00
committed by Marge Bot
parent 803a2a9b3d
commit a313bd7845
+5 -4
View File
@@ -673,10 +673,11 @@ iris_bo_alloc(struct iris_bufmgr *bufmgr,
.handle = bo->gem_handle,
.caching = 1,
};
if (intel_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_SET_CACHING, &arg) == 0) {
bo->cache_coherent = true;
bo->reusable = false;
}
if (intel_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_SET_CACHING, &arg) != 0)
goto err_free;
bo->cache_coherent = true;
bo->reusable = false;
}
DBG("bo_create: buf %d (%s) (%s memzone) (%s) %llub\n", bo->gem_handle,