summaryrefslogtreecommitdiff
path: root/graphics/mesa-devel/files/patch-userptr
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2020-11-26 20:21:30 +0000
committerJan Beich <jbeich@FreeBSD.org>2020-11-26 20:21:30 +0000
commit058e5ba0ff29ae64383b8392f23facad616be8c9 (patch)
tree6d1455adb0d27482e94fc7f047d0ee117687ecdb /graphics/mesa-devel/files/patch-userptr
parenttextproc/bat: Update 0.16.0 -> 0.17.0 (diff)
graphics/mesa-devel: work around userptr for anv on gen < 8 and iris compute
Vulkan on Intel Broadwell or later uses softpin but older need userptr: /* We only allow 48-bit addresses with softpin because knowing the actual * address is required for the vertex cache flush workaround. */ device->supports_48bit_addresses = (device->info.gen >= 8) && device->has_softpin && device->gtt_size > (4ULL << 30 /* GiB */); device->use_softpin = device->has_softpin && device->supports_48bit_addresses; PR: 244877 Submitted by: Austin Shafer <ashafer@badland.io>
Notes
Notes: svn path=/head/; revision=556348
Diffstat (limited to '')
-rw-r--r--graphics/mesa-devel/files/patch-userptr51
1 files changed, 51 insertions, 0 deletions
diff --git a/graphics/mesa-devel/files/patch-userptr b/graphics/mesa-devel/files/patch-userptr
new file mode 100644
index 000000000000..b2f38bf0a96b
--- /dev/null
+++ b/graphics/mesa-devel/files/patch-userptr
@@ -0,0 +1,51 @@
+Try unsynchronized userptr if regular one fails.
+https://github.com/FreeBSDDesktop/kms-drm/issues/197
+
+--- src/gallium/drivers/iris/iris_bufmgr.c.orig 2020-11-25 20:08:15 UTC
++++ src/gallium/drivers/iris/iris_bufmgr.c
+@@ -624,8 +624,20 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, con
+ .user_ptr = (uintptr_t)ptr,
+ .user_size = size,
+ };
+- if (gen_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_USERPTR, &arg))
++
++ int ret;
++retry:
++ ret = gen_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_USERPTR, &arg);
++ if (ret) {
++ if (errno == ENODEV && arg.flags == 0) {
++ arg.flags = I915_USERPTR_UNSYNCHRONIZED;
++ goto retry;
++ }
++ if (geteuid() != 0) {
++ fprintf(stderr, "%s", "ioctl(I915_GEM_USERPTR) failed. Try running as root but expect poor stability.\n");
++ }
+ goto err_free;
++ }
+ bo->gem_handle = arg.handle;
+
+ /* Check the buffer for validity before we try and use it in a batch */
+--- src/intel/vulkan/anv_gem.c.orig 2020-11-25 20:08:15 UTC
+--- src/intel/vulkan/anv_gem.c
+@@ -146,9 +146,19 @@ anv_gem_userptr(struct anv_device *device, void *mem,
+ .flags = 0,
+ };
+
+- int ret = gen_ioctl(device->fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr);
+- if (ret == -1)
++ int ret;
++retry:
++ ret = gen_ioctl(device->fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr);
++ if (ret == -1) {
++ if (errno == ENODEV && userptr.flags == 0) {
++ userptr.flags = I915_USERPTR_UNSYNCHRONIZED;
++ goto retry;
++ }
++ if (geteuid() != 0) {
++ fprintf(stderr, "%s", "ioctl(I915_GEM_USERPTR) failed. Try running as root but expect poor stability.\n");
++ }
+ return 0;
++ }
+
+ return userptr.handle;
+ }