From: Vivek Kasireddy <vivek.kasireddy@intel.com>
To: qemu-devel@nongnu.org
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH v3 2/5] ui/egl: Add egl helpers to help with synchronization
Date: Mon, 21 Jun 2021 12:24:22 -0700 [thread overview]
Message-ID: <20210621192425.1188442-3-vivek.kasireddy@intel.com> (raw)
In-Reply-To: <20210621192425.1188442-1-vivek.kasireddy@intel.com>
These egl helpers would be used for creating and waiting on
a sync object.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
include/ui/console.h | 2 ++
include/ui/egl-helpers.h | 2 ++
ui/egl-helpers.c | 26 ++++++++++++++++++++++++++
3 files changed, 30 insertions(+)
diff --git a/include/ui/console.h b/include/ui/console.h
index b30b63976a..49978fdae3 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -168,6 +168,8 @@ typedef struct QemuDmaBuf {
uint64_t modifier;
uint32_t texture;
bool y0_top;
+ void *sync;
+ int fence_fd;
} QemuDmaBuf;
typedef struct DisplayState DisplayState;
diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h
index f1bf8f97fc..2c3ba92b53 100644
--- a/include/ui/egl-helpers.h
+++ b/include/ui/egl-helpers.h
@@ -45,6 +45,8 @@ int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc,
void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf);
void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf);
+void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf);
+void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf);
#endif
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 6d0cb2b5cb..6fa3f2ec45 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -76,6 +76,32 @@ void egl_fb_setup_for_tex(egl_fb *fb, int width, int height,
GL_TEXTURE_2D, fb->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;
+ }
+}
+
void egl_fb_setup_new_tex(egl_fb *fb, int width, int height)
{
GLuint texture;
--
2.30.2
next prev parent reply other threads:[~2021-06-21 19:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 19:24 [PATCH v3 0/5] virtio-gpu: Add a default synchronization mechanism for blobs Vivek Kasireddy
2021-06-21 19:24 ` [PATCH v3 1/5] ui/gtk: Create a common release_dmabuf helper Vivek Kasireddy
2021-06-21 19:24 ` Vivek Kasireddy [this message]
2021-06-23 8:17 ` [PATCH v3 2/5] ui/egl: Add egl helpers to help with synchronization Gerd Hoffmann
2021-06-21 19:24 ` [PATCH v3 3/5] ui: Create sync objects and fences only for blobs Vivek Kasireddy
2021-06-23 8:15 ` Gerd Hoffmann
2021-06-23 19:11 ` Kasireddy, Vivek
2021-06-24 8:39 ` Gerd Hoffmann
2021-06-24 18:34 ` Kasireddy, Vivek
2021-06-21 19:24 ` [PATCH v3 4/5] ui/gtk-egl: Wait for the draw signal for dmabuf blobs Vivek Kasireddy
2021-06-23 8:17 ` Gerd Hoffmann
2021-06-21 19:24 ` [PATCH v3 5/5] virtio-gpu: Add gl_flushed callback Vivek Kasireddy
2021-06-23 8:18 ` Gerd Hoffmann
2021-06-21 19:48 ` [PATCH v3 0/5] virtio-gpu: Add a default synchronization mechanism for blobs no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210621192425.1188442-3-vivek.kasireddy@intel.com \
--to=vivek.kasireddy@intel.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).