aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-09-29 12:03:06 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-09-29 12:03:06 +0100
commit5663ac2aa0eafb40411ac4dff85e6ab529c4d199 (patch)
tree233ab02490625bf4ab4cb59a46f2cb620c72c952 /hw
parent213057383c9f73a17cfe635b204d88e11f918df1 (diff)
parent97a0530bb71fb96468f218b622cd840e2c667bf6 (diff)
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20200929-pull-request' into staging
virtio-vga: reset fix, bigendian fix. virtio-vga+spice: set monitor dimension via edid. # gpg: Signature made Tue 29 Sep 2020 10:57:01 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/vga-20200929-pull-request: ppc/pseries: enable big-endian-framebuffer quirk for bochs-display and virtio-vga virtio-vga: implement big-endian-framebuffer property virtio-gpu: set physical dimensions for EDID spice: get monitors physical dimension spice: remove the single monitor config logic ui: add getter for UIInfo edid: use physical dimensions if available edid: fix physical display size computation virtio-gpu-3d: fix abnormal display after a warm reboot Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/display/edid-generate.c36
-rw-r--r--hw/display/virtio-gpu-3d.c2
-rw-r--r--hw/display/virtio-gpu-base.c2
-rw-r--r--hw/display/virtio-gpu.c2
-rw-r--r--hw/display/virtio-vga.c19
-rw-r--r--hw/ppc/spapr_pci.c4
6 files changed, 52 insertions, 13 deletions
diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index e58472fde5..1665b7cbb2 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -205,12 +205,8 @@ static void edid_desc_dummy(uint8_t *desc)
static void edid_desc_timing(uint8_t *desc,
uint32_t xres, uint32_t yres,
- uint32_t dpi)
+ uint32_t xmm, uint32_t ymm)
{
- /* physical display size */
- uint32_t xmm = xres * dpi / 254;
- uint32_t ymm = yres * dpi / 254;
-
/* pull some realistic looking timings out of thin air */
uint32_t xfront = xres * 25 / 100;
uint32_t xsync = xres * 3 / 100;
@@ -290,12 +286,24 @@ static void edid_colorspace(uint8_t *edid,
edid[34] = white_y >> 2;
}
+static uint32_t qemu_edid_dpi_from_mm(uint32_t mm, uint32_t res)
+{
+ return res * 254 / 10 / mm;
+}
+
+uint32_t qemu_edid_dpi_to_mm(uint32_t dpi, uint32_t res)
+{
+ return res * 254 / 10 / dpi;
+}
+
void qemu_edid_generate(uint8_t *edid, size_t size,
qemu_edid_info *info)
{
uint32_t desc = 54;
uint8_t *xtra3 = NULL;
uint8_t *dta = NULL;
+ uint32_t width_mm, height_mm;
+ uint32_t dpi = 100; /* if no width_mm/height_mm */
/* =============== set defaults =============== */
@@ -305,15 +313,20 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
if (!info->name) {
info->name = "QEMU Monitor";
}
- if (!info->dpi) {
- info->dpi = 100;
- }
if (!info->prefx) {
info->prefx = 1024;
}
if (!info->prefy) {
info->prefy = 768;
}
+ if (info->width_mm && info->height_mm) {
+ width_mm = info->width_mm;
+ height_mm = info->height_mm;
+ dpi = qemu_edid_dpi_from_mm(width_mm, info->prefx);
+ } else {
+ width_mm = qemu_edid_dpi_to_mm(dpi, info->prefx);
+ height_mm = qemu_edid_dpi_to_mm(dpi, info->prefy);
+ }
/* =============== extensions =============== */
@@ -360,8 +373,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
edid[20] = 0xa5;
/* screen size: undefined */
- edid[21] = info->prefx * 254 / 100 / info->dpi;
- edid[22] = info->prefy * 254 / 100 / info->dpi;
+ edid[21] = width_mm / 10;
+ edid[22] = height_mm / 10;
/* display gamma: 2.2 */
edid[23] = 220 - 100;
@@ -387,7 +400,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
/* =============== descriptor blocks =============== */
- edid_desc_timing(edid + desc, info->prefx, info->prefy, info->dpi);
+ edid_desc_timing(edid + desc, info->prefx, info->prefy,
+ width_mm, height_mm);
desc += 18;
edid_desc_ranges(edid + desc);
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index 96621576c2..1bd33d7aed 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -595,7 +595,7 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g)
{
int i;
- /* virgl_renderer_reset() ??? */
+ virgl_renderer_reset();
for (i = 0; i < g->parent_obj.conf.max_outputs; i++) {
if (i != 0) {
dpy_gfx_replace_surface(g->parent_obj.scanout[i].con, NULL);
diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index aeb8723542..40ccd00f94 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -82,6 +82,8 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
g->req_state[idx].y = info->yoff;
g->req_state[idx].width = info->width;
g->req_state[idx].height = info->height;
+ g->req_state[idx].width_mm = info->width_mm;
+ g->req_state[idx].height_mm = info->height_mm;
if (info->width && info->height) {
g->enabled_output_bitmask |= (1 << idx);
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 90be4e3ed7..f3b71fa9c7 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -212,6 +212,8 @@ virtio_gpu_generate_edid(VirtIOGPU *g, int scanout,
{
VirtIOGPUBase *b = VIRTIO_GPU_BASE(g);
qemu_edid_info info = {
+ .width_mm = b->req_state[scanout].width_mm,
+ .height_mm = b->req_state[scanout].height_mm,
.prefx = b->req_state[scanout].width,
.prefy = b->req_state[scanout].height,
};
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index f9410a0c2e..81f776ee36 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -168,6 +168,20 @@ static void virtio_vga_base_reset(DeviceState *dev)
vga_dirty_log_start(&vvga->vga);
}
+static bool virtio_vga_get_big_endian_fb(Object *obj, Error **errp)
+{
+ VirtIOVGABase *d = VIRTIO_VGA_BASE(obj);
+
+ return d->vga.big_endian_fb;
+}
+
+static void virtio_vga_set_big_endian_fb(Object *obj, bool value, Error **errp)
+{
+ VirtIOVGABase *d = VIRTIO_VGA_BASE(obj);
+
+ d->vga.big_endian_fb = value;
+}
+
static Property virtio_vga_base_properties[] = {
DEFINE_VIRTIO_GPU_PCI_PROPERTIES(VirtIOPCIProxy),
DEFINE_PROP_END_OF_LIST(),
@@ -190,6 +204,11 @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data)
k->realize = virtio_vga_base_realize;
pcidev_k->romfile = "vgabios-virtio.bin";
pcidev_k->class_id = PCI_CLASS_DISPLAY_VGA;
+
+ /* Expose framebuffer byteorder via QOM */
+ object_class_property_add_bool(klass, "big-endian-framebuffer",
+ virtio_vga_get_big_endian_fb,
+ virtio_vga_set_big_endian_fb);
}
static TypeInfo virtio_vga_base_info = {
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 4d97ff6c70..5db912b48c 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -2464,7 +2464,9 @@ static int spapr_switch_one_vga(DeviceState *dev, void *opaque)
bool be = *(bool *)opaque;
if (object_dynamic_cast(OBJECT(dev), "VGA")
- || object_dynamic_cast(OBJECT(dev), "secondary-vga")) {
+ || object_dynamic_cast(OBJECT(dev), "secondary-vga")
+ || object_dynamic_cast(OBJECT(dev), "bochs-display")
+ || object_dynamic_cast(OBJECT(dev), "virtio-vga")) {
object_property_set_bool(OBJECT(dev), "big-endian-framebuffer", be,
&error_abort);
}