Le 05/11/2021 à 12:30, Gerd Hoffmann a écrit :
From: Dongwon Kim <dongwon....@intel.com>
If guest fb is backed by dmabuf (blob-resource), the texture bound to the
old context needs to be recreated in case the egl is re-initialized (e.g.
new window for vc is created in case of detaching/reattaching of the tab)
v2: call egl_dmabuf_release_texutre instead of putting 0 to dmabuf->texture
(Vivek Kasireddy)
Cc: Gerd Hoffmann <kra...@redhat.com>
Signed-off-by: Dongwon Kim <dongwon....@intel.com>
Message-Id: <20211104065153.28897-3-dongwon....@intel.com>
Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
ui/gtk-egl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 21649950983f..f2026e4b5c9b 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -155,6 +155,10 @@ void gd_egl_refresh(DisplayChangeListener *dcl)
surface_gl_destroy_texture(vc->gfx.gls, vc->gfx.ds);
surface_gl_create_texture(vc->gfx.gls, vc->gfx.ds);
}
+ if (vc->gfx.guest_fb.dmabuf) {
+ egl_dmabuf_release_texture(vc->gfx.guest_fb.dmabuf);
+ gd_egl_scanout_dmabuf(dcl, vc->gfx.guest_fb.dmabuf);
+ }
}
graphic_hw_update(dcl->con);
This patch breaks something:
$ .../configure' '--target-list=m68k-softmmu' '--enable-virglrenderer'
$ make
...
FAILED: libcommon.fa.p/ui_gtk-egl.c.o
cc -m64 -mcx16 -Ilibcommon.fa.p -I../../../Projects/qemu-next/capstone/include/capstone
-I../../../Projects/qemu-next/dtc/libfdt -I../../../Projects/qemu-next/slirp
-I../../../Projects/qemu-next/slirp/src -I/usr/include/pixman-1 -I/usr/include/libpng16
-I/usr/include/p11-kit-1 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/include/sysprof-4 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0
-I/usr/include/virgl -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz
-I/usr/include/freetype2 -I/usr/include/fribidi -I/usr/include/libxml2 -I/usr/include/cairo
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include
-I/usr/include/at-spi-2.0 -I/usr/include/vte-2.91 -fdiagnostics-color=auto -Wall -Winvalid-pch
-Werror -std=gnu11 -O2 -g -isystem /home/laurent/Projects/qemu-next/linux-headers -isystem
linux-headers -iquote . -iquote /home/laurent/Projects/qemu-next -iquote
/home/laurent/Projects/qemu-next/include -iquote /home/laurent/Projects/qemu-next/disas/libvixl
-iquote /home/laurent/Projects/qemu-next/tcg/i386 -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv
-Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k
-Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined
-Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi
-fstack-protector-strong -fPIE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNCURSES_WIDECHAR -D_REENTRANT
-MD -MQ libcommon.fa.p/ui_gtk-egl.c.o -MF libcommon.fa.p/ui_gtk-egl.c.o.d -o
libcommon.fa.p/ui_gtk-egl.c.o -c ../../../Projects/qemu-next/ui/gtk-egl.c
../../../Projects/qemu-next/ui/gtk-egl.c: In function 'gd_egl_refresh':
../../../Projects/qemu-next/ui/gtk-egl.c:159:13: error: implicit declaration of function
'egl_dmabuf_release_texture' [-Werror=implicit-function-declaration]
159 | egl_dmabuf_release_texture(vc->gfx.guest_fb.dmabuf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
../../../Projects/qemu-next/ui/gtk-egl.c:159:13: error: nested extern declaration of
'egl_dmabuf_release_texture' [-Werror=nested-externs]
I think we need something like:
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index f2026e4b5c9b..45cb67712df0 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -155,10 +155,12 @@ void gd_egl_refresh(DisplayChangeListener *dcl)
surface_gl_destroy_texture(vc->gfx.gls, vc->gfx.ds);
surface_gl_create_texture(vc->gfx.gls, vc->gfx.ds);
}
+#ifdef CONFIG_GBM
if (vc->gfx.guest_fb.dmabuf) {
egl_dmabuf_release_texture(vc->gfx.guest_fb.dmabuf);
gd_egl_scanout_dmabuf(dcl, vc->gfx.guest_fb.dmabuf);
}
+#endif
}
graphic_hw_update(dcl->con);
Thanks,
Laurent