aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2023-11-07 19:00:03 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2023-11-07 19:00:03 +0800
commit462ad017ed76889d46696a3581e1b52343f9b683 (patch)
treee869fe1d3499bbf7b6ef7a674ff9e45f94469cc0 /ui
parentf6b615b52d1d92f02103596a30df95f31138a2e4 (diff)
parentd017f28a2ee082f472ed69fedf0435b468000e92 (diff)
Merge tag 'pixman-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging
Make Pixman an optional dependency # -----BEGIN PGP SIGNATURE----- # # iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmVKDhkcHG1hcmNhbmRy # ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5f8CD/0YX5sXR3IwUfTp8B51 # iIwgOlVunzcT9oDYegIekaHdvggv3B39+gjC/khcehQ30qV6MDowj3ZagIeLavU2 # ZpHJMUkg1YRDHMiJ8aJmDhOyZHINCETWV2YoJX1ACllKOOMSXHC3mWKZd/eIqAPJ # EBMlSWBP1rRtwfaX+p1Y65XappJewzzb9SqFn8s5deowEAM3aK7xafHQOBWSVx9z # 5adhIWn3HMVnbYolVXlcHsPurfI86sqCl7QAqkFdwAvGIKghhqMT6pFfvu3BalHN # nz8GqpSvjlj/WNFABi00piXKx4kkqBJSsYMP8owZQZIeepT5RXuKAB15BA1Cc5N7 # wTkuLe7zXLUST32yAHLa2UZY8Gv/a6C+dH1EFRd7vMMczBPrzwuqzWChRTZPQaX6 # e4uhXnhuu8Io11TnkmwWeWtrLOf+6EmVOjxNwhUUXOqPXPxd7LGMh/ZIc1SuXh0a # k7khpXez4MoBWGftjCEUNlLZ13rcrqnkUWAZeOwjjaqxnYK+Lz32OGS3BtjRYvov # WgogC2c2vVHrSHxRxuytCHiM+7NY0Tf2B6PxZJKOQUtfFxvHjWkHghnJWwHH2OP/ # lMnJUU+XAaAxsiEiDN4BSd0DSA6jn6/vg8SgXXEDyIDExq5jELVMgw2q1cbQJK1s # mOgr8FZZfnxvwYIFvH7PFiDm3A== # =bLPz # -----END PGP SIGNATURE----- # gpg: Signature made Tue 07 Nov 2023 18:14:49 HKT # gpg: using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5 # gpg: issuer "marcandre.lureau@redhat.com" # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full] # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full] # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * tag 'pixman-pull-request' of https://gitlab.com/marcandre.lureau/qemu: (25 commits) build-sys: make pixman actually optional hw/display/ati: allow compiling without PIXMAN hw/mips: FULOONG depends on VT82C686 hw/sm501: allow compiling without PIXMAN hw/arm: XLNX_VERSAL depends on XLNX_CSU_DMA arm/kconfig: XLNX_ZYNQMP_ARM depends on PIXMAN ui/dbus: do not require PIXMAN ui/gtk: -display gtk requires PIXMAN ui/spice: SPICE/QXL requires PIXMAN ui/vnc: VNC requires PIXMAN ui/gl: opengl doesn't require PIXMAN vhost-user-gpu: skip VHOST_USER_GPU_UPDATE when !PIXMAN ui/console: when PIXMAN is unavailable, don't draw placeholder msg virtio-gpu: replace PIXMAN for region/rect test qmp/hmp: disable screendump if PIXMAN is missing ui/vc: console-vc requires PIXMAN ui/console: allow to override the default VC vl: move display early init before default devices vl: simplify display_remote logic qemu-options: define -vnc only #ifdef CONFIG_VNC ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/console-vc-stubs.c33
-rw-r--r--ui/console.c19
-rw-r--r--ui/dbus-listener.c90
-rw-r--r--ui/meson.build22
-rw-r--r--ui/qemu-pixman.c6
-rw-r--r--ui/ui-hmp-cmds.c2
-rw-r--r--ui/ui-qmp-cmds.c2
-rw-r--r--ui/vnc-stubs.c12
8 files changed, 136 insertions, 50 deletions
diff --git a/ui/console-vc-stubs.c b/ui/console-vc-stubs.c
new file mode 100644
index 0000000000..2afc52329f
--- /dev/null
+++ b/ui/console-vc-stubs.c
@@ -0,0 +1,33 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * QEMU VC stubs
+ */
+#include "qemu/osdep.h"
+
+#include "qapi/error.h"
+#include "qemu/error-report.h"
+#include "qemu/option.h"
+#include "chardev/char.h"
+#include "ui/console-priv.h"
+
+void qemu_text_console_select(QemuTextConsole *c)
+{
+}
+
+const char *
+qemu_text_console_get_label(QemuTextConsole *c)
+{
+ return NULL;
+}
+
+void qemu_text_console_update_cursor(void)
+{
+}
+
+void qemu_text_console_handle_keysym(QemuTextConsole *s, int keysym)
+{
+}
+
+void qemu_console_early_init(void)
+{
+}
diff --git a/ui/console.c b/ui/console.c
index 8ee66d10c5..8e688d3569 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -584,6 +584,7 @@ DisplaySurface *qemu_create_placeholder_surface(int w, int h,
const char *msg)
{
DisplaySurface *surface = qemu_create_displaysurface(w, h);
+#ifdef CONFIG_PIXMAN
pixman_color_t bg = QEMU_PIXMAN_COLOR_BLACK;
pixman_color_t fg = QEMU_PIXMAN_COLOR_GRAY;
pixman_image_t *glyph;
@@ -598,6 +599,7 @@ DisplaySurface *qemu_create_placeholder_surface(int w, int h,
x+i, y, FONT_WIDTH, FONT_HEIGHT);
qemu_pixman_image_unref(glyph);
}
+#endif
surface->flags |= QEMU_PLACEHOLDER_FLAG;
return surface;
}
@@ -1675,6 +1677,23 @@ void qemu_display_init(DisplayState *ds, DisplayOptions *opts)
dpys[opts->type]->init(ds, opts);
}
+const char *qemu_display_get_vc(DisplayOptions *opts)
+{
+ assert(opts->type < DISPLAY_TYPE__MAX);
+ if (opts->type == DISPLAY_TYPE_NONE) {
+ return NULL;
+ }
+ assert(dpys[opts->type] != NULL);
+ if (dpys[opts->type]->vc) {
+ return dpys[opts->type]->vc;
+ } else {
+#ifdef CONFIG_PIXMAN
+ return "vc:80Cx24C";
+#endif
+ }
+ return NULL;
+}
+
void qemu_display_help(void)
{
int idx;
diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c
index 36548a7f52..18f556aa73 100644
--- a/ui/dbus-listener.c
+++ b/ui/dbus-listener.c
@@ -26,9 +26,6 @@
#include "qapi/error.h"
#include "sysemu/sysemu.h"
#include "dbus.h"
-#ifdef CONFIG_OPENGL
-#include <pixman.h>
-#endif
#ifdef G_OS_UNIX
#include <gio/gunixfdlist.h>
#endif
@@ -41,6 +38,7 @@
#include "ui/shader.h"
#include "ui/egl-helpers.h"
#include "ui/egl-context.h"
+#include "ui/qemu-pixman.h"
#endif
#include "trace.h"
@@ -62,9 +60,11 @@ struct _DBusDisplayListener {
QemuDBusDisplay1Listener *proxy;
-#ifdef CONFIG_OPENGL
+#ifdef CONFIG_PIXMAN
/* Keep track of the damage region */
pixman_region32_t gl_damage;
+#else
+ int gl_damage;
#endif
DisplayChangeListener dcl;
@@ -545,6 +545,7 @@ static void dbus_gl_refresh(DisplayChangeListener *dcl)
return;
}
+#ifdef CONFIG_PIXMAN
int n_rects = pixman_region32_n_rects(&ddl->gl_damage);
for (int i = 0; i < n_rects; i++) {
@@ -555,6 +556,13 @@ static void dbus_gl_refresh(DisplayChangeListener *dcl)
box->x2 - box->x1, box->y2 - box->y1);
}
pixman_region32_clear(&ddl->gl_damage);
+#else
+ if (ddl->gl_damage) {
+ dbus_call_update_gl(dcl, 0, 0,
+ surface_width(ddl->ds), surface_height(ddl->ds));
+ ddl->gl_damage = 0;
+ }
+#endif
}
#endif /* OPENGL */
@@ -569,20 +577,64 @@ static void dbus_gl_gfx_update(DisplayChangeListener *dcl,
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
+#ifdef CONFIG_PIXMAN
pixman_region32_t rect_region;
pixman_region32_init_rect(&rect_region, x, y, w, h);
pixman_region32_union(&ddl->gl_damage, &ddl->gl_damage, &rect_region);
pixman_region32_fini(&rect_region);
+#else
+ ddl->gl_damage++;
+#endif
}
#endif
+static void dbus_gfx_update_sub(DBusDisplayListener *ddl,
+ int x, int y, int w, int h)
+{
+ pixman_image_t *img;
+ size_t stride;
+ GVariant *v_data;
+
+ /* make a copy, since gvariant only handles linear data */
+ stride = w * DIV_ROUND_UP(PIXMAN_FORMAT_BPP(surface_format(ddl->ds)), 8);
+ img = pixman_image_create_bits(surface_format(ddl->ds),
+ w, h, NULL, stride);
+#ifdef CONFIG_PIXMAN
+ pixman_image_composite(PIXMAN_OP_SRC, ddl->ds->image, NULL, img,
+ x, y, 0, 0, 0, 0, w, h);
+#else
+ {
+ uint8_t *src = (uint8_t *)pixman_image_get_data(ddl->ds->image);
+ uint8_t *dst = (uint8_t *)pixman_image_get_data(img);
+ int bp = PIXMAN_FORMAT_BPP(surface_format(ddl->ds)) / 8;
+ int hh;
+
+ for (hh = 0; hh < h; hh++) {
+ memcpy(&dst[stride * hh],
+ &src[surface_stride(ddl->ds) * (hh + y) + x * bp],
+ stride);
+ }
+ }
+#endif
+ v_data = g_variant_new_from_data(
+ G_VARIANT_TYPE("ay"),
+ pixman_image_get_data(img),
+ pixman_image_get_stride(img) * h,
+ TRUE,
+ (GDestroyNotify)pixman_image_unref,
+ img);
+ qemu_dbus_display1_listener_call_update(ddl->proxy,
+ x, y, w, h, pixman_image_get_stride(img), pixman_image_get_format(img),
+ v_data,
+ G_DBUS_CALL_FLAGS_NONE,
+ DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL);
+}
+
static void dbus_gfx_update(DisplayChangeListener *dcl,
int x, int y, int w, int h)
{
DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl);
- pixman_image_t *img;
GVariant *v_data;
- size_t stride;
assert(ddl->ds);
@@ -619,25 +671,7 @@ static void dbus_gfx_update(DisplayChangeListener *dcl,
return;
}
- /* make a copy, since gvariant only handles linear data */
- stride = w * DIV_ROUND_UP(PIXMAN_FORMAT_BPP(surface_format(ddl->ds)), 8);
- img = pixman_image_create_bits(surface_format(ddl->ds),
- w, h, NULL, stride);
- pixman_image_composite(PIXMAN_OP_SRC, ddl->ds->image, NULL, img,
- x, y, 0, 0, 0, 0, w, h);
-
- v_data = g_variant_new_from_data(
- G_VARIANT_TYPE("ay"),
- pixman_image_get_data(img),
- pixman_image_get_stride(img) * h,
- TRUE,
- (GDestroyNotify)pixman_image_unref,
- img);
- qemu_dbus_display1_listener_call_update(ddl->proxy,
- x, y, w, h, pixman_image_get_stride(img), pixman_image_get_format(img),
- v_data,
- G_DBUS_CALL_FLAGS_NONE,
- DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL);
+ dbus_gfx_update_sub(ddl, x, y, w, h);
}
#ifdef CONFIG_OPENGL
@@ -751,8 +785,10 @@ dbus_display_listener_dispose(GObject *object)
g_clear_object(&ddl->map_proxy);
g_clear_object(&ddl->d3d11_proxy);
g_clear_pointer(&ddl->peer_process, CloseHandle);
-#ifdef CONFIG_OPENGL
+#ifdef CONFIG_PIXMAN
pixman_region32_fini(&ddl->gl_damage);
+#endif
+#ifdef CONFIG_OPENGL
egl_fb_destroy(&ddl->fb);
#endif
#endif
@@ -787,7 +823,7 @@ dbus_display_listener_class_init(DBusDisplayListenerClass *klass)
static void
dbus_display_listener_init(DBusDisplayListener *ddl)
{
-#ifdef CONFIG_OPENGL
+#ifdef CONFIG_PIXMAN
pixman_region32_init(&ddl->gl_damage);
#endif
}
diff --git a/ui/meson.build b/ui/meson.build
index 0a1e8272a3..0ccb3387ee 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -6,7 +6,6 @@ system_ss.add(png)
system_ss.add(files(
'clipboard.c',
'console.c',
- 'console-vc.c',
'cursor.c',
'input-keymap.c',
'input-legacy.c',
@@ -19,6 +18,7 @@ system_ss.add(files(
'ui-qmp-cmds.c',
'util.c',
))
+system_ss.add(when: pixman, if_true: files('console-vc.c'), if_false: files('console-vc-stubs.c'))
if dbus_display
system_ss.add(files('dbus-module.c'))
endif
@@ -46,7 +46,7 @@ vnc_ss.add(files(
))
vnc_ss.add(zlib, jpeg, gnutls)
vnc_ss.add(when: sasl, if_true: files('vnc-auth-sasl.c'))
-system_ss.add_all(when: vnc, if_true: vnc_ss)
+system_ss.add_all(when: [vnc, pixman], if_true: vnc_ss)
system_ss.add(when: vnc, if_false: files('vnc-stubs.c'))
ui_modules = {}
@@ -60,8 +60,8 @@ endif
system_ss.add(opengl)
if opengl.found()
opengl_ss = ss.source_set()
- opengl_ss.add(gbm)
- opengl_ss.add(when: [opengl, pixman],
+ opengl_ss.add(gbm, pixman)
+ opengl_ss.add(when: [opengl],
if_true: files('shader.c', 'console-gl.c', 'egl-helpers.c', 'egl-context.c'))
ui_modules += {'opengl' : opengl_ss}
endif
@@ -93,7 +93,7 @@ if dbus_display
'--generate-c-code', '@BASENAME@'])
dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, include_directories: include_directories('.'))
- dbus_ss.add(when: [gio, pixman, dbus_display1_dep],
+ dbus_ss.add(when: [gio, dbus_display1_dep],
if_true: [files(
'dbus-chardev.c',
'dbus-clipboard.c',
@@ -101,7 +101,7 @@ if dbus_display
'dbus-error.c',
'dbus-listener.c',
'dbus.c',
- ), opengl, gbm])
+ ), opengl, gbm, pixman])
ui_modules += {'dbus' : dbus_ss}
endif
@@ -141,12 +141,12 @@ if spice.found()
'spice-display.c'
))
ui_modules += {'spice-core' : spice_core_ss}
-endif
-if spice.found() and gio.found()
- spice_ss = ss.source_set()
- spice_ss.add(spice, gio, pixman, files('spice-app.c'))
- ui_modules += {'spice-app': spice_ss}
+ if gio.found()
+ spice_ss = ss.source_set()
+ spice_ss.add(spice, gio, pixman, files('spice-app.c'))
+ ui_modules += {'spice-app': spice_ss}
+ endif
endif
keymaps = [
diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c
index b43ec38bf0..5ca55dd199 100644
--- a/ui/qemu-pixman.c
+++ b/ui/qemu-pixman.c
@@ -145,6 +145,7 @@ int qemu_pixman_get_type(int rshift, int gshift, int bshift)
return type;
}
+#ifdef CONFIG_PIXMAN
pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf)
{
pixman_format_code_t format;
@@ -158,6 +159,7 @@ pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf)
}
return format;
}
+#endif
/*
* Return true for known-good pixman conversions.
@@ -186,6 +188,7 @@ bool qemu_pixman_check_format(DisplayChangeListener *dcl,
}
}
+#ifdef CONFIG_PIXMAN
pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format,
int width)
{
@@ -211,6 +214,7 @@ pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format,
NULL,
pixman_image_get_stride(image));
}
+#endif
void qemu_pixman_image_unref(pixman_image_t *image)
{
@@ -220,6 +224,7 @@ void qemu_pixman_image_unref(pixman_image_t *image)
pixman_image_unref(image);
}
+#ifdef CONFIG_PIXMAN
pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *font,
unsigned int ch)
{
@@ -262,3 +267,4 @@ void qemu_pixman_glyph_render(pixman_image_t *glyph,
pixman_image_unref(ifg);
pixman_image_unref(ibg);
}
+#endif /* CONFIG_PIXMAN */
diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c
index c671389473..26c8ced1f2 100644
--- a/ui/ui-hmp-cmds.c
+++ b/ui/ui-hmp-cmds.c
@@ -437,6 +437,7 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
}
}
+#ifdef CONFIG_PIXMAN
void coroutine_fn
hmp_screendump(Monitor *mon, const QDict *qdict)
{
@@ -458,6 +459,7 @@ hmp_screendump(Monitor *mon, const QDict *qdict)
end:
hmp_handle_error(mon, err);
}
+#endif
void hmp_client_migrate_info(Monitor *mon, const QDict *qdict)
{
diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c
index debc07d678..d772e1cb7f 100644
--- a/ui/ui-qmp-cmds.c
+++ b/ui/ui-qmp-cmds.c
@@ -212,6 +212,7 @@ void qmp_client_migrate_info(const char *protocol, const char *hostname,
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'");
}
+#ifdef CONFIG_PIXMAN
#ifdef CONFIG_PNG
/**
* png_save: Take a screenshot as PNG
@@ -391,3 +392,4 @@ qmp_screendump(const char *filename, const char *device,
}
}
}
+#endif /* CONFIG_PIXMAN */
diff --git a/ui/vnc-stubs.c b/ui/vnc-stubs.c
index b4eb3ce718..a96bc86236 100644
--- a/ui/vnc-stubs.c
+++ b/ui/vnc-stubs.c
@@ -10,15 +10,3 @@ int vnc_display_pw_expire(const char *id, time_t expires)
{
return -ENODEV;
};
-void vnc_parse(const char *str)
-{
- if (strcmp(str, "none") == 0) {
- return;
- }
- error_setg(&error_fatal, "VNC support is disabled");
-}
-int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
-{
- error_setg(errp, "VNC support is disabled");
- return -1;
-}