On Fri, Jul 08, 2016 at 05:00:58PM -0700, Chad Versace wrote: > 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. > + */
My suspicion is that you want to dup() on the boundaries so that both parties have a unique fd that they own, and can reference count / close independently. (The only challenge would language in the spec that implied that FENCE_FROM_FD steals the fd, for example.) -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev