[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 47/67] ui/console: remove redundant format field
From: |
marcandre . lureau |
Subject: |
[PATCH 47/67] ui/console: remove redundant format field |
Date: |
Wed, 30 Aug 2023 13:38:21 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
It's already part of PIXMAN image.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/ui/console.h | 15 +++++++--------
ui/console-gl.c | 2 +-
ui/console.c | 4 +---
ui/gtk.c | 2 +-
ui/spice-display.c | 2 +-
ui/vnc.c | 2 +-
6 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 26d63d17a2..93bb03a9e2 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -152,7 +152,6 @@ typedef struct ScanoutTexture {
} ScanoutTexture;
typedef struct DisplaySurface {
- pixman_format_code_t format;
pixman_image_t *image;
uint8_t flags;
#ifdef CONFIG_OPENGL
@@ -436,23 +435,23 @@ static inline int surface_height(DisplaySurface *s)
return pixman_image_get_height(s->image);
}
+static inline pixman_format_code_t surface_format(DisplaySurface *s)
+{
+ return pixman_image_get_format(s->image);
+}
+
static inline int surface_bits_per_pixel(DisplaySurface *s)
{
- int bits = PIXMAN_FORMAT_BPP(s->format);
+ int bits = PIXMAN_FORMAT_BPP(surface_format(s));
return bits;
}
static inline int surface_bytes_per_pixel(DisplaySurface *s)
{
- int bits = PIXMAN_FORMAT_BPP(s->format);
+ int bits = PIXMAN_FORMAT_BPP(surface_format(s));
return DIV_ROUND_UP(bits, 8);
}
-static inline pixman_format_code_t surface_format(DisplaySurface *s)
-{
- return s->format;
-}
-
typedef uint32_t console_ch_t;
static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
diff --git a/ui/console-gl.c b/ui/console-gl.c
index 8e3c9a3c8c..103b954017 100644
--- a/ui/console-gl.c
+++ b/ui/console-gl.c
@@ -53,7 +53,7 @@ void surface_gl_create_texture(QemuGLShader *gls,
return;
}
- switch (surface->format) {
+ switch (surface_format(surface)) {
case PIXMAN_BE_b8g8r8x8:
case PIXMAN_BE_b8g8r8a8:
surface->glformat = GL_BGRA_EXT;
diff --git a/ui/console.c b/ui/console.c
index b8ffad30d3..f7bc27f596 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1493,8 +1493,7 @@ DisplaySurface *qemu_create_displaysurface_from(int
width, int height,
DisplaySurface *surface = g_new0(DisplaySurface, 1);
trace_displaysurface_create_from(surface, width, height, format);
- surface->format = format;
- surface->image = pixman_image_create_bits(surface->format,
+ surface->image = pixman_image_create_bits(format,
width, height,
(void *)data, linesize);
assert(surface->image != NULL);
@@ -1511,7 +1510,6 @@ DisplaySurface
*qemu_create_displaysurface_pixman(pixman_image_t *image)
DisplaySurface *surface = g_new0(DisplaySurface, 1);
trace_displaysurface_create_pixman(surface);
- surface->format = pixman_image_get_format(image);
surface->image = pixman_image_ref(image);
return surface;
diff --git a/ui/gtk.c b/ui/gtk.c
index fab6d6581d..7b9e005bf8 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -514,7 +514,7 @@ static void gd_switch(DisplayChangeListener *dcl,
}
vc->gfx.ds = surface;
- if (surface->format == PIXMAN_x8r8g8b8) {
+ if (surface_format(surface) == PIXMAN_x8r8g8b8) {
/*
* PIXMAN_x8r8g8b8 == CAIRO_FORMAT_RGB24
*
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 3f3f8013d8..d977ab139d 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -436,7 +436,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
}
if (ssd->ds) {
ssd->surface = pixman_image_ref(ssd->ds->image);
- ssd->mirror = qemu_pixman_mirror_create(ssd->ds->format,
+ ssd->mirror = qemu_pixman_mirror_create(surface_format(ssd->ds),
ssd->ds->image);
qemu_spice_create_host_primary(ssd);
}
diff --git a/ui/vnc.c b/ui/vnc.c
index 22894b7b1f..6fd86996a5 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -833,7 +833,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
/* guest surface */
qemu_pixman_image_unref(vd->guest.fb);
vd->guest.fb = pixman_image_ref(surface->image);
- vd->guest.format = surface->format;
+ vd->guest.format = surface_format(surface);
if (pageflip) {
--
2.41.0
- Re: [PATCH 37/67] ui/console: rename vga_ functions → qemu_console_, (continued)
- [PATCH 41/67] ui/console: minor stylistic changes, marcandre . lureau, 2023/08/30
- [PATCH 42/67] ui/vc: move text console invalidate in helper, marcandre . lureau, 2023/08/30
- [PATCH 43/67] ui/vc: do not parse VC-specific options in Spice and GTK, marcandre . lureau, 2023/08/30
- [PATCH 45/67] ui/vc: remove kby_put_keysym() and update function calls, marcandre . lureau, 2023/08/30
- [PATCH 46/67] ui/vc: rename kbd_put → qemu_text_console functions, marcandre . lureau, 2023/08/30
- [PATCH 44/67] ui/vc: change the argument for QemuTextConsole, marcandre . lureau, 2023/08/30
- [PATCH 48/67] ui/vc: preliminary QemuTextConsole changes before split, marcandre . lureau, 2023/08/30
- [PATCH 47/67] ui/console: remove redundant format field,
marcandre . lureau <=
- [PATCH 50/67] ui/console: move DisplaySurface to its own header, marcandre . lureau, 2023/08/30
- [PATCH 52/67] ui: compile out some qemu-pixman functions when !PIXMAN, marcandre . lureau, 2023/08/30
- [PATCH 56/67] virtio-gpu: replace PIXMAN for region/rect test, marcandre . lureau, 2023/08/30
- [PATCH 54/67] ui/vc: console-vc requires PIXMAN, marcandre . lureau, 2023/08/30
- [PATCH 55/67] qmp/hmp: disable screendump if PIXMAN is missing, marcandre . lureau, 2023/08/30
- [PATCH 49/67] ui/vc: split off the VC part from console.c, marcandre . lureau, 2023/08/30
- [PATCH 51/67] build-sys: add optional "pixman" feature, marcandre . lureau, 2023/08/30