Mesa (staging/19.2): anv: gem-stubs: return a valid fd got anv_gem_userptr()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 26 15:48:26 UTC 2019


Module: Mesa
Branch: staging/19.2
Commit: 6273d4d4ed7a5bfb67b06b78b519ccecfab32eb5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6273d4d4ed7a5bfb67b06b78b519ccecfab32eb5

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
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 <lionel.g.landwerlin at intel.com>
Cc: <mesa-stable at lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
(cherry picked from commit da2d67fc3b04128f3dad08c1002b260841312420)

---

 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




More information about the mesa-commit mailing list