[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 08/12] ui/console: add a dpy_gfx_switch callback helper
From: |
marcandre . lureau |
Subject: |
[PULL v2 08/12] ui/console: add a dpy_gfx_switch callback helper |
Date: |
Tue, 15 Mar 2022 15:07:35 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Slight code improvement.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/console.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index d3ecbb215736..102fcf0a5068 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1058,6 +1058,15 @@ static void console_putchar(QemuConsole *s, int ch)
}
}
+static void displaychangelistener_gfx_switch(DisplayChangeListener *dcl,
+ struct DisplaySurface
*new_surface)
+{
+ if (dcl->ops->dpy_gfx_switch) {
+ dcl->ops->dpy_gfx_switch(dcl, new_surface);
+ }
+}
+
+
static void displaychangelistener_display_console(DisplayChangeListener *dcl,
QemuConsole *con,
Error **errp)
@@ -1067,13 +1076,10 @@ static void
displaychangelistener_display_console(DisplayChangeListener *dcl,
static DisplaySurface *dummy;
if (!con || !console_compatible_with(con, dcl, errp)) {
- if (!dcl->ops->dpy_gfx_switch) {
- return;
- }
if (!dummy) {
dummy = qemu_create_placeholder_surface(640, 480, nodev);
}
- dcl->ops->dpy_gfx_switch(dcl, dummy);
+ displaychangelistener_gfx_switch(dcl, dummy);
return;
}
@@ -1091,9 +1097,8 @@ static void
displaychangelistener_display_console(DisplayChangeListener *dcl,
con->scanout.texture.y,
con->scanout.texture.width,
con->scanout.texture.height);
- } else if (con->scanout.kind == SCANOUT_SURFACE &&
- dcl->ops->dpy_gfx_switch) {
- dcl->ops->dpy_gfx_switch(dcl, con->surface);
+ } else if (con->scanout.kind == SCANOUT_SURFACE) {
+ displaychangelistener_gfx_switch(dcl, con->surface);
}
dcl->ops->dpy_gfx_update(dcl, 0, 0,
@@ -1677,9 +1682,7 @@ void dpy_gfx_replace_surface(QemuConsole *con,
if (con != (dcl->con ? dcl->con : active_console)) {
continue;
}
- if (dcl->ops->dpy_gfx_switch) {
- dcl->ops->dpy_gfx_switch(dcl, surface);
- }
+ displaychangelistener_gfx_switch(dcl, surface);
}
qemu_free_displaysurface(old_surface);
}
--
2.35.1.273.ge6ebfd0e8cbb
- [PULL v2 00/12] dbus console fixes, marcandre . lureau, 2022/03/15
- [PULL v2 01/12] ui/console: move check for compatible GL context, marcandre . lureau, 2022/03/15
- [PULL v2 02/12] ui/console: move dcl compatiblity check to a callback, marcandre . lureau, 2022/03/15
- [PULL v2 03/12] ui/console: egl-headless is compatible with non-gl listeners, marcandre . lureau, 2022/03/15
- [PULL v2 04/12] ui/dbus: associate the DBusDisplayConsole listener with the given console, marcandre . lureau, 2022/03/15
- [PULL v2 05/12] ui/console: move console compatibility check to dcl_display_console(), marcandre . lureau, 2022/03/15
- [PULL v2 06/12] ui/shader: fix potential leak of shader on error, marcandre . lureau, 2022/03/15
- [PULL v2 07/12] ui/shader: free associated programs, marcandre . lureau, 2022/03/15
- [PULL v2 08/12] ui/console: add a dpy_gfx_switch callback helper,
marcandre . lureau <=
- [PULL v2 09/12] ui/console: optionally update after gfx switch, marcandre . lureau, 2022/03/15
- [PULL v2 10/12] ui/dbus: fix texture sharing, marcandre . lureau, 2022/03/15
- [PULL v2 11/12] ui/dbus: do not send 2d scanout until gfx_update, marcandre . lureau, 2022/03/15
- [PULL v2 12/12] ui/console: call gfx_switch() even if the current scanout is GL, marcandre . lureau, 2022/03/15
- Re: [PULL v2 00/12] dbus console fixes, Peter Maydell, 2022/03/15