All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] add a refresh_rate option to virtio-gpu
@ 2026-04-15  9:19 slonkazoid via qemu development
  2026-04-15 14:10 ` Akihiko Odaki
  2026-05-24  8:39 ` Michael S. Tsirkin
  0 siblings, 2 replies; 3+ messages in thread
From: slonkazoid via qemu development @ 2026-04-15  9:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Alex Bennée, Akihiko Odaki,
	Dmitry Osipenko, slonkazoid

Signed-off-by: slonkazoid <slonkazoid@slonk.ing>
---
currently, the virtio-gpu module does not set a refresh rate, making it
default to 75Hz in the qemu edid generation logic. i wrote a sloppy patch
that adds a `refresh_rate` option to virtio-gpu, which propagates to all
the devices based on it (i was interested in virtio-vga-gl). it's not of
much use by itself but when combined with something like Sunshine or
looking-glass, it can provide *far* smoother guest graphics than the
inbuilt display devices. i have done a bare minimum amount of manual
testing (virtio-vga-gl with venus XOR amdgpu drm native context streaming
video games) and it functions as intended, and should not break the code
path to fetch the refresh rate from the active display device (?), however,
i have never contributed to QEMU before and i don't know the customs
concerning testing, documentation, etc. if there's more i should do, please
tell me! if this is something that would benefit QEMU, feel free to merge it.
it's probably not a copyrightable change anyways.
---
Changes in v2:
- Update default value of refresh_rate to the old implied default of 75000
- Link to v1: https://lore.kernel.org/qemu-devel/20260414-virtio-gpu-refresh-rate-v1-1-59e6320eb24e@slonk.ing
---
 hw/display/virtio-gpu-base.c   | 1 +
 include/hw/virtio/virtio-gpu.h | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index cb76302e2d..d87f6604d0 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -232,6 +232,7 @@ virtio_gpu_base_device_realize(DeviceState *qdev,
 
     g->req_state[0].width = g->conf.xres;
     g->req_state[0].height = g->conf.yres;
+    g->req_state[0].refresh_rate = g->conf.refresh_rate;
 
     for (output_idx = 0, node = g->conf.outputs;
          node && output_idx < g->conf.max_outputs;
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index f69fc19462..e440535fa0 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -131,6 +131,7 @@ struct virtio_gpu_base_conf {
     uint32_t flags;
     uint32_t xres;
     uint32_t yres;
+    uint32_t refresh_rate;
     uint64_t hostmem;
     VirtIOGPUOutputList *outputs;
 };
@@ -176,7 +177,8 @@ struct VirtIOGPUBaseClass {
     DEFINE_PROP_BIT("edid", _state, _conf.flags, \
                     VIRTIO_GPU_FLAG_EDID_ENABLED, true), \
     DEFINE_PROP_UINT32("xres", _state, _conf.xres, 1280), \
-    DEFINE_PROP_UINT32("yres", _state, _conf.yres, 800)
+    DEFINE_PROP_UINT32("yres", _state, _conf.yres, 800), \
+    DEFINE_PROP_UINT32("refresh_rate", _state, _conf.refresh_rate, 75000)
 
 typedef struct VGPUDMABuf {
     QemuDmaBuf *buf;

---
base-commit: 985062e2319e6bf4a4be9c216ede6d34379e5777
change-id: 20260414-virtio-gpu-refresh-rate-37b388e7dd72

Best regards,
-- 
slonkazoid <slonkazoid@slonk.ing>



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

* Re: [PATCH v2] add a refresh_rate option to virtio-gpu
  2026-04-15  9:19 [PATCH v2] add a refresh_rate option to virtio-gpu slonkazoid via qemu development
@ 2026-04-15 14:10 ` Akihiko Odaki
  2026-05-24  8:39 ` Michael S. Tsirkin
  1 sibling, 0 replies; 3+ messages in thread
From: Akihiko Odaki @ 2026-04-15 14:10 UTC (permalink / raw)
  To: slonkazoid, qemu-devel
  Cc: Michael S. Tsirkin, Alex Bennée, Dmitry Osipenko

On 2026/04/15 18:19, slonkazoid wrote:
> Signed-off-by: slonkazoid <slonkazoid@slonk.ing>
> ---
> currently, the virtio-gpu module does not set a refresh rate, making it
> default to 75Hz in the qemu edid generation logic. i wrote a sloppy patch
> that adds a `refresh_rate` option to virtio-gpu, which propagates to all
> the devices based on it (i was interested in virtio-vga-gl). it's not of
> much use by itself but when combined with something like Sunshine or
> looking-glass, it can provide *far* smoother guest graphics than the
> inbuilt display devices. i have done a bare minimum amount of manual
> testing (virtio-vga-gl with venus XOR amdgpu drm native context streaming
> video games) and it functions as intended, and should not break the code
> path to fetch the refresh rate from the active display device (?), however,
> i have never contributed to QEMU before and i don't know the customs
> concerning testing, documentation, etc. if there's more i should do, please
> tell me! if this is something that would benefit QEMU, feel free to merge it.
> it's probably not a copyrightable change anyways.
> ---
> Changes in v2:
> - Update default value of refresh_rate to the old implied default of 75000

It looks good to me now.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>

Regards,
Akihiko Odaki

> - Link to v1: https://lore.kernel.org/qemu-devel/20260414-virtio-gpu-refresh-rate-v1-1-59e6320eb24e@slonk.ing
> ---
>   hw/display/virtio-gpu-base.c   | 1 +
>   include/hw/virtio/virtio-gpu.h | 4 +++-
>   2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
> index cb76302e2d..d87f6604d0 100644
> --- a/hw/display/virtio-gpu-base.c
> +++ b/hw/display/virtio-gpu-base.c
> @@ -232,6 +232,7 @@ virtio_gpu_base_device_realize(DeviceState *qdev,
>   
>       g->req_state[0].width = g->conf.xres;
>       g->req_state[0].height = g->conf.yres;
> +    g->req_state[0].refresh_rate = g->conf.refresh_rate;
>   
>       for (output_idx = 0, node = g->conf.outputs;
>            node && output_idx < g->conf.max_outputs;
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index f69fc19462..e440535fa0 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -131,6 +131,7 @@ struct virtio_gpu_base_conf {
>       uint32_t flags;
>       uint32_t xres;
>       uint32_t yres;
> +    uint32_t refresh_rate;
>       uint64_t hostmem;
>       VirtIOGPUOutputList *outputs;
>   };
> @@ -176,7 +177,8 @@ struct VirtIOGPUBaseClass {
>       DEFINE_PROP_BIT("edid", _state, _conf.flags, \
>                       VIRTIO_GPU_FLAG_EDID_ENABLED, true), \
>       DEFINE_PROP_UINT32("xres", _state, _conf.xres, 1280), \
> -    DEFINE_PROP_UINT32("yres", _state, _conf.yres, 800)
> +    DEFINE_PROP_UINT32("yres", _state, _conf.yres, 800), \
> +    DEFINE_PROP_UINT32("refresh_rate", _state, _conf.refresh_rate, 75000)
>   
>   typedef struct VGPUDMABuf {
>       QemuDmaBuf *buf;
> 
> ---
> base-commit: 985062e2319e6bf4a4be9c216ede6d34379e5777
> change-id: 20260414-virtio-gpu-refresh-rate-37b388e7dd72
> 
> Best regards,



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

* Re: [PATCH v2] add a refresh_rate option to virtio-gpu
  2026-04-15  9:19 [PATCH v2] add a refresh_rate option to virtio-gpu slonkazoid via qemu development
  2026-04-15 14:10 ` Akihiko Odaki
@ 2026-05-24  8:39 ` Michael S. Tsirkin
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2026-05-24  8:39 UTC (permalink / raw)
  To: slonkazoid; +Cc: qemu-devel, Alex Bennée, Akihiko Odaki, Dmitry Osipenko

>On Wed, Apr 15, 2026 at 12:19:05PM +0300, slonkazoid wrote:

Your From is mangled by qemu-devel (I'm not 100% sure when does it do
it, but it did here), so please include a From: line here inthe body.

And please add a short description here. Maybe the text below,
preferably with uppercase letters )


> Signed-off-by: slonkazoid <slonkazoid@slonk.ing>
> ---
> currently, the virtio-gpu module does not set a refresh rate, making it
> default to 75Hz in the qemu edid generation logic. i wrote a sloppy patch
> that adds a `refresh_rate` option to virtio-gpu, which propagates to all
> the devices based on it (i was interested in virtio-vga-gl). it's not of
> much use by itself but when combined with something like Sunshine or
> looking-glass, it can provide *far* smoother guest graphics than the
> inbuilt display devices. i have done a bare minimum amount of manual
> testing (virtio-vga-gl with venus XOR amdgpu drm native context streaming
> video games) and it functions as intended, and should not break the code
> path to fetch the refresh rate from the active display device (?), however,
> i have never contributed to QEMU before and i don't know the customs
> concerning testing, documentation, etc. if there's more i should do, please
> tell me! if this is something that would benefit QEMU, feel free to merge it.
> it's probably not a copyrightable change anyways.

I'm not sure why do you mention this? is there a copyright concern?

> ---
> Changes in v2:
> - Update default value of refresh_rate to the old implied default of 75000
> - Link to v1: https://lore.kernel.org/qemu-devel/20260414-virtio-gpu-refresh-rate-v1-1-59e6320eb24e@slonk.ing
> ---
>  hw/display/virtio-gpu-base.c   | 1 +
>  include/hw/virtio/virtio-gpu.h | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
> index cb76302e2d..d87f6604d0 100644
> --- a/hw/display/virtio-gpu-base.c
> +++ b/hw/display/virtio-gpu-base.c
> @@ -232,6 +232,7 @@ virtio_gpu_base_device_realize(DeviceState *qdev,
>  
>      g->req_state[0].width = g->conf.xres;
>      g->req_state[0].height = g->conf.yres;
> +    g->req_state[0].refresh_rate = g->conf.refresh_rate;
>  
>      for (output_idx = 0, node = g->conf.outputs;
>           node && output_idx < g->conf.max_outputs;
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index f69fc19462..e440535fa0 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -131,6 +131,7 @@ struct virtio_gpu_base_conf {
>      uint32_t flags;
>      uint32_t xres;
>      uint32_t yres;
> +    uint32_t refresh_rate;
>      uint64_t hostmem;
>      VirtIOGPUOutputList *outputs;
>  };
> @@ -176,7 +177,8 @@ struct VirtIOGPUBaseClass {
>      DEFINE_PROP_BIT("edid", _state, _conf.flags, \
>                      VIRTIO_GPU_FLAG_EDID_ENABLED, true), \
>      DEFINE_PROP_UINT32("xres", _state, _conf.xres, 1280), \
> -    DEFINE_PROP_UINT32("yres", _state, _conf.yres, 800)
> +    DEFINE_PROP_UINT32("yres", _state, _conf.yres, 800), \
> +    DEFINE_PROP_UINT32("refresh_rate", _state, _conf.refresh_rate, 75000)
>  
>  typedef struct VGPUDMABuf {
>      QemuDmaBuf *buf;
> 
> ---
> base-commit: 985062e2319e6bf4a4be9c216ede6d34379e5777
> change-id: 20260414-virtio-gpu-refresh-rate-37b388e7dd72
> 
> Best regards,
> -- 
> slonkazoid <slonkazoid@slonk.ing>



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

end of thread, other threads:[~2026-05-24  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-15  9:19 [PATCH v2] add a refresh_rate option to virtio-gpu slonkazoid via qemu development
2026-04-15 14:10 ` Akihiko Odaki
2026-05-24  8:39 ` Michael S. Tsirkin

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.