From da2d67fc3b04128f3dad08c1002b260841312420 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Wed, 25 Sep 2019 16:26:52 +0300 Subject: [PATCH] anv: gem-stubs: return a valid fd got anv_gem_userptr() Fixes invalid close(-1) in the unit tests. Signed-off-by: Lionel Landwerlin Cc: Reviewed-by: Jason Ekstrand --- 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 -- 2.30.2