[Mesa-dev] [PATCH] i965: Solve Android native fence fd double close issue

Randy Xu randy.xu at intel.com
Tue Apr 18 06:27:10 UTC 2017


The Android native fence in i965 driver has two fd, one is from
App and stored in _EGLSync.SyncFd; Another one brw_fence->sync_fd
should be the dup of the first one, not direct copy.
These two fds are closed in dri2_egl_unref_sync in sequence.

Test: Run Vulkan and GLES stress test and no crash.

Signed-off-by: Randy Xu <randy.xu at intel.com>
---
 src/mesa/drivers/dri/i965/brw_sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sync.c b/src/mesa/drivers/dri/i965/brw_sync.c
index 5b78503..a8356c3 100644
--- a/src/mesa/drivers/dri/i965/brw_sync.c
+++ b/src/mesa/drivers/dri/i965/brw_sync.c
@@ -470,7 +470,7 @@ brw_dri_create_fence_fd(__DRIcontext *dri_ctx, int fd)
          goto fail;
    } else {
       /* Import the sync fd as an in-fence. */
-      fence->sync_fd = fd;
+      fence->sync_fd = dup(fd);
    }
 
    assert(fence->sync_fd != -1);
-- 
2.7.4



More information about the mesa-dev mailing list