diff options
author | Vivek Kasireddy <vivek.kasireddy@intel.com> | 2021-09-14 14:18:34 -0700 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2021-09-15 08:41:59 +0200 |
commit | 121abaf3e68d620f7c4c1d16875de4a4b92fa8f8 (patch) | |
tree | 3259d6a1574c5ae474f1b379aa86b69ecfcb6ae1 /ui | |
parent | 89faed62af70283d5b6d38a58a1cf40535242c51 (diff) | |
download | qemu-121abaf3e68d620f7c4c1d16875de4a4b92fa8f8.zip qemu-121abaf3e68d620f7c4c1d16875de4a4b92fa8f8.tar.gz qemu-121abaf3e68d620f7c4c1d16875de4a4b92fa8f8.tar.bz2 |
ui/egl: Add egl helpers to help with synchronization
These egl helpers would be used for creating and waiting on
a sync object.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Message-Id: <20210914211837.3229977-3-vivek.kasireddy@intel.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/egl-helpers.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 6d0cb2b..385a3fa 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -287,6 +287,32 @@ void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf) dmabuf->texture = 0; } +void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf) +{ + EGLSyncKHR sync; + + if (epoxy_has_egl_extension(qemu_egl_display, + "EGL_KHR_fence_sync") && + epoxy_has_egl_extension(qemu_egl_display, + "EGL_ANDROID_native_fence_sync")) { + sync = eglCreateSyncKHR(qemu_egl_display, + EGL_SYNC_NATIVE_FENCE_ANDROID, NULL); + if (sync != EGL_NO_SYNC_KHR) { + dmabuf->sync = sync; + } + } +} + +void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf) +{ + if (dmabuf->sync) { + dmabuf->fence_fd = eglDupNativeFenceFDANDROID(qemu_egl_display, + dmabuf->sync); + eglDestroySyncKHR(qemu_egl_display, dmabuf->sync); + dmabuf->sync = NULL; + } +} + #endif /* CONFIG_GBM */ /* ---------------------------------------------------------------------- */ |