From: dongwon.kim@intel.com
To: qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, berrange@redhat.com, philmd@linaro.org
Subject: [PATCH v12 4/6] ui/console: Use qemu_dmabuf_set_..() helpers instead
Date: Wed, 24 Apr 2024 18:53:40 -0700 [thread overview]
Message-ID: <20240425015342.1033815-5-dongwon.kim@intel.com> (raw)
In-Reply-To: <20240425015342.1033815-1-dongwon.kim@intel.com>
From: Dongwon Kim <dongwon.kim@intel.com>
This commit updates all occurrences where these fields were
set directly have been updated to utilize helper functions.
v7: removed prefix, "dpy_gl_" from all helpers
v8: Introduction of helpers was removed as those were already added
by the previous commit
Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
ui/egl-helpers.c | 16 +++++++++-------
ui/gtk-egl.c | 4 ++--
ui/gtk-gl-area.c | 4 ++--
ui/gtk.c | 6 +++---
4 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 3f96e63d25..99b2ebbe23 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -348,8 +348,8 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf)
return;
}
- glGenTextures(1, &dmabuf->texture);
- texture = qemu_dmabuf_get_texture(dmabuf);
+ glGenTextures(1, &texture);
+ qemu_dmabuf_set_texture(dmabuf, texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -368,7 +368,7 @@ void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf)
}
glDeleteTextures(1, &texture);
- dmabuf->texture = 0;
+ qemu_dmabuf_set_texture(dmabuf, 0);
}
void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf)
@@ -382,7 +382,7 @@ void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf)
sync = eglCreateSyncKHR(qemu_egl_display,
EGL_SYNC_NATIVE_FENCE_ANDROID, NULL);
if (sync != EGL_NO_SYNC_KHR) {
- dmabuf->sync = sync;
+ qemu_dmabuf_set_sync(dmabuf, sync);
}
}
}
@@ -390,12 +390,14 @@ void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf)
void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf)
{
void *sync = qemu_dmabuf_get_sync(dmabuf);
+ int fence_fd;
if (sync) {
- dmabuf->fence_fd = eglDupNativeFenceFDANDROID(qemu_egl_display,
- sync);
+ fence_fd = eglDupNativeFenceFDANDROID(qemu_egl_display,
+ sync);
+ qemu_dmabuf_set_fence_fd(dmabuf, fence_fd);
eglDestroySyncKHR(qemu_egl_display, sync);
- dmabuf->sync = NULL;
+ qemu_dmabuf_set_sync(dmabuf, NULL);
}
}
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 7a45daefa1..ec0bf45482 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -87,7 +87,7 @@ void gd_egl_draw(VirtualConsole *vc)
if (!qemu_dmabuf_get_draw_submitted(dmabuf)) {
return;
} else {
- dmabuf->draw_submitted = false;
+ qemu_dmabuf_set_draw_submitted(dmabuf, false);
}
}
#endif
@@ -381,7 +381,7 @@ void gd_egl_flush(DisplayChangeListener *dcl,
if (vc->gfx.guest_fb.dmabuf &&
!qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) {
graphic_hw_gl_block(vc->gfx.dcl.con, true);
- vc->gfx.guest_fb.dmabuf->draw_submitted = true;
+ qemu_dmabuf_set_draw_submitted(vc->gfx.guest_fb.dmabuf, true);
gtk_egl_set_scanout_mode(vc, true);
gtk_widget_queue_draw_area(area, x, y, w, h);
return;
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index 2d70280803..9a3f3d0d71 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -63,7 +63,7 @@ void gd_gl_area_draw(VirtualConsole *vc)
if (!qemu_dmabuf_get_draw_submitted(dmabuf)) {
return;
} else {
- dmabuf->draw_submitted = false;
+ qemu_dmabuf_set_draw_submitted(dmabuf, false);
}
}
#endif
@@ -291,7 +291,7 @@ void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
if (vc->gfx.guest_fb.dmabuf &&
!qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) {
graphic_hw_gl_block(vc->gfx.dcl.con, true);
- vc->gfx.guest_fb.dmabuf->draw_submitted = true;
+ qemu_dmabuf_set_draw_submitted(vc->gfx.guest_fb.dmabuf, true);
gtk_gl_area_set_scanout_mode(vc, true);
}
gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area));
diff --git a/ui/gtk.c b/ui/gtk.c
index 237c913b26..3a6832eb1b 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -598,11 +598,11 @@ void gd_hw_gl_flushed(void *vcon)
QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
int fence_fd;
- if (dmabuf->fence_fd >= 0) {
- fence_fd = qemu_dmabuf_get_fence_fd(dmabuf);
+ fence_fd = qemu_dmabuf_get_fence_fd(dmabuf);
+ if (fence_fd >= 0) {
qemu_set_fd_handler(fence_fd, NULL, NULL, NULL);
close(fence_fd);
- dmabuf->fence_fd = -1;
+ qemu_dmabuf_set_fence_fd(dmabuf, -1);
graphic_hw_gl_block(vc->gfx.dcl.con, false);
}
}
--
2.34.1
next prev parent reply other threads:[~2024-04-25 1:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 1:53 [PATCH v12 0/6] ui/console: Private QemuDmaBuf struct dongwon.kim
2024-04-25 1:53 ` [PATCH v12 1/6] ui/gtk: Check if fence_fd is equal to or greater than 0 dongwon.kim
2024-04-25 1:53 ` [PATCH v12 2/6] ui/console: new dmabuf.h and dmabuf.c for QemuDmaBuf struct and helpers dongwon.kim
2024-05-07 13:29 ` Marc-André Lureau
2024-04-25 1:53 ` [PATCH v12 3/6] ui/console: Use qemu_dmabuf_get_..() helpers instead dongwon.kim
2024-04-25 1:53 ` dongwon.kim [this message]
2024-05-07 13:30 ` [PATCH v12 4/6] ui/console: Use qemu_dmabuf_set_..() " Marc-André Lureau
2024-04-25 1:53 ` [PATCH v12 5/6] ui/console: Use qemu_dmabuf_new() and free() " dongwon.kim
2024-05-07 13:36 ` Marc-André Lureau
2024-04-25 1:53 ` [PATCH v12 6/6] ui/console: move QemuDmaBuf struct def to dmabuf.c dongwon.kim
2024-05-07 13:37 ` Marc-André Lureau
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=20240425015342.1033815-5-dongwon.kim@intel.com \
--to=dongwon.kim@intel.com \
--cc=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=philmd@linaro.org \
--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 read-only IMAP folder(s) and NNTP newsgroup(s).