summaryrefslogtreecommitdiffstats
path: root/hw/display/xenfb.c
diff options
context:
space:
mode:
authorAkihiko Odaki2022-02-26 12:55:15 +0100
committerGerd Hoffmann2022-06-14 10:34:37 +0200
commitaeffd071ed818fa83c723fe8e2715144ee8385c7 (patch)
treeb06d72863abc92d4625754855ee9aab6c73587f7 /hw/display/xenfb.c
parentui/console: Do not return a value with ui_info (diff)
downloadqemu-aeffd071ed818fa83c723fe8e2715144ee8385c7.tar.gz
qemu-aeffd071ed818fa83c723fe8e2715144ee8385c7.tar.xz
qemu-aeffd071ed818fa83c723fe8e2715144ee8385c7.zip
ui: Deliver refresh rate via QemuUIInfo
This change adds a new member, refresh_rate to QemuUIInfo in include/ui/console.h. It represents the refresh rate of the physical display backend, and it is more appropriate than GUI update interval as the refresh rate which the emulated device reports: - sdl may set GUI update interval shorter than the refresh rate of the physical display to respond to user-generated events. - sdl and vnc aggressively changes GUI update interval, but a guests is typically not designed to respond to frequent refresh rate changes, or frequent "display mode" changes in general. The frequency of refresh rate changes of the physical display backend matches better to the guest's expectation. QemuUIInfo also has other members representing "display mode", which makes it suitable for refresh rate representation. It has a throttling of update notifications, and prevents frequent changes of the display mode. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20220226115516.59830-3-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/display/xenfb.c')
-rw-r--r--hw/display/xenfb.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index cea10fe3c7..50857cd97a 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -777,16 +777,24 @@ static void xenfb_update(void *opaque)
xenfb->up_fullscreen = 0;
}
-static void xenfb_update_interval(void *opaque, uint64_t interval)
+static void xenfb_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
{
struct XenFB *xenfb = opaque;
+ uint32_t refresh_rate;
if (xenfb->feature_update) {
#ifdef XENFB_TYPE_REFRESH_PERIOD
if (xenfb_queue_full(xenfb)) {
return;
}
- xenfb_send_refresh_period(xenfb, interval);
+
+ refresh_rate = info->refresh_rate;
+ if (!refresh_rate) {
+ refresh_rate = 75;
+ }
+
+ /* T = 1 / f = 1 [s*Hz] / f = 1000*1000 [ms*mHz] / f */
+ xenfb_send_refresh_period(xenfb, 1000 * 1000 / refresh_rate);
#endif
}
}
@@ -983,5 +991,5 @@ struct XenDevOps xen_framebuffer_ops = {
static const GraphicHwOps xenfb_ops = {
.invalidate = xenfb_invalidate,
.gfx_update = xenfb_update,
- .update_interval = xenfb_update_interval,
+ .ui_info = xenfb_ui_info,
};