[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RfC PATCH] vga: wire up -g <width>x<height> switch for vir
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [RfC PATCH] vga: wire up -g <width>x<height> switch for virtio and qxl |
Date: |
Mon, 20 Feb 2017 16:16:03 +0100 |
FIXME: qxl not working yet.
Cc: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
arch_init.c | 8 ++++++--
hw/display/qxl.c | 18 ++++++++++++++++++
hw/display/virtio-gpu.c | 9 +++++++--
qemu-options.hx | 6 ++++--
4 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 0810116..9cd3dfc 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -34,14 +34,18 @@
#include "hw/acpi/acpi.h"
#include "qemu/help_option.h"
-#ifdef TARGET_SPARC
+#if defined(TARGET_SPARC)
int graphic_width = 1024;
int graphic_height = 768;
int graphic_depth = 8;
-#else
+#elif defined(TARGET_PPC)
int graphic_width = 800;
int graphic_height = 600;
int graphic_depth = 32;
+#else
+int graphic_width;
+int graphic_height;
+int graphic_depth;
#endif
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index af4c0ca..c29ee7b 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -368,6 +368,24 @@ static void init_qxl_rom(PCIQXLDevice *d)
rom->num_pages = cpu_to_le32(num_pages);
rom->ram_header_offset = cpu_to_le32(d->vga.vram_size - ram_header_size);
+#if 0
+ /*
+ * FIXME:
+ *
+ * Not working that simple. Seems the driver doesn't check this
+ * without notification. So we have to try something more clever,
+ * and pay attention that we don't screw up the spice guest agent
+ * monitor configuration ...
+ */
+ if (graphic_width && graphic_height) {
+ rom->client_monitors_config.count = 1;
+ rom->client_monitors_config.heads[0].left = 0;
+ rom->client_monitors_config.heads[0].top = 0;
+ rom->client_monitors_config.heads[0].right = graphic_width;
+ rom->client_monitors_config.heads[0].bottom = graphic_height;
+ }
+#endif
+
d->shadow_rom = *rom;
d->rom = rom;
d->modes = modes;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 9b530ab..04ba221 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1170,8 +1170,13 @@ static void virtio_gpu_device_realize(DeviceState *qdev,
Error **errp)
virtio_init(VIRTIO_DEVICE(g), "virtio-gpu", VIRTIO_ID_GPU,
g->config_size);
- g->req_state[0].width = 1024;
- g->req_state[0].height = 768;
+ if (graphic_width && graphic_height) {
+ g->req_state[0].width = graphic_width;
+ g->req_state[0].height = graphic_height;
+ } else {
+ g->req_state[0].width = 1024;
+ g->req_state[0].height = 768;
+ }
if (virtio_gpu_virgl_enabled(g->conf)) {
/* use larger control queue in 3d mode */
diff --git a/qemu-options.hx b/qemu-options.hx
index 5633d39..734a87b 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1233,11 +1233,13 @@ ETEXI
DEF("g", 1, QEMU_OPTION_g ,
"-g WxH[xDEPTH] Set the initial graphical resolution and depth\n",
- QEMU_ARCH_PPC | QEMU_ARCH_SPARC)
+ QEMU_ARCH_ALL)
STEXI
@item -g @address@hidden@var{depth}]
@findex -g
-Set the initial graphical resolution and depth (PPC, SPARC only).
+Set the initial graphical resolution and depth.
+On PPC and SPARC the firmware will configure the display accordingly.
+On other archs this is supported by virtio and qxl (FIXME) display adapters.
ETEXI
DEF("vnc", HAS_ARG, QEMU_OPTION_vnc ,
--
1.8.3.1
- [Qemu-devel] [RfC PATCH] vga: wire up -g <width>x<height> switch for virtio and qxl,
Gerd Hoffmann <=