All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Zhang <tgfbeta@me.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, tgfbeta@me.com
Subject: Re: [Qemu-devel] [PATCH] gtk: sync guest display updates to host display refresh
Date: Wed, 14 Nov 2018 11:10:57 +0800	[thread overview]
Message-ID: <0EE77C7B-02AF-4666-90D3-53BF09585EBD@me.com> (raw)
In-Reply-To: <20181113090249.15658-1-kraxel@redhat.com>

Hi,

I have briefly tested this patch. Unfortunately, it apparently caused deteriorated performance on a previously working Windows 10 guest with DMA Buf.

The patched qemu not only clogged up graphics drawing, but also obstructed the guest OS. The boot time and latency for guest operations (e.g. clicking Start menu in guest) dramatically increased. My best guess would be that GTK update events messed up with some polling in main_loop_wait(false), leading to blocked IO, or conversely the GUI being blocked by IO.

Best regards,

--
P.S:

The arguments for qemu:

/tmp/qemu-system-x86_64 -nodefaults -machine pc,accel=kvm,usb=off,kernel_irqchip=on \
  -vga none -display gtk,gl=on  -rtc base=localtime \
  -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:00:02.0/{UUID-FOR-MDEV},x-igd-opregion=on,display=on,rombar=0 \
  -m 3000 -realtime mlock=off -smp 3,sockets=1,cores=1 \
  -drive file=/home/user/disk.img,format=qcow2,media=disk,if=ide \
  -usb -device qemu-xhci,id=xhci -device usb-tablet,bus=xhci.0 \
  -cpu host -monitor stdio

The host runs a Ubuntu 18.04 desktop.

> On Nov 13, 2018, at 5:02 PM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> 
> Reduce console refresh timer to idle refresh rate.  Register a frame
> tick callback (called by gtk on each display frame) and use that to kick
> display updates instead.
> 
> That should sync qemu refresh rate to display refresh rate.  It'll also
> stop updating the qemu display in case the qemu is not visible (gtk
> stops calling the frame tick callback then).
> 
> Buglink: https://bugs.launchpad.net/bugs/1802915
> Suggested-by: Chen Zhang <tgfbeta@me.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> ui/gtk.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
> 
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 579990b865..8f79dfe42c 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -1661,6 +1661,16 @@ static gboolean gd_configure(GtkWidget *widget,
>     return FALSE;
> }
> 
> +static gboolean gd_frame_tick(GtkWidget *widget,
> +                              GdkFrameClock *frame_clock,
> +                              gpointer opaque)
> +{
> +    VirtualConsole *vc = opaque;
> +
> +    vc->gfx.dcl.ops->dpy_refresh(&vc->gfx.dcl);
> +    return G_SOURCE_CONTINUE;
> +}
> +
> /** Virtual Console Callbacks **/
> 
> static GSList *gd_vc_menu_init(GtkDisplayState *s, VirtualConsole *vc,
> @@ -1911,6 +1921,12 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc)
>                          G_CALLBACK(gd_focus_out_event), vc);
>         g_signal_connect(vc->gfx.drawing_area, "configure-event",
>                          G_CALLBACK(gd_configure), vc);
> +        if (1 /* make that a config option ??? */) {
> +            update_displaychangelistener(&vc->gfx.dcl,
> +                                         GUI_REFRESH_INTERVAL_IDLE);
> +            gtk_widget_add_tick_callback(vc->gfx.drawing_area,
> +                                         gd_frame_tick, vc, NULL);
> +        }
>     } else {
>         g_signal_connect(vc->gfx.drawing_area, "key-press-event",
>                          G_CALLBACK(gd_text_key_down), vc);
> -- 
> 2.9.3
> 

  reply	other threads:[~2018-11-14  3:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13  9:02 [Qemu-devel] [PATCH] gtk: sync guest display updates to host display refresh Gerd Hoffmann
2018-11-14  3:10 ` Chen Zhang [this message]
2018-11-14  9:40   ` Chen Zhang
2018-11-26  3:24     ` Chen Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0EE77C7B-02AF-4666-90D3-53BF09585EBD@me.com \
    --to=tgfbeta@me.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.