* [PATCH] ui/gtk: making dmabuf NULL when it's released.
@ 2023-06-21 22:11 Dongwon Kim
2023-06-22 5:02 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Dongwon Kim @ 2023-06-21 22:11 UTC (permalink / raw)
To: qemu-devel
Cc: Dongwon Kim, Gerd Hoffmann, Marc-André Lureau,
Vivek Kasireddy
Set vc->gfx.guest_fb.dmabuf to NULL to prevent any further access
to it after the dmabuf is released.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
ui/gtk.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ui/gtk.c b/ui/gtk.c
index e50f950f2b..0b8bf8ea8a 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -587,8 +587,12 @@ static bool gd_has_dmabuf(DisplayChangeListener *dcl)
static void gd_gl_release_dmabuf(DisplayChangeListener *dcl,
QemuDmaBuf *dmabuf)
{
+ VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
#ifdef CONFIG_GBM
egl_dmabuf_release_texture(dmabuf);
+ if (vc->gfx.guest_fb.dmabuf == dmabuf) {
+ vc->gfx.guest_fb.dmabuf = NULL;
+ }
#endif
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ui/gtk: making dmabuf NULL when it's released.
2023-06-21 22:11 [PATCH] ui/gtk: making dmabuf NULL when it's released Dongwon Kim
@ 2023-06-22 5:02 ` Richard Henderson
2023-06-27 0:53 ` [PATCH v2] " Dongwon Kim
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2023-06-22 5:02 UTC (permalink / raw)
To: Dongwon Kim, qemu-devel
Cc: Gerd Hoffmann, Marc-André Lureau, Vivek Kasireddy
On 6/22/23 00:11, Dongwon Kim wrote:
> static void gd_gl_release_dmabuf(DisplayChangeListener *dcl,
> QemuDmaBuf *dmabuf)
> {
> + VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
> #ifdef CONFIG_GBM
> egl_dmabuf_release_texture(dmabuf);
> + if (vc->gfx.guest_fb.dmabuf == dmabuf) {
> + vc->gfx.guest_fb.dmabuf = NULL;
> + }
> #endif
> }
Conditionally unused variable outside the ifdef.
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] ui/gtk: making dmabuf NULL when it's released.
2023-06-22 5:02 ` Richard Henderson
@ 2023-06-27 0:53 ` Dongwon Kim
0 siblings, 0 replies; 3+ messages in thread
From: Dongwon Kim @ 2023-06-27 0:53 UTC (permalink / raw)
To: qemu-devel
Cc: Dongwon Kim, Gerd Hoffmann, Marc-André Lureau,
Vivek Kasireddy
Set vc->gfx.guest_fb.dmabuf to NULL to prevent any further access
to it after the dmabuf is released.
v2: move declaration of vc inside ifdef
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
ui/gtk.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ui/gtk.c b/ui/gtk.c
index e50f950f2b..2a9a0d23e6 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -588,7 +588,12 @@ static void gd_gl_release_dmabuf(DisplayChangeListener *dcl,
QemuDmaBuf *dmabuf)
{
#ifdef CONFIG_GBM
+ VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+
egl_dmabuf_release_texture(dmabuf);
+ if (vc->gfx.guest_fb.dmabuf == dmabuf) {
+ vc->gfx.guest_fb.dmabuf = NULL;
+ }
#endif
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-27 1:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-21 22:11 [PATCH] ui/gtk: making dmabuf NULL when it's released Dongwon Kim
2023-06-22 5:02 ` Richard Henderson
2023-06-27 0:53 ` [PATCH v2] " Dongwon Kim
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).