From nobody Fri May 17 11:05:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645876667844633.593804386143; Sat, 26 Feb 2022 03:57:47 -0800 (PST) Received: from localhost ([::1]:43466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNvhq-000424-E4 for importer@patchew.org; Sat, 26 Feb 2022 06:57:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNvfp-000225-2d for qemu-devel@nongnu.org; Sat, 26 Feb 2022 06:55:41 -0500 Received: from [2607:f8b0:4864:20::1033] (port=46875 helo=mail-pj1-x1033.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nNvfn-00042N-Hh for qemu-devel@nongnu.org; Sat, 26 Feb 2022 06:55:40 -0500 Received: by mail-pj1-x1033.google.com with SMTP id j10-20020a17090a94ca00b001bc2a9596f6so7155681pjw.5 for ; Sat, 26 Feb 2022 03:55:39 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:4c8a:825a:fb9a:12f3]) by smtp.gmail.com with ESMTPSA id pi16-20020a17090b1e5000b001bd1ffaf2basm1323761pjb.0.2022.02.26.03.55.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 26 Feb 2022 03:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1vVq5QSmFweuWNBdaYFtPRKPL3G9SHsp3hf2KVemRVo=; b=Y2+1zlnn4e2aOoUS/40z8+sK0+GHbu2IDCJKBrw6ym7cvsqogLskQzaDpI+4NzPStq fCbnbPNjpS36ByBqAxPA3Gf8FAnZmhZ2W0GtHN1NTpBTd7WVcEuZaenGC0xNiRH4IFJv 0BRaqXxTI1LUCWMjoDXvUKnRRWslB1bWM2VTUWrUhKoHbU6y3XaXjZ4dsKOVWE8cMm/p 5/GLFLpLWK4kefelCJte5v93tlm9W76ZeWNXM7jrEjfpcteMxKi9CugiZKrMycPZKTIh FHMnpOSu2GQtwB9yhO2uIrLa+UpcqUTPBKJ52O8Twk/GCCeAzB1u+OyouiJWxDXvQ521 sXbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1vVq5QSmFweuWNBdaYFtPRKPL3G9SHsp3hf2KVemRVo=; b=vIAs03gHXPaMe9B3N+CZC3ptfQAvwmt0VcLqKmLpSK/rxm2n06NjrKPExTl01ZRVEe 2/p0/oCSdJQukkhaMColk6fVtUiVXusDtx+T1BwpmJyi169aS1Te7ZUXLv0oin6I86Z8 nvCYu+Md68bSN1xnHU4fD/JfgGxHaWE/7TebVuLUo0AGXIshmGeGyZUDPV9JnexUYyye hhC6TL+gm85hD5z/mppAOOzB4oNe5Q+8PRpF8YckRihMOmtpcurn4yup+k5PXVec22Yl D6tY5n69nJreuVvWhpgZdPysZv9drHaidQkh+jgLg0vgrQm1qU1FkDI2JbIhKIo/ogJa xIHA== X-Gm-Message-State: AOAM533B1qNrrYuBiSq9/cDotTx6ZnyJzifqpt3NT1ue0ygm2HBNyDbd X8SUyDzyi3HCZTakf2+3G8Xx4E0IAX0= X-Google-Smtp-Source: ABdhPJzv9vpq6EwhjOpHjxz1l51nFl8tdgYInJJ4xyQ8eyJ/15tOXY5qM2/17GCtdoEvEc2qD2VD8g== X-Received: by 2002:a17:902:9045:b0:14f:14e7:f3aa with SMTP id w5-20020a170902904500b0014f14e7f3aamr11257393plz.69.1645876538010; Sat, 26 Feb 2022 03:55:38 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v3 1/3] ui/console: Do not return a value with ui_info Date: Sat, 26 Feb 2022 20:55:14 +0900 Message-Id: <20220226115516.59830-2-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220226115516.59830-1-akihiko.odaki@gmail.com> References: <20220226115516.59830-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1033 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=akihiko.odaki@gmail.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , "Michael S . Tsirkin" , Paul Durrant , qemu Developers , Gerd Hoffmann , Akihiko Odaki , Anthony Perard , xen-devel@lists.xenproject.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645876670140100001 Content-Type: text/plain; charset="utf-8" The returned value is not used and misleading. Signed-off-by: Akihiko Odaki --- hw/display/virtio-gpu-base.c | 6 +++--- hw/display/virtio-vga.c | 5 ++--- hw/vfio/display.c | 8 +++----- include/ui/console.h | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index fff0fb4a828..c73b3aa06b8 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -69,12 +69,12 @@ static void virtio_gpu_notify_event(VirtIOGPUBase *g, u= int32_t event_type) virtio_notify_config(&g->parent_obj); } =20 -static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info) +static void virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *inf= o) { VirtIOGPUBase *g =3D opaque; =20 if (idx >=3D g->conf.max_outputs) { - return -1; + return; } =20 g->req_state[idx].x =3D info->xoff; @@ -92,7 +92,7 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx,= QemuUIInfo *info) =20 /* send event to guest */ virtio_gpu_notify_event(g, VIRTIO_GPU_EVENT_DISPLAY); - return 0; + return; } =20 static void diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 5a2f7a45408..84433d3557e 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -47,15 +47,14 @@ static void virtio_vga_base_text_update(void *opaque, c= onsole_ch_t *chardata) } } =20 -static int virtio_vga_base_ui_info(void *opaque, uint32_t idx, QemuUIInfo = *info) +static void virtio_vga_base_ui_info(void *opaque, uint32_t idx, QemuUIInfo= *info) { VirtIOVGABase *vvga =3D opaque; VirtIOGPUBase *g =3D vvga->vgpu; =20 if (g->hw_ops->ui_info) { - return g->hw_ops->ui_info(g, idx, info); + g->hw_ops->ui_info(g, idx, info); } - return -1; } =20 static void virtio_vga_base_gl_block(void *opaque, bool block) diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 89bc90508fb..78f4d82c1c3 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -106,14 +106,14 @@ err: return; } =20 -static int vfio_display_edid_ui_info(void *opaque, uint32_t idx, - QemuUIInfo *info) +static void vfio_display_edid_ui_info(void *opaque, uint32_t idx, + QemuUIInfo *info) { VFIOPCIDevice *vdev =3D opaque; VFIODisplay *dpy =3D vdev->dpy; =20 if (!dpy->edid_regs) { - return 0; + return; } =20 if (info->width && info->height) { @@ -121,8 +121,6 @@ static int vfio_display_edid_ui_info(void *opaque, uint= 32_t idx, } else { vfio_display_edid_update(vdev, false, 0, 0); } - - return 0; } =20 static void vfio_display_edid_init(VFIOPCIDevice *vdev) diff --git a/include/ui/console.h b/include/ui/console.h index f590819880b..7f5374380f0 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -427,7 +427,7 @@ typedef struct GraphicHwOps { bool gfx_update_async; /* if true, calls graphic_hw_update_done() */ void (*text_update)(void *opaque, console_ch_t *text); void (*update_interval)(void *opaque, uint64_t interval); - int (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); + void (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); void (*gl_block)(void *opaque, bool block); } GraphicHwOps; =20 --=20 2.32.0 (Apple Git-132) From nobody Fri May 17 11:05:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645876670016459.2908071274742; Sat, 26 Feb 2022 03:57:50 -0800 (PST) Received: from localhost ([::1]:43560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNvhs-00046u-Is for importer@patchew.org; Sat, 26 Feb 2022 06:57:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNvfs-00022M-56 for qemu-devel@nongnu.org; Sat, 26 Feb 2022 06:55:44 -0500 Received: from [2607:f8b0:4864:20::102f] (port=41832 helo=mail-pj1-x102f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nNvfp-00043D-Uf for qemu-devel@nongnu.org; Sat, 26 Feb 2022 06:55:43 -0500 Received: by mail-pj1-x102f.google.com with SMTP id ev16-20020a17090aead000b001bc3835fea8so7219422pjb.0 for ; Sat, 26 Feb 2022 03:55:41 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:4c8a:825a:fb9a:12f3]) by smtp.gmail.com with ESMTPSA id pi16-20020a17090b1e5000b001bd1ffaf2basm1323761pjb.0.2022.02.26.03.55.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 26 Feb 2022 03:55:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZiMwz4CLUHVQwB/T9EDfn/YLCqMyd2Smwt78yZWRpeo=; b=AQpKxolY+jmvrIAcwuW4Q5j87it2u7GvZ51eYOQWO5OZ0CAwny+tQHokxK/bwHV0qF gghMz3iM0K7MGDoy29eFn1Ji/t1qYxsz3HZvZ3ksCSM724gIAyLEz1MFcr1G1RQr9TLl V016pJBUCr2G3uh0wmWttf5Rtn1WLdAiNjVYpfeheiWs6M1AZO//qzyg3Fq9zJsi60Z6 LTfKUtoqt4dV7Xxm3QciSv0uhF/cc3RsyouZZ3holFsa1xliqU5wQ8lufWa5nXRXt4YV fVZ/Bko53qzyLLxBoZ5cEceawnBQWXRkT2wVNXx22Sfet+hB2sLu1/GC1ANTZaJGzn25 nkDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZiMwz4CLUHVQwB/T9EDfn/YLCqMyd2Smwt78yZWRpeo=; b=T81+iU9kqT0FqCZeEz4wU607ycHzAe4YfIRXEIwssq+xQnXH/Ny3yHOSi3pQKXuZ1i hKLwNyht2ZSKhNGyofaxsL/rUP7eP+H0xO73wMt5oZxjXxxtnLC+GPYqpRVV9ZXc5GW7 XDz43re6GcTQYUTSI6KB0sHJHUlY0EWhTBbGmUUK9HaJ3cNpwVJ1ZQ6HMvI5CLadQTLx OiXsGYsHDQpaByAy3Irj82SKX809xDKHKuN3XH5VjWlxVpNxQSmV560p48WZffjgYGef SD+i4unV7q5ND5U1CDT1w0pQ199fhezcpdmnsw4WLmTLOmO01BwSJ2FHRare5kck0o4P bcHg== X-Gm-Message-State: AOAM533HeuRHXONH8srUup8xxZQ2HBKLTWNvFnoOoTvETxqcQm2ubOQL APXz80OnHHuSXy9QDiB2U3OiZaCKoH8= X-Google-Smtp-Source: ABdhPJz/YbHQ3xbVnebcpB1Qyc25RMYaC59gB9DTVe0ZA/Fb3d5S0sNzZFhaZSt7b+KC/nesUruCaA== X-Received: by 2002:a17:902:7e4b:b0:151:57d6:670f with SMTP id a11-20020a1709027e4b00b0015157d6670fmr129391pln.144.1645876540447; Sat, 26 Feb 2022 03:55:40 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v3 2/3] ui: Deliver refresh rate via QemuUIInfo Date: Sat, 26 Feb 2022 20:55:15 +0900 Message-Id: <20220226115516.59830-3-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220226115516.59830-1-akihiko.odaki@gmail.com> References: <20220226115516.59830-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102f (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=akihiko.odaki@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , "Michael S . Tsirkin" , Paul Durrant , qemu Developers , Gerd Hoffmann , Akihiko Odaki , Anthony Perard , xen-devel@lists.xenproject.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645876671736100005 Content-Type: text/plain; charset="utf-8" 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 --- hw/display/xenfb.c | 14 +++++++++++--- include/ui/console.h | 2 +- include/ui/gtk.h | 2 +- ui/console.c | 6 ------ ui/gtk-egl.c | 4 ++-- ui/gtk-gl-area.c | 3 +-- ui/gtk.c | 45 +++++++++++++++++++++++++------------------- 7 files changed, 42 insertions(+), 34 deletions(-) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 838260b6ad1..a53341ef673 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -777,16 +777,24 @@ static void xenfb_update(void *opaque) xenfb->up_fullscreen =3D 0; } =20 -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 =3D opaque; + uint32_t refresh_rate; =20 if (xenfb->feature_update) { #ifdef XENFB_TYPE_REFRESH_PERIOD if (xenfb_queue_full(xenfb)) { return; } - xenfb_send_refresh_period(xenfb, interval); + + refresh_rate =3D info->refresh_rate; + if (!refresh_rate) { + refresh_rate =3D 75; + } + + /* T =3D 1 / f =3D 1 [s*Hz] / f =3D 1000*1000 [ms*mHz] / f */ + xenfb_send_refresh_period(xenfb, 1000 * 1000 / refresh_rate); #endif } } @@ -983,5 +991,5 @@ struct XenDevOps xen_framebuffer_ops =3D { static const GraphicHwOps xenfb_ops =3D { .invalidate =3D xenfb_invalidate, .gfx_update =3D xenfb_update, - .update_interval =3D xenfb_update_interval, + .ui_info =3D xenfb_ui_info, }; diff --git a/include/ui/console.h b/include/ui/console.h index 7f5374380f0..24f1dbec038 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -139,6 +139,7 @@ typedef struct QemuUIInfo { int yoff; uint32_t width; uint32_t height; + uint32_t refresh_rate; } QemuUIInfo; =20 /* cursor data format is 32bit RGBA */ @@ -426,7 +427,6 @@ typedef struct GraphicHwOps { void (*gfx_update)(void *opaque); bool gfx_update_async; /* if true, calls graphic_hw_update_done() */ void (*text_update)(void *opaque, console_ch_t *text); - void (*update_interval)(void *opaque, uint64_t interval); void (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); void (*gl_block)(void *opaque, bool block); } GraphicHwOps; diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 101b147d1b9..ae0f53740d1 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -155,7 +155,7 @@ extern bool gtk_use_gl_area; =20 /* ui/gtk.c */ void gd_update_windowsize(VirtualConsole *vc); -int gd_monitor_update_interval(GtkWidget *widget); +void gd_update_monitor_refresh_rate(VirtualConsole *vc, GtkWidget *widget); void gd_hw_gl_flushed(void *vc); =20 /* ui/gtk-egl.c */ diff --git a/ui/console.c b/ui/console.c index 40eebb6d2cc..63c5c207f0c 100644 --- a/ui/console.c +++ b/ui/console.c @@ -155,7 +155,6 @@ static void gui_update(void *opaque) uint64_t dcl_interval; DisplayState *ds =3D opaque; DisplayChangeListener *dcl; - QemuConsole *con; =20 ds->refreshing =3D true; dpy_refresh(ds); @@ -170,11 +169,6 @@ static void gui_update(void *opaque) } if (ds->update_interval !=3D interval) { ds->update_interval =3D interval; - QTAILQ_FOREACH(con, &consoles, next) { - if (con->hw_ops->update_interval) { - con->hw_ops->update_interval(con->hw, interval); - } - } trace_console_refresh(interval); } ds->last_update =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index e3bd4bc2743..b5bffbab252 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -140,8 +140,8 @@ void gd_egl_refresh(DisplayChangeListener *dcl) { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 - vc->gfx.dcl.update_interval =3D gd_monitor_update_interval( - vc->window ? vc->window : vc->gfx.drawing_area); + gd_update_monitor_refresh_rate( + vc, vc->window ? vc->window : vc->gfx.drawing_area); =20 if (!vc->gfx.esurface) { gd_egl_init(vc); diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index fc5a082eb84..0113474ef5f 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -121,8 +121,7 @@ void gd_gl_area_refresh(DisplayChangeListener *dcl) { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 - vc->gfx.dcl.update_interval =3D gd_monitor_update_interval( - vc->window ? vc->window : vc->gfx.drawing_area); + gd_update_monitor_refresh_rate(vc, vc->window ? vc->window : vc->gfx.d= rawing_area); =20 if (!vc->gfx.gls) { if (!gtk_widget_get_realized(vc->gfx.drawing_area)) { diff --git a/ui/gtk.c b/ui/gtk.c index a8567b9ddc8..7d904141af0 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -696,11 +696,20 @@ static gboolean gd_window_close(GtkWidget *widget, Gd= kEvent *event, return TRUE; } =20 -static void gd_set_ui_info(VirtualConsole *vc, gint width, gint height) +static void gd_set_ui_refresh_rate(VirtualConsole *vc, int refresh_rate) { QemuUIInfo info; =20 - memset(&info, 0, sizeof(info)); + info =3D *dpy_get_ui_info(vc->gfx.dcl.con); + info.refresh_rate =3D refresh_rate; + dpy_set_ui_info(vc->gfx.dcl.con, &info, true); +} + +static void gd_set_ui_size(VirtualConsole *vc, gint width, gint height) +{ + QemuUIInfo info; + + info =3D *dpy_get_ui_info(vc->gfx.dcl.con); info.width =3D width; info.height =3D height; dpy_set_ui_info(vc->gfx.dcl.con, &info, true); @@ -724,33 +733,32 @@ static void gd_resize_event(GtkGLArea *area, { VirtualConsole *vc =3D (void *)opaque; =20 - gd_set_ui_info(vc, width, height); + gd_set_ui_size(vc, width, height); } =20 #endif =20 -/* - * If available, return the update interval of the monitor in ms, - * else return 0 (the default update interval). - */ -int gd_monitor_update_interval(GtkWidget *widget) +void gd_update_monitor_refresh_rate(VirtualConsole *vc, GtkWidget *widget) { #ifdef GDK_VERSION_3_22 GdkWindow *win =3D gtk_widget_get_window(widget); + int refresh_rate; =20 if (win) { GdkDisplay *dpy =3D gtk_widget_get_display(widget); GdkMonitor *monitor =3D gdk_display_get_monitor_at_window(dpy, win= ); - int refresh_rate =3D gdk_monitor_get_refresh_rate(monitor); /* [mH= z] */ - - if (refresh_rate) { - /* T =3D 1 / f =3D 1 [s*Hz] / f =3D 1000*1000 [ms*mHz] / f */ - return MIN(1000 * 1000 / refresh_rate, - GUI_REFRESH_INTERVAL_DEFAULT); - } + refresh_rate =3D gdk_monitor_get_refresh_rate(monitor); /* [mHz] */ + } else { + refresh_rate =3D 0; } + + gd_set_ui_refresh_rate(vc, refresh_rate); + + /* T =3D 1 / f =3D 1 [s*Hz] / f =3D 1000*1000 [ms*mHz] / f */ + vc->gfx.dcl.update_interval =3D refresh_rate ? + MIN(1000 * 1000 / refresh_rate, GUI_REFRESH_INTERVAL_DEFAULT) : + GUI_REFRESH_INTERVAL_DEFAULT; #endif - return 0; } =20 static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque) @@ -787,8 +795,7 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_= t *cr, void *opaque) return FALSE; } =20 - vc->gfx.dcl.update_interval =3D - gd_monitor_update_interval(vc->window ? vc->window : s->window); + gd_update_monitor_refresh_rate(vc, vc->window ? vc->window : s->window= ); =20 fbw =3D surface_width(vc->gfx.ds); fbh =3D surface_height(vc->gfx.ds); @@ -1673,7 +1680,7 @@ static gboolean gd_configure(GtkWidget *widget, { VirtualConsole *vc =3D opaque; =20 - gd_set_ui_info(vc, cfg->width, cfg->height); + gd_set_ui_size(vc, cfg->width, cfg->height); return FALSE; } =20 --=20 2.32.0 (Apple Git-132) From nobody Fri May 17 11:05:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645876798498897.710906359879; Sat, 26 Feb 2022 03:59:58 -0800 (PST) Received: from localhost ([::1]:48130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNvjx-0007Dt-Ec for importer@patchew.org; Sat, 26 Feb 2022 06:59:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNvft-000235-TQ for qemu-devel@nongnu.org; Sat, 26 Feb 2022 06:55:46 -0500 Received: from [2607:f8b0:4864:20::532] (port=36849 helo=mail-pg1-x532.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nNvfs-00043b-7m for qemu-devel@nongnu.org; Sat, 26 Feb 2022 06:55:45 -0500 Received: by mail-pg1-x532.google.com with SMTP id t14so4193515pgr.3 for ; Sat, 26 Feb 2022 03:55:43 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:4c8a:825a:fb9a:12f3]) by smtp.gmail.com with ESMTPSA id pi16-20020a17090b1e5000b001bd1ffaf2basm1323761pjb.0.2022.02.26.03.55.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 26 Feb 2022 03:55:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PA+WCteHQO0lrRBLqQfQaqZn8q0hOOjrSckhEBEspgs=; b=a1g9gVxd2qro29ukrrigoEDwnnpi9zUsQ6NGUQw0EWmx88h1QRpnLxAQq8v9q+5LyL nrasmCejv4KpqaD93Mn2pF9UQuOIakgjqtPS3bjQzBwcSiV7GcEcl2FU1UTI25HtBdh3 ceReknBXMSr3qWzYK4yqmC9jtJT9oaEigIojPRzsQYFIQ4pMhq5b2cGJAc4WUKZlPYnB h+6Da2fxzrk6+ssM3tQR+EW74qlJE7nwq+GykYolK3YiAH1/HIq95LjdoHI5zGlRTXdJ EDyDfFvKGToc8C7aeT8I9+1AUS9Lw3F3glHr5Ac701NZamZ34L72GpnW7VI/3b6WU+NN SOiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PA+WCteHQO0lrRBLqQfQaqZn8q0hOOjrSckhEBEspgs=; b=nJ3J/i5WOn0B8aYCAl5cLck6SW9EaLRueKK1hb46bsS+xMs96igml04HGiRbup2XmF Ty4G6f8NH5KbKOarH6aSDMVh8J6blDPIPVbDhHMe4ffFBHqaSkPriEq4DCtNMhxvgyje 3q7IR+nG08f4XX0MTPXsdZRBbf1gEy6gHMAV3I8siIZXQt7qOjtXq7tjvqiCE/yV7cdt anfuezaal6wb8kQfJt7maohjgGNaqFM2uAzOmDuF+oCvyiVA3XlVuLL9IU2q93WDf1DD 5CIFr+7FyaEIZo03XAa4aDcS7GavEkCvO7KKR9l7NUumNpKB0ebw3n7K60nlqnWpT7dj cEgQ== X-Gm-Message-State: AOAM530f6Bq1eRtd+YP1qIizAL1jXUs3uAg0GcOcQw43G0br7wQMVDuW AuysjEr9P6IZZlJo46tbdVvF/dQrzQs= X-Google-Smtp-Source: ABdhPJyhtEwvZRT3/rGv5Q5kdFQg3/iO52gQvR2WGuc3llR8Ktgjshhnz8w9A2PJPg5VEwIxDnpkhw== X-Received: by 2002:a05:6a00:1a56:b0:4c6:fe0c:2e27 with SMTP id h22-20020a056a001a5600b004c6fe0c2e27mr12200504pfv.65.1645876542871; Sat, 26 Feb 2022 03:55:42 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v3 3/3] virtio-gpu: Respect UI refresh rate for EDID Date: Sat, 26 Feb 2022 20:55:16 +0900 Message-Id: <20220226115516.59830-4-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220226115516.59830-1-akihiko.odaki@gmail.com> References: <20220226115516.59830-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::532 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x532.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , "Michael S . Tsirkin" , Paul Durrant , qemu Developers , Gerd Hoffmann , Akihiko Odaki , Anthony Perard , xen-devel@lists.xenproject.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645876800729100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Akihiko Odaki --- hw/display/virtio-gpu-base.c | 1 + hw/display/virtio-gpu.c | 1 + include/hw/virtio/virtio-gpu.h | 1 + 3 files changed, 3 insertions(+) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index c73b3aa06b8..ee2587a8c36 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -79,6 +79,7 @@ static void virtio_gpu_ui_info(void *opaque, uint32_t idx= , QemuUIInfo *info) =20 g->req_state[idx].x =3D info->xoff; g->req_state[idx].y =3D info->yoff; + g->req_state[idx].refresh_rate =3D info->refresh_rate; g->req_state[idx].width =3D info->width; g->req_state[idx].height =3D info->height; g->req_state[idx].width_mm =3D info->width_mm; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index c6dc818988c..04fbbd1f8f3 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -217,6 +217,7 @@ virtio_gpu_generate_edid(VirtIOGPU *g, int scanout, .height_mm =3D b->req_state[scanout].height_mm, .prefx =3D b->req_state[scanout].width, .prefy =3D b->req_state[scanout].height, + .refresh_rate =3D b->req_state[scanout].refresh_rate, }; =20 edid->size =3D cpu_to_le32(sizeof(edid->edid)); diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 2179b757037..09a317e1a7a 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -81,6 +81,7 @@ struct virtio_gpu_scanout { struct virtio_gpu_requested_state { uint16_t width_mm, height_mm; uint32_t width, height; + uint32_t refresh_rate; int x, y; }; =20 --=20 2.32.0 (Apple Git-132)