qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] ui: introduce vfio_display_reset


From: Zhang, Tina
Subject: Re: [Qemu-devel] [PATCH 2/2] ui: introduce vfio_display_reset
Date: Tue, 24 Apr 2018 06:54:35 +0000


> -----Original Message-----
> From: intel-gvt-dev [mailto:address@hidden On
> Behalf Of Gerd Hoffmann
> Sent: Monday, April 23, 2018 9:12 PM
> To: Zhang, Tina <address@hidden>
> Cc: address@hidden; address@hidden; qemu-
> address@hidden; address@hidden; Yuan, Hang
> <address@hidden>
> Subject: Re: [PATCH 2/2] ui: introduce vfio_display_reset
> 
> > +    surface = qemu_console_surface(vdev->dpy->con);
> 
> > +    dpy_gl_scanout_disable(vdev->dpy->con);
> > +    dpy_gfx_switch_surface(vdev->dpy->con, surface);
> 
> Hmm, so you ask which surface is active, then switch to it.
> Why?

What this patch-set is going to do is to disable scanout mode during guest OS 
reset, so that Qemu UI (e.g. gtk) can directly use QemuConsole's DisplaySurface 
instead of guest dma-buf framebuffer during the guest OS reset process. 
gd_egl_draw is invodked when the Qemu UI window gets the focus. If this process 
is happened during guest OS reboot, gd_egl_scanout_flush() will be invoked (as 
vc->gfx.scanout_mode==true), which uses guest dma-buf framebuffer. See the 
following logic in gtk-egl.c:
void gd_egl_draw(VirtualConsole *vc)
{
    GdkWindow *window;
    int ww, wh;

    if (!vc->gfx.gls) {
        return;
    }

    if (vc->gfx.scanout_mode) {
        gd_egl_scanout_flush(&vc->gfx.dcl, 0, 0, vc->gfx.w, vc->gfx.h);
    } else {
        if (!vc->gfx.ds) {
            return;
        }
        eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
                       vc->gfx.esurface, vc->gfx.ectx);

        window = gtk_widget_get_window(vc->gfx.drawing_area);
        gdk_drawable_get_size(window, &ww, &wh);
        surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, ww, wh);
        surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds);

        eglSwapBuffers(qemu_egl_display, vc->gfx.esurface);
    }
}

Using guest dma-buf framebuffer during guest OS reboot will lead to host GPU 
hang, as the GGTT is invalid during guest OS reboot.
That's why we want to disable the scanout mode and release all the dma-buf 
resources during guest OS reset.

After reviewing this patch-set again, I think we might not need the proposed 
dpy_gfx_switch_surface() any more.
The reason I proposed it was because I thought gfx.ds is changed to the surface 
related to guest dma-buf framebuffer and we need to switch it with 
QemuConsole's DisplaySurgface during reset.
But after reviewing the code, vc->gfx.ds is always pointing to the valid 
QemuConsoles' DisplaySurface. So we don’t need dpy_gfx_switch_surface() to take 
care of it.
Thanks.

> 
> Maybe you just need a full display update after disabling the gl scanout?
Do you still think updating full display is needed? It seems the existing 
vfio_display_dmabuf_update can be helpful enough to create a new texture if 
needed.
Thanks.


BR,
Tina
> 
> cheers,
>   Gerd
> 
> PS: maybe adding a dpy_gfx_update_full() helper is useful:
> 
> diff --git a/include/ui/console.h b/include/ui/console.h index
> 37a8d68d29..981b519dde 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -291,6 +291,7 @@ bool dpy_ui_info_supported(QemuConsole *con);  int
> dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info);
> 
>  void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h);
> +void dpy_gfx_update_full(QemuConsole *con);
>  void dpy_gfx_replace_surface(QemuConsole *con,
>                               DisplaySurface *surface);  void 
> dpy_text_cursor(QemuConsole
> *con, int x, int y); diff --git a/ui/console.c b/ui/console.c index
> 3fb2f4e09f..b02510cdca 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -1574,6 +1574,16 @@ void dpy_gfx_update(QemuConsole *con, int x, int
> y, int w, int h)
>      }
>  }
> 
> +void dpy_gfx_update_full(QemuConsole *con) {
> +    if (!con->surface) {
> +        return;
> +    }
> +    dpy_gfx_update(con, 0, 0,
> +                   surface_width(con->surface),
> +                   surface_height(con->surface)); }
> +
>  void dpy_gfx_replace_surface(QemuConsole *con,
>                               DisplaySurface *surface)  {
> 
> _______________________________________________
> intel-gvt-dev mailing list
> address@hidden
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

reply via email to

[Prev in Thread] Current Thread [Next in Thread]