[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/8] console: add qemu_alloc_display_format.
From: |
fred . konrad |
Subject: |
[Qemu-devel] [PATCH 3/8] console: add qemu_alloc_display_format. |
Date: |
Wed, 13 May 2015 21:12:01 +0200 |
From: KONRAD Frederic <address@hidden>
This allows to create a surface with a different format than xrgb8888.
Signed-off-by: KONRAD Frederic <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
---
include/ui/console.h | 2 ++
ui/console.c | 25 ++++++++++++++++++++++---
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index e8b3a9e..e816182 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -206,6 +206,8 @@ DisplaySurface *qemu_create_displaysurface_guestmem(int
width, int height,
PixelFormat qemu_default_pixelformat(int bpp);
DisplaySurface *qemu_create_displaysurface(int width, int height);
+DisplaySurface *qemu_create_displaysurface_format(pixman_format_code_t format,
+ int width, int height);
void qemu_free_displaysurface(DisplaySurface *surface);
static inline int is_surface_bgr(DisplaySurface *surface)
diff --git a/ui/console.c b/ui/console.c
index 406c36b..5fc8473 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1226,20 +1226,29 @@ static QemuConsole *new_console(DisplayState *ds,
console_type_t console_type,
return s;
}
-static void qemu_alloc_display(DisplaySurface *surface, int width, int height)
+static void qemu_alloc_display_format(DisplaySurface *surface,
+ pixman_format_code_t format,
+ int width, int height)
{
qemu_pixman_image_unref(surface->image);
surface->image = NULL;
- surface->format = PIXMAN_x8r8g8b8;
+ surface->format = format;
surface->image = pixman_image_create_bits(surface->format,
width, height,
- NULL, width * 4);
+ NULL,
+ width * PIXMAN_FORMAT_BPP(format)
+ / 8);
assert(surface->image != NULL);
surface->flags = QEMU_ALLOCATED_FLAG;
}
+static void qemu_alloc_display(DisplaySurface *surface, int width, int height)
+{
+ qemu_alloc_display_format(surface, PIXMAN_x8r8g8b8, width, height);
+}
+
DisplaySurface *qemu_create_displaysurface(int width, int height)
{
DisplaySurface *surface = g_new0(DisplaySurface, 1);
@@ -1249,6 +1258,16 @@ DisplaySurface *qemu_create_displaysurface(int width,
int height)
return surface;
}
+DisplaySurface *qemu_create_displaysurface_format(pixman_format_code_t format,
+ int width, int height)
+{
+ DisplaySurface *surface = g_new0(DisplaySurface, 1);
+
+ trace_displaysurface_create(surface, width, height);
+ qemu_alloc_display_format(surface, format, width, height);
+ return surface;
+}
+
DisplaySurface *qemu_create_displaysurface_from(int width, int height,
pixman_format_code_t format,
int linesize, uint8_t *data)
--
1.9.0
[Qemu-devel] [PATCH 4/8] introduce dpcd module., fred . konrad, 2015/05/13
[Qemu-devel] [PATCH 5/8] hw/i2c-ddc.c: Implement DDC I2C slave, fred . konrad, 2015/05/13
[Qemu-devel] [PATCH 8/8] arm: xlnx-zynqmp: Add DisplayPort and DPDMA., fred . konrad, 2015/05/13