All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl.
@ 2017-02-21 22:14 Gerd Hoffmann
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 1/9] sysemu: add defines for sparc & ppc graphics_* Gerd Hoffmann
                   ` (9 more replies)
  0 siblings, 10 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Made a nice patch series out of it, first cleaning up graphics_* variables,
then adding support for -g to virtio (just works), qxl (needs guest driver
fixes) and stdvga (needs virtual hardware update, and therefore also an
guest driver update for obvious reasons).

linux kernel patches to test qxl and stdvga are here:
  https://www.kraxel.org/cgit/linux/log/?h=qxl-display-size

please review & test,
  Gerd

Gerd Hoffmann (9):
  sysemu: add defines for sparc & ppc graphics_*
  sparc: use sparc_graphic_* defines
  ppc: use ppc_graphic_* defines
  drop arch-specific graphic_* initialization.
  enable -g command line switch for all archs
  virtio-gpu: use graphic_* variables.
  qxl: use graphic_* variables.
  update -g command line switch documentation
  [RfC] stdvga: use graphic_* variables.

 arch_init.c             | 11 -----------
 hw/display/qxl.c        | 32 ++++++++++++++++++++----------
 hw/display/vga-pci.c    | 52 ++++++++++++++++++++++++++++++++++---------------
 hw/display/vga_int.h    |  4 ++--
 hw/display/virtio-gpu.c |  9 +++++++--
 hw/display/virtio-vga.c |  3 ++-
 hw/ppc/mac_newworld.c   |  6 +++---
 hw/ppc/mac_oldworld.c   |  6 +++---
 hw/ppc/prep.c           | 10 +++++-----
 hw/ppc/spapr.c          |  6 +++---
 hw/sparc/sun4m.c        | 36 +++++++++++++++++-----------------
 include/sysemu/sysemu.h |  7 +++++++
 qemu-options.hx         | 15 ++++++++++++--
 vl.c                    |  3 +++
 14 files changed, 124 insertions(+), 76 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH 1/9] sysemu: add defines for sparc & ppc graphics_*
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
@ 2017-02-21 22:14 ` Gerd Hoffmann
  2017-02-28 14:50   ` Thomas Huth
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 2/9] sparc: use sparc_graphic_* defines Gerd Hoffmann
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Add defines for the sparc and ppc arch specific graphics defaults.
They return the graphic_* values these variables are non-zero, and
the default values otherwise.

After switching over ppc and sparc to use these we don't need the
arch-specific initialization for the graphic_* variables any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/sysemu/sysemu.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 576c7ce..9450788 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -142,9 +142,16 @@ typedef enum {
 extern int vga_interface_type;
 #define xenfb_enabled (vga_interface_type == VGA_XENFB)
 
+#define sparc_graphic_width  (graphic_width  ? graphic_width  : 1024)
+#define sparc_graphic_height (graphic_height ? graphic_height :  768)
+#define sparc_graphic_depth  (graphic_depth  ? graphic_depth  :    8)
+#define ppc_graphic_width    (graphic_width  ? graphic_width  :  800)
+#define ppc_graphic_height   (graphic_height ? graphic_height :  600)
+#define ppc_graphic_depth    (graphic_depth  ? graphic_depth  :   32)
 extern int graphic_width;
 extern int graphic_height;
 extern int graphic_depth;
+
 extern int display_opengl;
 extern const char *keyboard_layout;
 extern int win2k_install_hack;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH 2/9] sparc: use sparc_graphic_* defines
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 1/9] sysemu: add defines for sparc & ppc graphics_* Gerd Hoffmann
@ 2017-02-21 22:14 ` Gerd Hoffmann
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 3/9] ppc: use ppc_graphic_* defines Gerd Hoffmann
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Mark Cave-Ayland, Artyom Tarasenko

This switches over sparc to use the new sparc_graphic_* defines.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/sparc/sun4m.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index f5b6efd..1aaad68 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -908,43 +908,43 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
     ledma = sparc32_dma_init(hwdef->dma_base + 16ULL,
                              slavio_irq[16], iommu, &ledma_irq, 1);
 
-    if (graphic_depth != 8 && graphic_depth != 24) {
-        error_report("Unsupported depth: %d", graphic_depth);
+    if (sparc_graphic_depth != 8 && sparc_graphic_depth != 24) {
+        error_report("Unsupported depth: %d", sparc_graphic_depth);
         exit (1);
     }
     num_vsimms = 0;
     if (num_vsimms == 0) {
         if (vga_interface_type == VGA_CG3) {
-            if (graphic_depth != 8) {
-                error_report("Unsupported depth: %d", graphic_depth);
+            if (sparc_graphic_depth != 8) {
+                error_report("Unsupported depth: %d", sparc_graphic_depth);
                 exit(1);
             }
 
-            if (!(graphic_width == 1024 && graphic_height == 768) &&
-                !(graphic_width == 1152 && graphic_height == 900)) {
-                error_report("Unsupported resolution: %d x %d", graphic_width,
-                             graphic_height);
+            if (!(sparc_graphic_width == 1024 && sparc_graphic_height == 768) &&
+                !(sparc_graphic_width == 1152 && sparc_graphic_height == 900)) {
+                error_report("Unsupported resolution: %d x %d", sparc_graphic_width,
+                             sparc_graphic_height);
                 exit(1);
             }
 
             /* sbus irq 5 */
             cg3_init(hwdef->tcx_base, slavio_irq[11], 0x00100000,
-                     graphic_width, graphic_height, graphic_depth);
+                     sparc_graphic_width, sparc_graphic_height, sparc_graphic_depth);
         } else {
             /* If no display specified, default to TCX */
-            if (graphic_depth != 8 && graphic_depth != 24) {
-                error_report("Unsupported depth: %d", graphic_depth);
+            if (sparc_graphic_depth != 8 && sparc_graphic_depth != 24) {
+                error_report("Unsupported depth: %d", sparc_graphic_depth);
                 exit(1);
             }
 
-            if (!(graphic_width == 1024 && graphic_height == 768)) {
+            if (!(sparc_graphic_width == 1024 && sparc_graphic_height == 768)) {
                 error_report("Unsupported resolution: %d x %d",
-                             graphic_width, graphic_height);
+                             sparc_graphic_width, sparc_graphic_height);
                 exit(1);
             }
 
             tcx_init(hwdef->tcx_base, slavio_irq[11], 0x00100000,
-                     graphic_width, graphic_height, graphic_depth);
+                     sparc_graphic_width, sparc_graphic_height, sparc_graphic_depth);
         }
     }
 
@@ -1025,7 +1025,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
 
     nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, machine->kernel_cmdline,
                machine->boot_order, machine->ram_size, kernel_size,
-               graphic_width, graphic_height, graphic_depth,
+               sparc_graphic_width, sparc_graphic_height, sparc_graphic_depth,
                hwdef->nvram_machine_id, "Sun4m");
 
     if (hwdef->ecc_base)
@@ -1037,9 +1037,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_WIDTH, graphic_width);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_HEIGHT, graphic_height);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, sparc_graphic_depth);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_WIDTH, sparc_graphic_width);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_HEIGHT, sparc_graphic_height);
     fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR);
     fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
     if (machine->kernel_cmdline) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH 3/9] ppc: use ppc_graphic_* defines
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 1/9] sysemu: add defines for sparc & ppc graphics_* Gerd Hoffmann
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 2/9] sparc: use sparc_graphic_* defines Gerd Hoffmann
@ 2017-02-21 22:14 ` Gerd Hoffmann
  2017-02-21 22:45   ` Hervé Poussineau
  2017-02-22  1:11   ` David Gibson
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 4/9] drop arch-specific graphic_* initialization Gerd Hoffmann
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Alexander Graf, David Gibson,
	Hervé Poussineau, open list:New World

This switches over ppc to use the new ppc_graphic_* defines.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/ppc/mac_newworld.c |  6 +++---
 hw/ppc/mac_oldworld.c |  6 +++---
 hw/ppc/prep.c         | 10 +++++-----
 hw/ppc/spapr.c        |  6 +++---
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 2bfdb64..4722277 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -482,9 +482,9 @@ static void ppc_core99_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
-    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, ppc_graphic_width);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, ppc_graphic_height);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, ppc_graphic_depth);
 
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
     if (kvm_enabled()) {
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 56282c5..a79f011 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -335,9 +335,9 @@ static void ppc_heathrow_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
-    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, ppc_graphic_width);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, ppc_graphic_height);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, ppc_graphic_depth);
 
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
     if (kvm_enabled()) {
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index ca7959c..82bf6b5 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -677,7 +677,7 @@ static void ppc_prep_init(MachineState *machine)
                          initrd_base, initrd_size,
                          /* XXX: need an option to load a NVRAM image */
                          0,
-                         graphic_width, graphic_height, graphic_depth);
+                         ppc_graphic_width, ppc_graphic_height, ppc_graphic_depth);
 }
 
 static void prep_machine_init(MachineClass *mc)
@@ -861,9 +861,9 @@ static void ibm_40p_init(MachineState *machine)
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_PREP);
 
-    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
-    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, ppc_graphic_width);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, ppc_graphic_height);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, ppc_graphic_depth);
 
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
     if (kvm_enabled()) {
@@ -891,7 +891,7 @@ static void ibm_40p_init(MachineState *machine)
                              initrd_base, initrd_size,
                              /* XXX: need an option to load a NVRAM image */
                              0,
-                             graphic_width, graphic_height, graphic_depth);
+                             ppc_graphic_width, ppc_graphic_height, ppc_graphic_depth);
     }
 }
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index e465d7a..ba8f81e 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -824,9 +824,9 @@ static void spapr_dt_chosen(sPAPRMachineState *spapr, void *fdt)
     if (boot_menu) {
         _FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", boot_menu)));
     }
-    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_width));
-    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_height));
-    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_depth));
+    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", ppc_graphic_width));
+    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", ppc_graphic_height));
+    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", ppc_graphic_depth));
 
     if (cb && bootlist) {
         int i;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH 4/9] drop arch-specific graphic_* initialization.
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 3/9] ppc: use ppc_graphic_* defines Gerd Hoffmann
@ 2017-02-21 22:14 ` Gerd Hoffmann
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 5/9] enable -g command line switch for all archs Gerd Hoffmann
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Paolo Bonzini

Now that sparc and ppc can deal with uninitialized graphic_* variables
we can drop the #ifdefs and also move the variables out of arch_init.c
as they are not arch specific any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 arch_init.c | 11 -----------
 vl.c        |  3 +++
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 0810116..f41af1c 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -34,17 +34,6 @@
 #include "hw/acpi/acpi.h"
 #include "qemu/help_option.h"
 
-#ifdef TARGET_SPARC
-int graphic_width = 1024;
-int graphic_height = 768;
-int graphic_depth = 8;
-#else
-int graphic_width = 800;
-int graphic_height = 600;
-int graphic_depth = 32;
-#endif
-
-
 #if defined(TARGET_ALPHA)
 #define QEMU_ARCH QEMU_ARCH_ALPHA
 #elif defined(TARGET_ARM)
diff --git a/vl.c b/vl.c
index 27d9829..3be883e 100644
--- a/vl.c
+++ b/vl.c
@@ -135,6 +135,9 @@ const char *bios_name = NULL;
 enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
 int request_opengl = -1;
 int display_opengl;
+int graphic_width;
+int graphic_height;
+int graphic_depth;
 const char* keyboard_layout = NULL;
 ram_addr_t ram_size;
 const char *mem_path = NULL;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH 5/9] enable -g command line switch for all archs
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 4/9] drop arch-specific graphic_* initialization Gerd Hoffmann
@ 2017-02-21 22:14 ` Gerd Hoffmann
  2017-02-28 14:53   ` Thomas Huth
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables Gerd Hoffmann
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Virtual display adapters will learn to use graphic_* variables
(which are set by the -g switch), so enable this for all archs.

RfC:  Maybe restrict to PCI-capable archs?
      Or would that be pretty much anything anyway?

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 qemu-options.hx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 809b2b0..4e89610 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1237,7 +1237,7 @@ 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 @var{width}x@var{height}[x@var{depth}]
 @findex -g
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables.
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 5/9] enable -g command line switch for all archs Gerd Hoffmann
@ 2017-02-21 22:14 ` Gerd Hoffmann
  2017-02-24  9:21   ` Paolo Bonzini
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 7/9] qxl: " Gerd Hoffmann
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

If graphic_* variables are set (via -g switch), pass on
that information to the guest so the driver can use it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/virtio-gpu.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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 */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH 7/9] qxl: use graphic_* variables.
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables Gerd Hoffmann
@ 2017-02-21 22:14 ` Gerd Hoffmann
  2017-02-24  9:21   ` Paolo Bonzini
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 8/9] update -g command line switch documentation Gerd Hoffmann
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

If graphic_* variables are set (via -g switch), pass on
that information to the guest so the driver can use it.

Also move up qxl_crc32() function so we don't need a
forward declaration.

Additionally guest driver updates are needed so the
guest driver will actually pick this up, which will
probably land in linux kernel 4.12.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/qxl.c | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index af4c0ca..37c84a8 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -304,6 +304,16 @@ void qxl_spice_reset_cursor(PCIQXLDevice *qxl)
     qxl->ssd.cursor = cursor_builtin_hidden();
 }
 
+static uint32_t qxl_crc32(const uint8_t *p, unsigned len)
+{
+    /*
+     * zlib xors the seed with 0xffffffff, and xors the result
+     * again with 0xffffffff; Both are not done with linux's crc32,
+     * which we want to be compatible with, so undo that.
+     */
+    return crc32(0xffffffff, p, len) ^ 0xffffffff;
+}
+
 static ram_addr_t qxl_rom_size(void)
 {
 #define QXL_REQUIRED_SZ (sizeof(QXLRom) + sizeof(QXLModes) + sizeof(qxl_modes))
@@ -368,6 +378,18 @@ 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 (graphic_width && graphic_height) {
+        /* needs linux kernel 4.12+ to work */
+        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 = cpu_to_le32(graphic_width);
+        rom->client_monitors_config.heads[0].bottom = cpu_to_le32(graphic_height);
+        rom->client_monitors_config_crc = qxl_crc32(
+            (const uint8_t *)&rom->client_monitors_config,
+            sizeof(rom->client_monitors_config));
+    }
+
     d->shadow_rom = *rom;
     d->rom        = rom;
     d->modes      = modes;
@@ -981,16 +1003,6 @@ static void interface_set_client_capabilities(QXLInstance *sin,
     qxl_send_events(qxl, QXL_INTERRUPT_CLIENT);
 }
 
-static uint32_t qxl_crc32(const uint8_t *p, unsigned len)
-{
-    /*
-     * zlib xors the seed with 0xffffffff, and xors the result
-     * again with 0xffffffff; Both are not done with linux's crc32,
-     * which we want to be compatible with, so undo that.
-     */
-    return crc32(0xffffffff, p, len) ^ 0xffffffff;
-}
-
 static bool qxl_rom_monitors_config_changed(QXLRom *rom,
         VDAgentMonitorsConfig *monitors_config,
         unsigned int max_outputs)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH 8/9] update -g command line switch documentation
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 7/9] qxl: " Gerd Hoffmann
@ 2017-02-21 22:14 ` Gerd Hoffmann
  2017-02-22  0:37   ` Laszlo Ersek
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 9/9] [RfC] stdvga: use graphic_* variables Gerd Hoffmann
  2017-02-24  8:40 ` [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Mark Cave-Ayland
  9 siblings, 1 reply; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Bring documentation in line with the recent changes.
Text suggested by László Érsek.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 qemu-options.hx | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 4e89610..ae62e0d 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1241,7 +1241,18 @@ DEF("g", 1, QEMU_OPTION_g ,
 STEXI
 @item -g @var{width}x@var{height}[x@var{depth}]
 @findex -g
-Set the initial graphical resolution and depth (PPC, SPARC only).
+Set the initial graphical resolution and depth.
+
+This setting may be masked by guest firmware temporarily.
+
+On PPC and SPARC, the guest firmware will configure the display from
+this setting, and the guest OS will inherit the display resolution
+and depth.
+
+On x86 and ARM, if the guest firmware is an edk2 (UEFI) platform,
+the firmware may initially configure the display according to its own,
+persistent, independent settings. The guest OS drivers, once loaded,
+should adhere to "-g" however, for virtio and qxl adapters.
 ETEXI
 
 DEF("vnc", HAS_ARG, QEMU_OPTION_vnc ,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PATCH 9/9] [RfC] stdvga: use graphic_* variables.
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
                   ` (7 preceding siblings ...)
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 8/9] update -g command line switch documentation Gerd Hoffmann
@ 2017-02-21 22:14 ` Gerd Hoffmann
  2017-02-24  8:40 ` [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Mark Cave-Ayland
  9 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-21 22:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

Add two new registers to the qemu extended register range, carrying the
suggested width and height of the display device.  In case the graphic_*
variables are set (via -g switch), fill these new registers accordingly.

Additionally guest driver updates are needed to support the new
registers.  These changes will probably land in linux kernel 4.12.

TODO: add compat properties to turn off qemu-display-size for machine
      types older than 2.9-or-10

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/vga-pci.c    | 52 ++++++++++++++++++++++++++++++++++---------------
 hw/display/vga_int.h    |  4 ++--
 hw/display/virtio-vga.c |  3 ++-
 3 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index ac9a764..78e00df 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -31,23 +31,28 @@
 #include "ui/pixel_ops.h"
 #include "qemu/timer.h"
 #include "hw/loader.h"
+#include "sysemu/sysemu.h"
 
 #define PCI_VGA_IOPORT_OFFSET 0x400
 #define PCI_VGA_IOPORT_SIZE   (0x3e0 - 0x3c0)
 #define PCI_VGA_BOCHS_OFFSET  0x500
 #define PCI_VGA_BOCHS_SIZE    (0x0b * 2)
 #define PCI_VGA_QEXT_OFFSET   0x600
-#define PCI_VGA_QEXT_SIZE     (2 * 4)
+#define PCI_VGA_QEXT_SIZE_V1  (2 * 4)
+#define PCI_VGA_QEXT_SIZE_V2  (4 * 4)
 #define PCI_VGA_MMIO_SIZE     0x1000
 
 #define PCI_VGA_QEXT_REG_SIZE         (0 * 4)
 #define PCI_VGA_QEXT_REG_BYTEORDER    (1 * 4)
 #define  PCI_VGA_QEXT_LITTLE_ENDIAN   0x1e1e1e1e
 #define  PCI_VGA_QEXT_BIG_ENDIAN      0xbebebebe
+#define PCI_VGA_QEXT_REG_WIDTH        (2 * 4)
+#define PCI_VGA_QEXT_REG_HEIGHT       (3 * 4)
 
 enum vga_pci_flags {
-    PCI_VGA_FLAG_ENABLE_MMIO = 1,
-    PCI_VGA_FLAG_ENABLE_QEXT = 2,
+    PCI_VGA_FLAG_ENABLE_MMIO    = 1,
+    PCI_VGA_FLAG_ENABLE_QEXT    = 2,
+    PCI_VGA_FLAG_ENABLE_QEXT_V2 = 3,
 };
 
 typedef struct PCIVGAState {
@@ -157,10 +162,14 @@ static uint64_t pci_vga_qext_read(void *ptr, hwaddr addr, unsigned size)
 
     switch (addr) {
     case PCI_VGA_QEXT_REG_SIZE:
-        return PCI_VGA_QEXT_SIZE;
+        return s->qext_size;
     case PCI_VGA_QEXT_REG_BYTEORDER:
         return s->big_endian_fb ?
             PCI_VGA_QEXT_BIG_ENDIAN : PCI_VGA_QEXT_LITTLE_ENDIAN;
+    case PCI_VGA_QEXT_REG_WIDTH:
+        return graphic_width;
+    case PCI_VGA_QEXT_REG_HEIGHT:
+        return graphic_height;
     default:
         return 0;
     }
@@ -207,8 +216,7 @@ static const MemoryRegionOps pci_vga_qext_ops = {
 
 void pci_std_vga_mmio_region_init(VGACommonState *s,
                                   MemoryRegion *parent,
-                                  MemoryRegion *subs,
-                                  bool qext)
+                                  MemoryRegion *subs)
 {
     memory_region_init_io(&subs[0], NULL, &pci_vga_ioport_ops, s,
                           "vga ioports remapped", PCI_VGA_IOPORT_SIZE);
@@ -220,9 +228,9 @@ void pci_std_vga_mmio_region_init(VGACommonState *s,
     memory_region_add_subregion(parent, PCI_VGA_BOCHS_OFFSET,
                                 &subs[1]);
 
-    if (qext) {
+    if (s->qext_size) {
         memory_region_init_io(&subs[2], NULL, &pci_vga_qext_ops, s,
-                              "qemu extended regs", PCI_VGA_QEXT_SIZE);
+                              "qemu extended regs", s->qext_size);
         memory_region_add_subregion(parent, PCI_VGA_QEXT_OFFSET,
                                     &subs[2]);
     }
@@ -232,7 +240,6 @@ static void pci_std_vga_realize(PCIDevice *dev, Error **errp)
 {
     PCIVGAState *d = PCI_VGA(dev);
     VGACommonState *s = &d->vga;
-    bool qext = false;
 
     /* vga + console init */
     vga_common_init(s, OBJECT(dev), true);
@@ -249,10 +256,15 @@ static void pci_std_vga_realize(PCIDevice *dev, Error **errp)
         memory_region_init(&d->mmio, NULL, "vga.mmio", 4096);
 
         if (d->flags & (1 << PCI_VGA_FLAG_ENABLE_QEXT)) {
-            qext = true;
-            pci_set_byte(&d->dev.config[PCI_REVISION_ID], 2);
+            if (d->flags & (1 << PCI_VGA_FLAG_ENABLE_QEXT_V2)) {
+                s->qext_size = PCI_VGA_QEXT_SIZE_V2;
+                pci_set_byte(&d->dev.config[PCI_REVISION_ID], 3);
+            } else {
+                s->qext_size = PCI_VGA_QEXT_SIZE_V1;
+                pci_set_byte(&d->dev.config[PCI_REVISION_ID], 2);
+            }
         }
-        pci_std_vga_mmio_region_init(s, &d->mmio, d->mrs, qext);
+        pci_std_vga_mmio_region_init(s, &d->mmio, d->mrs);
 
         pci_register_bar(&d->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mmio);
     }
@@ -274,7 +286,6 @@ static void pci_secondary_vga_realize(PCIDevice *dev, Error **errp)
 {
     PCIVGAState *d = PCI_VGA(dev);
     VGACommonState *s = &d->vga;
-    bool qext = false;
 
     /* vga + console init */
     vga_common_init(s, OBJECT(dev), false);
@@ -284,10 +295,15 @@ static void pci_secondary_vga_realize(PCIDevice *dev, Error **errp)
     memory_region_init(&d->mmio, OBJECT(dev), "vga.mmio", 4096);
 
     if (d->flags & (1 << PCI_VGA_FLAG_ENABLE_QEXT)) {
-        qext = true;
-        pci_set_byte(&d->dev.config[PCI_REVISION_ID], 2);
+        if (d->flags & (1 << PCI_VGA_FLAG_ENABLE_QEXT_V2)) {
+            s->qext_size = PCI_VGA_QEXT_SIZE_V2;
+            pci_set_byte(&d->dev.config[PCI_REVISION_ID], 3);
+        } else {
+            s->qext_size = PCI_VGA_QEXT_SIZE_V1;
+            pci_set_byte(&d->dev.config[PCI_REVISION_ID], 2);
+        }
     }
-    pci_std_vga_mmio_region_init(s, &d->mmio, d->mrs, qext);
+    pci_std_vga_mmio_region_init(s, &d->mmio, d->mrs);
 
     pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->vram);
     pci_register_bar(&d->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mmio);
@@ -311,6 +327,8 @@ static Property vga_pci_properties[] = {
     DEFINE_PROP_BIT("mmio", PCIVGAState, flags, PCI_VGA_FLAG_ENABLE_MMIO, true),
     DEFINE_PROP_BIT("qemu-extended-regs",
                     PCIVGAState, flags, PCI_VGA_FLAG_ENABLE_QEXT, true),
+    DEFINE_PROP_BIT("qemu-display-size",
+                    PCIVGAState, flags, PCI_VGA_FLAG_ENABLE_QEXT_V2, true),
     DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -318,6 +336,8 @@ static Property secondary_pci_properties[] = {
     DEFINE_PROP_UINT32("vgamem_mb", PCIVGAState, vga.vram_size_mb, 16),
     DEFINE_PROP_BIT("qemu-extended-regs",
                     PCIVGAState, flags, PCI_VGA_FLAG_ENABLE_QEXT, true),
+    DEFINE_PROP_BIT("qemu-display-size",
+                    PCIVGAState, flags, PCI_VGA_FLAG_ENABLE_QEXT_V2, true),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index dd6c958..51217cf 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -162,6 +162,7 @@ typedef struct VGACommonState {
     bool full_update_gfx;
     bool big_endian_fb;
     bool default_endian_fb;
+    uint32_t qext_size;
     /* hardware mouse cursor support */
     uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32];
     uint32_t hw_cursor_x;
@@ -223,7 +224,6 @@ extern const MemoryRegionOps vga_mem_ops;
 /* vga-pci.c */
 void pci_std_vga_mmio_region_init(VGACommonState *s,
                                   MemoryRegion *parent,
-                                  MemoryRegion *subs,
-                                  bool qext);
+                                  MemoryRegion *subs);
 
 #endif
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index f9b017d..8684dc0 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -153,8 +153,9 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
     }
 
     /* add stdvga mmio regions */
+    vga->qext_size = 2 * 4; /* PCI_VGA_QEXT_SIZE_V1 */
     pci_std_vga_mmio_region_init(vga, &vpci_dev->modern_bar,
-                                 vvga->vga_mrs, true);
+                                 vvga->vga_mrs);
 
     vga->con = g->scanout[0].con;
     graphic_console_set_hwops(vga->con, &virtio_vga_ops, vvga);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 3/9] ppc: use ppc_graphic_* defines
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 3/9] ppc: use ppc_graphic_* defines Gerd Hoffmann
@ 2017-02-21 22:45   ` Hervé Poussineau
  2017-02-22  1:11   ` David Gibson
  1 sibling, 0 replies; 20+ messages in thread
From: Hervé Poussineau @ 2017-02-21 22:45 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel
  Cc: Alexander Graf, David Gibson, open list:New World

Le 21/02/2017 à 23:14, Gerd Hoffmann a écrit :
> This switches over ppc to use the new ppc_graphic_* defines.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/ppc/mac_newworld.c |  6 +++---
>  hw/ppc/mac_oldworld.c |  6 +++---
>  hw/ppc/prep.c         | 10 +++++-----
>  hw/ppc/spapr.c        |  6 +++---
>  4 files changed, 14 insertions(+), 14 deletions(-)

Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 8/9] update -g command line switch documentation
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 8/9] update -g command line switch documentation Gerd Hoffmann
@ 2017-02-22  0:37   ` Laszlo Ersek
  0 siblings, 0 replies; 20+ messages in thread
From: Laszlo Ersek @ 2017-02-22  0:37 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel

On 02/21/17 23:14, Gerd Hoffmann wrote:
> Bring documentation in line with the recent changes.
> Text suggested by László Érsek.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  qemu-options.hx | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 4e89610..ae62e0d 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1241,7 +1241,18 @@ DEF("g", 1, QEMU_OPTION_g ,
>  STEXI
>  @item -g @var{width}x@var{height}[x@var{depth}]
>  @findex -g
> -Set the initial graphical resolution and depth (PPC, SPARC only).
> +Set the initial graphical resolution and depth.
> +
> +This setting may be masked by guest firmware temporarily.
> +
> +On PPC and SPARC, the guest firmware will configure the display from
> +this setting, and the guest OS will inherit the display resolution
> +and depth.
> +
> +On x86 and ARM, if the guest firmware is an edk2 (UEFI) platform,
> +the firmware may initially configure the display according to its own,
> +persistent, independent settings. The guest OS drivers, once loaded,
> +should adhere to "-g" however, for virtio and qxl adapters.

I think I made a small mistake here in my earlier suggestion; I think I
should have restricted qxl to x86 only, something like:

  ... should adhere to "-g" however, for virtio (x86, ARM) and qxl
  (x86 only) adapters

Lest we appear to suggest that QXL will ever be available in aarch64
guests :)

>  ETEXI
>  
>  DEF("vnc", HAS_ARG, QEMU_OPTION_vnc ,
> 

Looks good to me (and thank you for considering my response earlier).
With the above tweak:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Furthermore, once patch #9 becomes a real patch, this documentation
should be updated again, adding "VGA (x86 only)" as well.

Thanks!
Laszlo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 3/9] ppc: use ppc_graphic_* defines
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 3/9] ppc: use ppc_graphic_* defines Gerd Hoffmann
  2017-02-21 22:45   ` Hervé Poussineau
@ 2017-02-22  1:11   ` David Gibson
  1 sibling, 0 replies; 20+ messages in thread
From: David Gibson @ 2017-02-22  1:11 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: qemu-devel, Alexander Graf, Hervé Poussineau, open list:New World

[-- Attachment #1: Type: text/plain, Size: 5219 bytes --]

On Tue, Feb 21, 2017 at 11:14:53PM +0100, Gerd Hoffmann wrote:
> This switches over ppc to use the new ppc_graphic_* defines.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

Of course, the idea of a per-arch, rather than per-machine, default
graphics size is nuts, but this change doesn't make it any worse than
it already is.

> ---
>  hw/ppc/mac_newworld.c |  6 +++---
>  hw/ppc/mac_oldworld.c |  6 +++---
>  hw/ppc/prep.c         | 10 +++++-----
>  hw/ppc/spapr.c        |  6 +++---
>  4 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index 2bfdb64..4722277 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -482,9 +482,9 @@ static void ppc_core99_init(MachineState *machine)
>      fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
>  
> -    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
> -    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
> -    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
> +    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, ppc_graphic_width);
> +    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, ppc_graphic_height);
> +    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, ppc_graphic_depth);
>  
>      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
>      if (kvm_enabled()) {
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 56282c5..a79f011 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -335,9 +335,9 @@ static void ppc_heathrow_init(MachineState *machine)
>      fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
>  
> -    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
> -    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
> -    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
> +    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, ppc_graphic_width);
> +    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, ppc_graphic_height);
> +    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, ppc_graphic_depth);
>  
>      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
>      if (kvm_enabled()) {
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index ca7959c..82bf6b5 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -677,7 +677,7 @@ static void ppc_prep_init(MachineState *machine)
>                           initrd_base, initrd_size,
>                           /* XXX: need an option to load a NVRAM image */
>                           0,
> -                         graphic_width, graphic_height, graphic_depth);
> +                         ppc_graphic_width, ppc_graphic_height, ppc_graphic_depth);
>  }
>  
>  static void prep_machine_init(MachineClass *mc)
> @@ -861,9 +861,9 @@ static void ibm_40p_init(MachineState *machine)
>      fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
>      fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_PREP);
>  
> -    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
> -    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
> -    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
> +    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, ppc_graphic_width);
> +    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, ppc_graphic_height);
> +    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, ppc_graphic_depth);
>  
>      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
>      if (kvm_enabled()) {
> @@ -891,7 +891,7 @@ static void ibm_40p_init(MachineState *machine)
>                               initrd_base, initrd_size,
>                               /* XXX: need an option to load a NVRAM image */
>                               0,
> -                             graphic_width, graphic_height, graphic_depth);
> +                             ppc_graphic_width, ppc_graphic_height, ppc_graphic_depth);
>      }
>  }
>  
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index e465d7a..ba8f81e 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -824,9 +824,9 @@ static void spapr_dt_chosen(sPAPRMachineState *spapr, void *fdt)
>      if (boot_menu) {
>          _FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", boot_menu)));
>      }
> -    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_width));
> -    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_height));
> -    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_depth));
> +    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", ppc_graphic_width));
> +    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", ppc_graphic_height));
> +    _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", ppc_graphic_depth));
>  
>      if (cb && bootlist) {
>          int i;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl.
  2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
                   ` (8 preceding siblings ...)
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 9/9] [RfC] stdvga: use graphic_* variables Gerd Hoffmann
@ 2017-02-24  8:40 ` Mark Cave-Ayland
  2017-02-24 13:30   ` Gerd Hoffmann
  9 siblings, 1 reply; 20+ messages in thread
From: Mark Cave-Ayland @ 2017-02-24  8:40 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel

On 21/02/17 22:14, Gerd Hoffmann wrote:

>   Hi,
> 
> Made a nice patch series out of it, first cleaning up graphics_* variables,
> then adding support for -g to virtio (just works), qxl (needs guest driver
> fixes) and stdvga (needs virtual hardware update, and therefore also an
> guest driver update for obvious reasons).
> 
> linux kernel patches to test qxl and stdvga are here:
>   https://www.kraxel.org/cgit/linux/log/?h=qxl-display-size
> 
> please review & test,
>   Gerd

Interestingly enough, there have been recent discussions from the guys
over at emaculation as to whether it would be possible to pass in valid
resolutions from the host graphics driver for full-screen MacOS 9
emulation in QEMU.

With this patchset I believe Ben's OS 9 VGA driver could read the
suggested resolution from the command line via the QEMU extended VGA
registers, so I'm wondering if it would make sense to have a similar
mechanism for passing in a range of resolutions from the local video
driver that could be offered by the guest driver? Or is the normal guest
driver behaviour to just offer the standard set of *GA resolutions plus
whatever custom resolution is supplied via -g?


ATB,

Mark.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables.
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables Gerd Hoffmann
@ 2017-02-24  9:21   ` Paolo Bonzini
  2017-02-24 14:15     ` Gerd Hoffmann
  0 siblings, 1 reply; 20+ messages in thread
From: Paolo Bonzini @ 2017-02-24  9:21 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel; +Cc: Michael S. Tsirkin



On 21/02/2017 23:14, Gerd Hoffmann wrote:
> If graphic_* variables are set (via -g switch), pass on
> that information to the guest so the driver can use it.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/display/virtio-gpu.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> 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;
> +    }

What about adding properties for this, and only using graphic_* as a
fallback?

Paolo

>      if (virtio_gpu_virgl_enabled(g->conf)) {
>          /* use larger control queue in 3d mode */
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 7/9] qxl: use graphic_* variables.
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 7/9] qxl: " Gerd Hoffmann
@ 2017-02-24  9:21   ` Paolo Bonzini
  0 siblings, 0 replies; 20+ messages in thread
From: Paolo Bonzini @ 2017-02-24  9:21 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel



On 21/02/2017 23:14, Gerd Hoffmann wrote:
>  
> +    if (graphic_width && graphic_height) {
> +        /* needs linux kernel 4.12+ to work */
> +        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 = cpu_to_le32(graphic_width);
> +        rom->client_monitors_config.heads[0].bottom = cpu_to_le32(graphic_height);
> +        rom->client_monitors_config_crc = qxl_crc32(
> +            (const uint8_t *)&rom->client_monitors_config,
> +            sizeof(rom->client_monitors_config));
> +    }
> +

Same here.

Paolo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl.
  2017-02-24  8:40 ` [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Mark Cave-Ayland
@ 2017-02-24 13:30   ` Gerd Hoffmann
  0 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-24 13:30 UTC (permalink / raw)
  To: Mark Cave-Ayland; +Cc: qemu-devel

  Hi,

> With this patchset I believe Ben's OS 9 VGA driver could read the
> suggested resolution from the command line via the QEMU extended VGA
> registers,

Yes.

> so I'm wondering if it would make sense to have a similar
> mechanism for passing in a range of resolutions from the local video
> driver that could be offered by the guest driver? Or is the normal guest
> driver behaviour to just offer the standard set of *GA resolutions plus
> whatever custom resolution is supplied via -g?

The linux kms drivers simply use the kernel's mode database, to provide
a list of standard resolutions.  Additionally you also can define your
own resolutions, using xrandr --newmode & --addmode).

If we want go beyond passing a simple "please use <width>y<height>" we
probably should generate a edid block and pass that to the guest, but I
don't see a strong reason to do so.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables.
  2017-02-24  9:21   ` Paolo Bonzini
@ 2017-02-24 14:15     ` Gerd Hoffmann
  0 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2017-02-24 14:15 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, Michael S. Tsirkin

  Hi,

> > +    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;
> > +    }
> 
> What about adding properties for this, and only using graphic_* as a
> fallback?

Hmm, I guess in that case I'd prefer to not use graphic_* at all ...

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 1/9] sysemu: add defines for sparc & ppc graphics_*
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 1/9] sysemu: add defines for sparc & ppc graphics_* Gerd Hoffmann
@ 2017-02-28 14:50   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2017-02-28 14:50 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel; +Cc: qemu-ppc

On 21.02.2017 23:14, Gerd Hoffmann wrote:
> Add defines for the sparc and ppc arch specific graphics defaults.
> They return the graphic_* values these variables are non-zero, and
> the default values otherwise.
> 
> After switching over ppc and sparc to use these we don't need the
> arch-specific initialization for the graphic_* variables any more.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  include/sysemu/sysemu.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 576c7ce..9450788 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -142,9 +142,16 @@ typedef enum {
>  extern int vga_interface_type;
>  #define xenfb_enabled (vga_interface_type == VGA_XENFB)
>  
> +#define sparc_graphic_width  (graphic_width  ? graphic_width  : 1024)
> +#define sparc_graphic_height (graphic_height ? graphic_height :  768)
> +#define sparc_graphic_depth  (graphic_depth  ? graphic_depth  :    8)
> +#define ppc_graphic_width    (graphic_width  ? graphic_width  :  800)
> +#define ppc_graphic_height   (graphic_height ? graphic_height :  600)
> +#define ppc_graphic_depth    (graphic_depth  ? graphic_depth  :   32)

I have to say that I really dislike the idea to hide this logic in such
macros. Could we please do it without such macros, i.e. by just adding
some code a la
	if (!graphic_width) {
		graphic_width = 800;
	}
to the right machine_init() functions instead?

 Thomas

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PATCH 5/9] enable -g command line switch for all archs
  2017-02-21 22:14 ` [Qemu-devel] [PATCH 5/9] enable -g command line switch for all archs Gerd Hoffmann
@ 2017-02-28 14:53   ` Thomas Huth
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Huth @ 2017-02-28 14:53 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel

On 21.02.2017 23:14, Gerd Hoffmann wrote:
> Virtual display adapters will learn to use graphic_* variables
> (which are set by the -g switch), so enable this for all archs.
> 
> RfC:  Maybe restrict to PCI-capable archs?
>       Or would that be pretty much anything anyway?

I think there could also be systems without PCI, but with graphics card,
so limiting it to PCI-capable systems seems also wrong to me.

 Thomas

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-02-28 14:53 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21 22:14 [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Gerd Hoffmann
2017-02-21 22:14 ` [Qemu-devel] [PATCH 1/9] sysemu: add defines for sparc & ppc graphics_* Gerd Hoffmann
2017-02-28 14:50   ` Thomas Huth
2017-02-21 22:14 ` [Qemu-devel] [PATCH 2/9] sparc: use sparc_graphic_* defines Gerd Hoffmann
2017-02-21 22:14 ` [Qemu-devel] [PATCH 3/9] ppc: use ppc_graphic_* defines Gerd Hoffmann
2017-02-21 22:45   ` Hervé Poussineau
2017-02-22  1:11   ` David Gibson
2017-02-21 22:14 ` [Qemu-devel] [PATCH 4/9] drop arch-specific graphic_* initialization Gerd Hoffmann
2017-02-21 22:14 ` [Qemu-devel] [PATCH 5/9] enable -g command line switch for all archs Gerd Hoffmann
2017-02-28 14:53   ` Thomas Huth
2017-02-21 22:14 ` [Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables Gerd Hoffmann
2017-02-24  9:21   ` Paolo Bonzini
2017-02-24 14:15     ` Gerd Hoffmann
2017-02-21 22:14 ` [Qemu-devel] [PATCH 7/9] qxl: " Gerd Hoffmann
2017-02-24  9:21   ` Paolo Bonzini
2017-02-21 22:14 ` [Qemu-devel] [PATCH 8/9] update -g command line switch documentation Gerd Hoffmann
2017-02-22  0:37   ` Laszlo Ersek
2017-02-21 22:14 ` [Qemu-devel] [PATCH 9/9] [RfC] stdvga: use graphic_* variables Gerd Hoffmann
2017-02-24  8:40 ` [Qemu-devel] [PATCH 0/9] wire up -g <width>x<height> switch for virtio and qxl Mark Cave-Ayland
2017-02-24 13:30   ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.