Lines 1-6
Link Here
|
1 |
- Define ETIME if missing |
1 |
- Define ETIME if missing |
2 |
|
2 |
|
3 |
--- src/intel/vulkan/anv_gem.c.orig 2017-10-23 13:21:18 UTC |
3 |
--- src/intel/vulkan/anv_gem.c.orig 2019-01-17 11:26:23 UTC |
4 |
+++ src/intel/vulkan/anv_gem.c |
4 |
+++ src/intel/vulkan/anv_gem.c |
5 |
@@ -26,6 +26,9 @@ |
5 |
@@ -26,6 +26,9 @@ |
6 |
#include <sys/mman.h> |
6 |
#include <sys/mman.h> |
Lines 12-14
Link Here
|
12 |
#include <unistd.h> |
12 |
#include <unistd.h> |
13 |
#include <fcntl.h> |
13 |
#include <fcntl.h> |
14 |
|
14 |
|
|
|
15 |
@@ -116,9 +119,19 @@ anv_gem_userptr(struct anv_device *device, void *mem, |
16 |
.flags = 0, |
17 |
}; |
18 |
|
19 |
- int ret = anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr); |
20 |
- if (ret == -1) |
21 |
+ int ret; |
22 |
+retry: |
23 |
+ ret = anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_USERPTR, &userptr); |
24 |
+ if (ret == -1) { |
25 |
+ if (errno == ENODEV && userptr.flags == 0) { |
26 |
+ userptr.flags = I915_USERPTR_UNSYNCHRONIZED; |
27 |
+ goto retry; |
28 |
+ } |
29 |
+ if (geteuid() != 0) { |
30 |
+ fprintf(stderr, "%s", "ioctl(I915_GEM_USERPTR) failed. Try running as root but expect poor stability.\n"); |
31 |
+ } |
32 |
return 0; |
33 |
+ } |
34 |
|
35 |
return userptr.handle; |
36 |
} |