[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/12] ui: do not create a surface when resizing a GL scanout
From: |
marcandre . lureau |
Subject: |
[PATCH v2 03/12] ui: do not create a surface when resizing a GL scanout |
Date: |
Thu, 17 Feb 2022 15:58:20 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
qemu_console_resize() will create a blank surface and replace the
current scanout with it if called while the current scanout is
GL (texture or dmabuf).
This is not only very costly, but also can produce glitches on the
display/listener side.
Instead, compare the current console size with the fitting console
functions, which also works when the scanout is GL.
Note: there might be still an unnecessary surface creation on calling
qemu_console_resize() when the size is actually changing, but display
backends currently rely on DisplaySurface details during
dpy_gfx_switch() to handle various resize aspects. We would need more
refactoring to handle resize without DisplaySurface, this is left for a
future improvement.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
ui/console.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index 79a01afd1ea7..365a2c14b809 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2400,13 +2400,12 @@ static void vc_chr_open(Chardev *chr,
void qemu_console_resize(QemuConsole *s, int width, int height)
{
- DisplaySurface *surface = qemu_console_surface(s);
+ DisplaySurface *surface;
assert(s->console_type == GRAPHIC_CONSOLE);
- if (surface && (surface->flags & QEMU_ALLOCATED_FLAG) &&
- pixman_image_get_width(surface->image) == width &&
- pixman_image_get_height(surface->image) == height) {
+ if (qemu_console_get_width(s, -1) == width &&
+ qemu_console_get_height(s, -1) == height) {
return;
}
--
2.34.1.428.gdcc0cd074f0c
- [PATCH v2 00/12] GL & D-Bus display related fixes, marcandre . lureau, 2022/02/17
- [PATCH v2 01/12] ui/console: fix crash when using gl context with non-gl listeners, marcandre . lureau, 2022/02/17
- [PATCH v2 02/12] ui/console: fix texture leak when calling surface_gl_create_texture(), marcandre . lureau, 2022/02/17
- [PATCH v2 03/12] ui: do not create a surface when resizing a GL scanout,
marcandre . lureau <=
- [PATCH v2 04/12] ui/console: move check for compatible GL context, marcandre . lureau, 2022/02/17
- [PATCH v2 05/12] ui/console: move dcl compatiblity check to a callback, marcandre . lureau, 2022/02/17
- [PATCH v2 06/12] ui/console: egl-headless is compatible with non-gl listeners, marcandre . lureau, 2022/02/17
- [PATCH v2 07/12] ui/dbus: associate the DBusDisplayConsole listener with the given console, marcandre . lureau, 2022/02/17
- [PATCH v2 08/12] ui/console: move console compatibility check to dcl_display_console(), marcandre . lureau, 2022/02/17
- [PATCH v2 09/12] ui/shader: fix potential leak of shader on error, marcandre . lureau, 2022/02/17
- [PATCH v2 10/12] ui/shader: free associated programs, marcandre . lureau, 2022/02/17
- [PATCH v2 11/12] ui/console: add a dpy_gfx_switch callback helper, marcandre . lureau, 2022/02/17
- [PATCH v2 12/12] ui/dbus: fix texture sharing, marcandre . lureau, 2022/02/17