Bug 1667927 - Do not close file descriptor of android::Fence if EGLSync is created r=jnicol

When EGLSync is created from fence file descriptor, gecko should not close it. It should be closed by gecko only when EGLSync creation is failed.

Differential Revision: https://phabricator.services.mozilla.com/D91702
This commit is contained in:
sotaro
2020-09-29 07:32:14 +00:00
parent 12cf33f58a
commit f095b75999
2 changed files with 6 additions and 0 deletions

View File

@@ -868,6 +868,9 @@ bool AndroidHardwareBufferTextureHost::Lock() {
EGLSync sync = EGLSync sync =
egl->fCreateSync(LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID, attribs); egl->fCreateSync(LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID, attribs);
if (sync) { if (sync) {
// Release fd here, since it is owned by EGLSync
Unused << rawFD.release();
egl->fClientWaitSync(sync, 0, LOCAL_EGL_FOREVER); egl->fClientWaitSync(sync, 0, LOCAL_EGL_FOREVER);
egl->fDestroySync(sync); egl->fDestroySync(sync);
} else { } else {

View File

@@ -66,6 +66,9 @@ bool RenderAndroidHardwareBufferTextureHost::EnsureLockable(
EGLSync sync = EGLSync sync =
egl->fCreateSync(LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID, attribs); egl->fCreateSync(LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID, attribs);
if (sync) { if (sync) {
// Release fd here, since it is owned by EGLSync
Unused << rawFD.release();
// XXX use eglWaitSyncKHR() if possible. See Bug 1661371. // XXX use eglWaitSyncKHR() if possible. See Bug 1661371.
egl->fClientWaitSync(sync, 0, LOCAL_EGL_FOREVER); egl->fClientWaitSync(sync, 0, LOCAL_EGL_FOREVER);
egl->fDestroySync(sync); egl->fDestroySync(sync);