From 71c28ddda2d7dd409cf0088249b4be46ad1da241 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Fri, 22 Sep 2017 05:01:10 +0000 Subject: [PATCH] graphics/mesa-dri: anv hacks for drm-next --- .../files/patch-src_intel_vulkan_anv__gem.c | 21 +++++++++++++++++++++ .../files/patch-src_intel_vulkan_anv__queue.c | 10 ++++++++++ 2 files changed, 31 insertions(+) diff --git a/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c index 82a56ce065d4..2b3f5f0910d1 100644 --- a/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c +++ b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__gem.c @@ -1,4 +1,6 @@ - Define ETIME if missing +- Try harder to allocate userptr, see + https://github.com/FreeBSDDesktop/freebsd-base-graphics/issues/132 --- src/intel/vulkan/anv_gem.c.orig 2017-10-23 13:21:18 UTC +++ src/intel/vulkan/anv_gem.c @@ -12,3 +14,22 @@ #include #include +@@ -114,9 +114,16 @@ anv_gem_userptr(struct anv_device *device, void *mem, + .flags = 0, + }; + +- int ret = anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr); +- if (ret == -1) ++ int ret; ++retry: ++ ret = anv_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; ++ } + return 0; ++ } + + return userptr.handle; + } diff --git a/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c index 92cabb2375f0..7e80981e9285 100644 --- a/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c +++ b/graphics/mesa-dri/files/patch-src_intel_vulkan_anv__queue.c @@ -1,5 +1,6 @@ - Define ETIME if missing - Drop header that was never used +- Work around early timeouts with I915_USERPTR_UNSYNCHRONIZED --- src/intel/vulkan/anv_queue.c.orig 2017-10-23 13:21:18 UTC +++ src/intel/vulkan/anv_queue.c @@ -16,3 +17,12 @@ #include "anv_private.h" #include "vk_util.h" +@@ -102,7 +102,7 @@ anv_device_submit_simple_batch(struct anv_device *devi + if (result != VK_SUCCESS) + goto fail; + +- result = anv_device_wait(device, &bo, INT64_MAX); ++ result = anv_device_wait(device, &bo, INT32_MAX); + + fail: + anv_bo_pool_free(&device->batch_bo_pool, &bo);