[Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables.

Gerd Hoffmann posted 9 patches 8 years, 8 months ago
[Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables.
Posted by Gerd Hoffmann 8 years, 8 months ago
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


Re: [Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables.
Posted by Paolo Bonzini 8 years, 8 months ago

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

Re: [Qemu-devel] [PATCH 6/9] virtio-gpu: use graphic_* variables.
Posted by Gerd Hoffmann 8 years, 8 months ago
  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