[Mesa-dev] [PATCH 08/13] todo! egl/dri2: Questions about sync fd ownership
Chad Versace
chad.versace at intel.com
Sat Jul 9 00:00:58 UTC 2016
See the comments.
---
src/egl/drivers/dri2/egl_dri2.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index c7b81ce..03ed4b9 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2412,6 +2412,18 @@ dri2_egl_unref_sync(struct dri2_egl_display *dri2_dpy,
cnd_destroy(&dri2_sync->cond);
break;
case EGL_SYNC_NATIVE_FENCE_ANDROID:
+ /* TODO(chadv): We must take care to not double-close nor leak the
+ * fd. To avoid double-close and leak, we need to carefully document
+ * fd ownership and duplication rules.
+ *
+ * TODO(chadv): Document the decision at _EGLSync::SyncFd,
+ *
+ * FIXME(chadv): Potential bug. If we define that EGL (not the
+ * driver) owns the fence fd created by the flush after
+ * eglCreateSync(), we need to ensure the fd doesn't leak. Today, it
+ * leaks if the user never calls eglDupNativeFenceFDANDROID() because
+ * _EGLSync::SyncFd remains -1 forever.
+ */
if (dri2_sync->base.SyncFd != EGL_NO_NATIVE_FENCE_FD_ANDROID)
close(dri2_sync->base.SyncFd);
break;
--
2.9.0.rc2
More information about the mesa-dev
mailing list