virtio-gpu: add xres and yres properties
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 21 Apr 2017 09:22:14 +0000 (11:22 +0200)
committerMateusz Majewski <m.majewski2@samsung.com>
Tue, 25 Mar 2025 13:52:30 +0000 (14:52 +0100)
So the default resolution is configurable.

Change-Id: Id022201a40c2ac682d7868de22f6562f1e177e79
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20170421092214.8176-1-kraxel@redhat.com
(cherry picked from commit 729abb6a920e80c3866f60d1638f08f2eba98a9a)

hw/display/virtio-gpu.c
include/hw/virtio/virtio-gpu.h

index bcc9bde2cd62af1de711799ce47e7d866ffd437d..0e82cb56249c32252ebc0a9dcdffe81c1f050630 100644 (file)
@@ -1119,8 +1119,8 @@ 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;
+    g->req_state[0].width = g->conf.xres;
+    g->req_state[0].height = g->conf.yres;
 
     g->use_virgl_renderer = false;
 #if !defined(CONFIG_VIRGL) || defined(HOST_WORDS_BIGENDIAN)
@@ -1253,6 +1253,8 @@ static Property virtio_gpu_properties[] = {
     DEFINE_PROP_BIT("stats", VirtIOGPU, conf.flags,
                     VIRTIO_GPU_FLAG_STATS_ENABLED, false),
 #endif
+    DEFINE_PROP_UINT32("xres", VirtIOGPU, conf.xres, 1024),
+    DEFINE_PROP_UINT32("yres", VirtIOGPU, conf.yres, 768),
     DEFINE_PROP_END_OF_LIST(),
 };
 
index 20d1cd683a56eb87b67674c149e30e545e014a5e..8be645bb8b12f5908f38c4032b7a2951da203f08 100644 (file)
@@ -70,6 +70,8 @@ enum virtio_gpu_conf_flags {
 struct virtio_gpu_conf {
     uint32_t max_outputs;
     uint32_t flags;
+    uint32_t xres;
+    uint32_t yres;
 };
 
 struct virtio_gpu_ctrl_command {