qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/1] Support per-head resolutions with virtio-gpu
@ 2025-09-02 14:13 Andrew Keesler
  2025-09-02 14:13 ` [PATCH v3 1/1] " Andrew Keesler
  2025-10-01 17:42 ` [PATCH v3 0/1] " Alex Bennée
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Keesler @ 2025-09-02 14:13 UTC (permalink / raw)
  To: berrange, marcandre.lureau; +Cc: qemu-devel, Andrew Keesler

In 454f4b0f, we started down the path of supporting separate
configurations per display head (e.g., you have 2 heads - one with
EDID name "AAA" and the other with EDID name "BBB").

In this change, we add resolution to this configuration surface (e.g.,
you have 2 heads - one with resolution 111x222 and the other with
resolution 333x444).

  -display vnc=localhost:0,id=aaa,display=vga,head=0 \
  -display vnc=localhost:1,id=bbb,display=vga,head=1 \
  -device '{"driver":"virtio-vga",
            "max_outputs":2,
            "id":"vga",
            "outputs":[
              {
                 "name":"AAA",
                 "xres":111,
                 "yres":222
              },
              {
                 "name":"BBB",
                 "xres":333,
                 "yres":444
              }
            ]}'

Here is the behavior matrix of the current resolution configuration
surface (xres/yres) with the new resolution configuration surface
(outputs[i].xres/yres).

Case: !(xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
Behavior: current behavior - outputs[0] enabled with default xres/yres

Case: (xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
Behavior: current behavior - outputs[0] enabled with xres/yres

Case: !(xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres

Case: (xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres

Changelist:
* v3: changes after v2 review
  * fix new resolution configuration logic (&& instead of ||)
  * correct use of api machinery (has_*)
  * move documentation to QMP API
* v2: changes after v1 review + 10.2 rebase
  * updated code, commit message, and cover letter to match new res config logic
  * marked new VirtIOGPUOutput fields as optional and since 10.2
* v1: initial patch

Andrew Keesler (1):
  Support per-head resolutions with virtio-gpu

 hw/display/virtio-gpu-base.c | 10 ++++++++++
 qapi/virtio.json             | 10 ++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

-- 
2.51.0.338.gd7d06c2dae-goog



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

* [PATCH v3 1/1] Support per-head resolutions with virtio-gpu
  2025-09-02 14:13 [PATCH v3 0/1] Support per-head resolutions with virtio-gpu Andrew Keesler
@ 2025-09-02 14:13 ` Andrew Keesler
  2025-09-09  9:17   ` Daniel P. Berrangé
  2025-09-09  9:19   ` Daniel P. Berrangé
  2025-10-01 17:42 ` [PATCH v3 0/1] " Alex Bennée
  1 sibling, 2 replies; 6+ messages in thread
From: Andrew Keesler @ 2025-09-02 14:13 UTC (permalink / raw)
  To: berrange, marcandre.lureau; +Cc: qemu-devel, Andrew Keesler

In 454f4b0f, we started down the path of supporting separate
configurations per display head (e.g., you have 2 heads - one with
EDID name "AAA" and the other with EDID name "BBB").

In this change, we add resolution to this configuration surface (e.g.,
you have 2 heads - one with resolution 111x222 and the other with
resolution 333x444).

  -display vnc=localhost:0,id=aaa,display=vga,head=0 \
  -display vnc=localhost:1,id=bbb,display=vga,head=1 \
  -device '{"driver":"virtio-vga",
            "max_outputs":2,
            "id":"vga",
            "outputs":[
              {
                 "name":"AAA",
                 "xres":111,
                 "yres":222
              },
              {
                 "name":"BBB",
                 "xres":333,
                 "yres":444
              }
            ]}'

Here is the behavior matrix of the current resolution configuration
surface (xres/yres) with the new resolution configuration surface
(outputs[i].xres/yres).

Case: !(xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
Behavior: current behavior - outputs[0] enabled with default xres/yres

Case: (xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
Behavior: current behavior - outputs[0] enabled with xres/yres

Case: !(xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres

Case: (xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres
---
 hw/display/virtio-gpu-base.c | 10 ++++++++++
 qapi/virtio.json             | 10 ++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index 7269477a1c..6adb5312a4 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -233,6 +233,16 @@ virtio_gpu_base_device_realize(DeviceState *qdev,
     g->req_state[0].width = g->conf.xres;
     g->req_state[0].height = g->conf.yres;
 
+    for (output_idx = 0, node = g->conf.outputs;
+         node && output_idx < g->conf.max_outputs;
+         output_idx++, node = node->next) {
+        if (node->value->has_xres && node->value->has_yres) {
+            g->enabled_output_bitmask |= (1 << output_idx);
+            g->req_state[output_idx].width = node->value->xres;
+            g->req_state[output_idx].height = node->value->yres;
+        }
+    }
+
     g->hw_ops = &virtio_gpu_ops;
     for (i = 0; i < g->conf.max_outputs; i++) {
         g->scanout[i].con =
diff --git a/qapi/virtio.json b/qapi/virtio.json
index 9d652fe4a8..9469c63e81 100644
--- a/qapi/virtio.json
+++ b/qapi/virtio.json
@@ -966,15 +966,21 @@
 ##
 # @VirtIOGPUOutput:
 #
-# Describes configuration of a VirtIO GPU output.
+# Describes configuration of a VirtIO GPU output. If both xres and
+# yres are set, they take precedence over root virtio-gpu
+# resolution configuration and enable the corresponding output.
 #
 # @name: the name of the output
 #
+# @xres: horizontal resolution of the output in pixels (since 10.2)
+#
+# @yres: vertical resolution of the output in pixels (since 10.2)
+#
 # Since: 10.1
 ##
 
 { 'struct': 'VirtIOGPUOutput',
-  'data': { 'name': 'str' } }
+  'data': { 'name': 'str', '*xres': 'uint16', '*yres': 'uint16' } }
 
 ##
 # @DummyVirtioForceArrays:
-- 
2.51.0.338.gd7d06c2dae-goog



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

* Re: [PATCH v3 1/1] Support per-head resolutions with virtio-gpu
  2025-09-02 14:13 ` [PATCH v3 1/1] " Andrew Keesler
@ 2025-09-09  9:17   ` Daniel P. Berrangé
  2025-09-09  9:19   ` Daniel P. Berrangé
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel P. Berrangé @ 2025-09-09  9:17 UTC (permalink / raw)
  To: Andrew Keesler; +Cc: marcandre.lureau, qemu-devel

On Tue, Sep 02, 2025 at 02:13:12PM +0000, Andrew Keesler wrote:
> In 454f4b0f, we started down the path of supporting separate
> configurations per display head (e.g., you have 2 heads - one with
> EDID name "AAA" and the other with EDID name "BBB").
> 
> In this change, we add resolution to this configuration surface (e.g.,
> you have 2 heads - one with resolution 111x222 and the other with
> resolution 333x444).
> 
>   -display vnc=localhost:0,id=aaa,display=vga,head=0 \
>   -display vnc=localhost:1,id=bbb,display=vga,head=1 \
>   -device '{"driver":"virtio-vga",
>             "max_outputs":2,
>             "id":"vga",
>             "outputs":[
>               {
>                  "name":"AAA",
>                  "xres":111,
>                  "yres":222
>               },
>               {
>                  "name":"BBB",
>                  "xres":333,
>                  "yres":444
>               }
>             ]}'
> 
> Here is the behavior matrix of the current resolution configuration
> surface (xres/yres) with the new resolution configuration surface
> (outputs[i].xres/yres).
> 
> Case: !(xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
> Behavior: current behavior - outputs[0] enabled with default xres/yres
> 
> Case: (xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
> Behavior: current behavior - outputs[0] enabled with xres/yres
> 
> Case: !(xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
> Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres
> 
> Case: (xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
> Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres
> ---
>  hw/display/virtio-gpu-base.c | 10 ++++++++++
>  qapi/virtio.json             | 10 ++++++++--
>  2 files changed, 18 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: [PATCH v3 1/1] Support per-head resolutions with virtio-gpu
  2025-09-02 14:13 ` [PATCH v3 1/1] " Andrew Keesler
  2025-09-09  9:17   ` Daniel P. Berrangé
@ 2025-09-09  9:19   ` Daniel P. Berrangé
  2025-09-09 12:03     ` Andrew Keesler
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel P. Berrangé @ 2025-09-09  9:19 UTC (permalink / raw)
  To: Andrew Keesler; +Cc: marcandre.lureau, qemu-devel

On Tue, Sep 02, 2025 at 02:13:12PM +0000, Andrew Keesler wrote:
> In 454f4b0f, we started down the path of supporting separate
> configurations per display head (e.g., you have 2 heads - one with
> EDID name "AAA" and the other with EDID name "BBB").
> 
> In this change, we add resolution to this configuration surface (e.g.,
> you have 2 heads - one with resolution 111x222 and the other with
> resolution 333x444).
> 
>   -display vnc=localhost:0,id=aaa,display=vga,head=0 \
>   -display vnc=localhost:1,id=bbb,display=vga,head=1 \
>   -device '{"driver":"virtio-vga",
>             "max_outputs":2,
>             "id":"vga",
>             "outputs":[
>               {
>                  "name":"AAA",
>                  "xres":111,
>                  "yres":222
>               },
>               {
>                  "name":"BBB",
>                  "xres":333,
>                  "yres":444
>               }
>             ]}'
> 
> Here is the behavior matrix of the current resolution configuration
> surface (xres/yres) with the new resolution configuration surface
> (outputs[i].xres/yres).
> 
> Case: !(xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
> Behavior: current behavior - outputs[0] enabled with default xres/yres
> 
> Case: (xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
> Behavior: current behavior - outputs[0] enabled with xres/yres
> 
> Case: !(xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
> Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres
> 
> Case: (xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
> Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres

This commit lacks the Signed-off-by line to assert compliance
with the DCO. Assuming  you agree, can you just reply to this
mail with your S-o-b and then I'll queue this.

> ---
>  hw/display/virtio-gpu-base.c | 10 ++++++++++
>  qapi/virtio.json             | 10 ++++++++--
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
> index 7269477a1c..6adb5312a4 100644
> --- a/hw/display/virtio-gpu-base.c
> +++ b/hw/display/virtio-gpu-base.c
> @@ -233,6 +233,16 @@ virtio_gpu_base_device_realize(DeviceState *qdev,
>      g->req_state[0].width = g->conf.xres;
>      g->req_state[0].height = g->conf.yres;
>  
> +    for (output_idx = 0, node = g->conf.outputs;
> +         node && output_idx < g->conf.max_outputs;
> +         output_idx++, node = node->next) {
> +        if (node->value->has_xres && node->value->has_yres) {
> +            g->enabled_output_bitmask |= (1 << output_idx);
> +            g->req_state[output_idx].width = node->value->xres;
> +            g->req_state[output_idx].height = node->value->yres;
> +        }
> +    }
> +
>      g->hw_ops = &virtio_gpu_ops;
>      for (i = 0; i < g->conf.max_outputs; i++) {
>          g->scanout[i].con =
> diff --git a/qapi/virtio.json b/qapi/virtio.json
> index 9d652fe4a8..9469c63e81 100644
> --- a/qapi/virtio.json
> +++ b/qapi/virtio.json
> @@ -966,15 +966,21 @@
>  ##
>  # @VirtIOGPUOutput:
>  #
> -# Describes configuration of a VirtIO GPU output.
> +# Describes configuration of a VirtIO GPU output. If both xres and
> +# yres are set, they take precedence over root virtio-gpu
> +# resolution configuration and enable the corresponding output.
>  #
>  # @name: the name of the output
>  #
> +# @xres: horizontal resolution of the output in pixels (since 10.2)
> +#
> +# @yres: vertical resolution of the output in pixels (since 10.2)
> +#
>  # Since: 10.1
>  ##
>  
>  { 'struct': 'VirtIOGPUOutput',
> -  'data': { 'name': 'str' } }
> +  'data': { 'name': 'str', '*xres': 'uint16', '*yres': 'uint16' } }
>  
>  ##
>  # @DummyVirtioForceArrays:
> -- 
> 2.51.0.338.gd7d06c2dae-goog
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: [PATCH v3 1/1] Support per-head resolutions with virtio-gpu
  2025-09-09  9:19   ` Daniel P. Berrangé
@ 2025-09-09 12:03     ` Andrew Keesler
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Keesler @ 2025-09-09 12:03 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: marcandre.lureau, qemu-devel

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

Signed-off-by: Andrew Keesler <ankeesler@google.com>


On Tue, Sep 9, 2025 at 5:19 AM Daniel P. Berrangé <berrange@redhat.com>
wrote:

> On Tue, Sep 02, 2025 at 02:13:12PM +0000, Andrew Keesler wrote:
> > In 454f4b0f, we started down the path of supporting separate
> > configurations per display head (e.g., you have 2 heads - one with
> > EDID name "AAA" and the other with EDID name "BBB").
> >
> > In this change, we add resolution to this configuration surface (e.g.,
> > you have 2 heads - one with resolution 111x222 and the other with
> > resolution 333x444).
> >
> >   -display vnc=localhost:0,id=aaa,display=vga,head=0 \
> >   -display vnc=localhost:1,id=bbb,display=vga,head=1 \
> >   -device '{"driver":"virtio-vga",
> >             "max_outputs":2,
> >             "id":"vga",
> >             "outputs":[
> >               {
> >                  "name":"AAA",
> >                  "xres":111,
> >                  "yres":222
> >               },
> >               {
> >                  "name":"BBB",
> >                  "xres":333,
> >                  "yres":444
> >               }
> >             ]}'
> >
> > Here is the behavior matrix of the current resolution configuration
> > surface (xres/yres) with the new resolution configuration surface
> > (outputs[i].xres/yres).
> >
> > Case: !(xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
> > Behavior: current behavior - outputs[0] enabled with default xres/yres
> >
> > Case: (xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
> > Behavior: current behavior - outputs[0] enabled with xres/yres
> >
> > Case: !(xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
> > Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres
> >
> > Case: (xres || yres) && (outputs[i].has_xres && outputs[i].has_yres)
> > Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres
>
> This commit lacks the Signed-off-by line to assert compliance
> with the DCO. Assuming  you agree, can you just reply to this
> mail with your S-o-b and then I'll queue this.
>
> > ---
> >  hw/display/virtio-gpu-base.c | 10 ++++++++++
> >  qapi/virtio.json             | 10 ++++++++--
> >  2 files changed, 18 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
> > index 7269477a1c..6adb5312a4 100644
> > --- a/hw/display/virtio-gpu-base.c
> > +++ b/hw/display/virtio-gpu-base.c
> > @@ -233,6 +233,16 @@ virtio_gpu_base_device_realize(DeviceState *qdev,
> >      g->req_state[0].width = g->conf.xres;
> >      g->req_state[0].height = g->conf.yres;
> >
> > +    for (output_idx = 0, node = g->conf.outputs;
> > +         node && output_idx < g->conf.max_outputs;
> > +         output_idx++, node = node->next) {
> > +        if (node->value->has_xres && node->value->has_yres) {
> > +            g->enabled_output_bitmask |= (1 << output_idx);
> > +            g->req_state[output_idx].width = node->value->xres;
> > +            g->req_state[output_idx].height = node->value->yres;
> > +        }
> > +    }
> > +
> >      g->hw_ops = &virtio_gpu_ops;
> >      for (i = 0; i < g->conf.max_outputs; i++) {
> >          g->scanout[i].con =
> > diff --git a/qapi/virtio.json b/qapi/virtio.json
> > index 9d652fe4a8..9469c63e81 100644
> > --- a/qapi/virtio.json
> > +++ b/qapi/virtio.json
> > @@ -966,15 +966,21 @@
> >  ##
> >  # @VirtIOGPUOutput:
> >  #
> > -# Describes configuration of a VirtIO GPU output.
> > +# Describes configuration of a VirtIO GPU output. If both xres and
> > +# yres are set, they take precedence over root virtio-gpu
> > +# resolution configuration and enable the corresponding output.
> >  #
> >  # @name: the name of the output
> >  #
> > +# @xres: horizontal resolution of the output in pixels (since 10.2)
> > +#
> > +# @yres: vertical resolution of the output in pixels (since 10.2)
> > +#
> >  # Since: 10.1
> >  ##
> >
> >  { 'struct': 'VirtIOGPUOutput',
> > -  'data': { 'name': 'str' } }
> > +  'data': { 'name': 'str', '*xres': 'uint16', '*yres': 'uint16' } }
> >
> >  ##
> >  # @DummyVirtioForceArrays:
> > --
> > 2.51.0.338.gd7d06c2dae-goog
> >
>
> With regards,
> Daniel
> --
> |: https://berrange.com      -o-
> https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-
> https://www.instagram.com/dberrange :|
>
>

[-- Attachment #2: Type: text/html, Size: 6553 bytes --]

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

* Re: [PATCH v3 0/1] Support per-head resolutions with virtio-gpu
  2025-09-02 14:13 [PATCH v3 0/1] Support per-head resolutions with virtio-gpu Andrew Keesler
  2025-09-02 14:13 ` [PATCH v3 1/1] " Andrew Keesler
@ 2025-10-01 17:42 ` Alex Bennée
  1 sibling, 0 replies; 6+ messages in thread
From: Alex Bennée @ 2025-10-01 17:42 UTC (permalink / raw)
  To: Andrew Keesler; +Cc: berrange, marcandre.lureau, qemu-devel

Andrew Keesler <ankeesler@google.com> writes:

> In 454f4b0f, we started down the path of supporting separate
> configurations per display head (e.g., you have 2 heads - one with
> EDID name "AAA" and the other with EDID name "BBB").
>
> In this change, we add resolution to this configuration surface (e.g.,
> you have 2 heads - one with resolution 111x222 and the other with
> resolution 333x444).

Queued to virtio-gpu/next, thanks.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

end of thread, other threads:[~2025-10-01 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02 14:13 [PATCH v3 0/1] Support per-head resolutions with virtio-gpu Andrew Keesler
2025-09-02 14:13 ` [PATCH v3 1/1] " Andrew Keesler
2025-09-09  9:17   ` Daniel P. Berrangé
2025-09-09  9:19   ` Daniel P. Berrangé
2025-09-09 12:03     ` Andrew Keesler
2025-10-01 17:42 ` [PATCH v3 0/1] " Alex Bennée

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).