Module: Mesa
Branch: master
Commit: da2d67fc3b04128f3dad08c1002b260841312420
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=da2d67fc3b04128f3dad08c1002b260841312420

Author: Lionel Landwerlin <[email protected]>
Date:   Wed Sep 25 16:26:52 2019 +0300

anv: gem-stubs: return a valid fd got anv_gem_userptr()

Fixes invalid close(-1) in the unit tests.

Signed-off-by: Lionel Landwerlin <[email protected]>
Cc: <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>

---

 src/intel/vulkan/anv_gem_stubs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_gem_stubs.c b/src/intel/vulkan/anv_gem_stubs.c
index 2c27ce26f37..bc9d7e066ba 100644
--- a/src/intel/vulkan/anv_gem_stubs.c
+++ b/src/intel/vulkan/anv_gem_stubs.c
@@ -68,7 +68,13 @@ anv_gem_munmap(void *p, uint64_t size)
 uint32_t
 anv_gem_userptr(struct anv_device *device, void *mem, size_t size)
 {
-   return -1;
+   int fd = os_create_anonymous_file(size, "fake bo");
+   if (fd == -1)
+      return 0;
+
+   assert(fd != 0);
+
+   return fd;
 }
 
 int

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to