On 2022/03/07 21:32, Marc-André Lureau wrote:
Hi

On Mon, Mar 7, 2022 at 4:24 PM Akihiko Odaki <akihiko.od...@gmail.com> wrote:

On 2022/03/07 20:50, Marc-André Lureau wrote:
Hi

On Mon, Mar 7, 2022 at 2:35 PM Akihiko Odaki <akihiko.od...@gmail.com> wrote:

On 2022/03/07 19:19, Marc-André Lureau wrote:
Hi Akihiko

On Mon, Mar 7, 2022 at 12:09 PM Akihiko Odaki <akihiko.od...@gmail.com> wrote:

On 2022/03/07 16:46, marcandre.lur...@redhat.com wrote:
From: Marc-André Lureau <marcandre.lur...@redhat.com>

egl-headless depends on the backing surface to be set before texture are
set and updated. Display it (update=true) iff the current scanout kind
is SURFACE.

egl-headless does not dynamically call register_displaychangelistener
and has console associated (console_select would not affect egl-headless
itself) so this should not be necessary.

Could you help me understand, what should not be necessary?

I read the description as it sets the backing surface for egl-headless
when register_displaychangelistener or console_select is called. The
change is not necessary.

Without it, gfx_switch is not called to set the new surface. Switching
console with VNC would fail (via ctrl+alt+num).

Yes, but that is not because egl-headless requires its dpy_gfx_switch to
be called. It is because vnc does not receive the surface. The patch
adds a call of dpy_gfx_switch no matter if the receiver is an OpenGL
display or not, but an OpenGL display would not need one.

That's why I added the "update" argument to
displaychangelistener_gfx_switch(). "gfx_switch" merely indicates that
the DisplaySurface has changed, not to show it.




The remaining problem with egl-headless is that egl-headless renders the
image to DisplaySurface, and a non-OpenGL display (namely vnc) has to
consume it instead of texture even when con->scanout.kind is
SCANOUT_TEXTURE or SCANOUT_DMABUF.

This is already happening, because egl-headless calls dpy_gfx_update().

It is not called when register_displaychangelistener or console_select
is called by non-OpenGL display consuming the DisplaySurface.

When displaychangelistener_display_console() is called with
con->scanount.kind == SCANOUT_SURFACE, it calls gfx_update(update ==
TRUE), and thus calls gfx_update on the whole surface.


con->scanout.kind is SCANOUT_TEXTURE or SCANOUT_DMABUF when egl-headless
is rendering to surface. It would not call gfx_update in the case.

  GL updates go through egl_scanout_flush (dpy_gl_update callback),
which calls dpy_gfx_update() which is in turned handled by
vnc_dpy_update().

Could you provide a failing test case or a more concrete suggestion on
what to do instead? I am all ears :)

thanks


Let me describe a more concrete case. Think that egl-headless and vnc are enabled. The guest devices are serial virtio-gpu-gl. vnc selects serial at first.

vnc uses register_displaychangelistener and console_select to switch consoles.

displaychangelistener_display_console does the actual switching, and calls dpy_gfx_switch and dpy_gfx_update if con->scanout.kind is SCANOUT_SURFACE. It calls dpy_gl_scanout_texture or dpy_gl_scanout_dmabuf if con->scanout.kind is SCANOUT_TEXTURE or SCANOUT_DMABUF. It works for a OpenGL display, but it doesn't vnc in combination with egl-headless.

virtio-gpu-gl starts scanning out texture. It would happen in the following sequence: 1. virtio-gpu-gl calls qemu_console_resize. con->scanout.kind will be SCANOUT_SURFACE. 2. qemu_console_resize calls dpy_gfx_switch, delivering DisplaySurface to egl-headless. con->scanout.kind will be SCANOUT_TEXTURE. 3. virtio-gpu-gl calls dpy_gl_scanout_texture. egl-headless starts rendering the texture to the DisplaySurface.

In the end, the DisplaySurface will have the image rendered, and con->scanout.kind will be SCANOUT_TEXTURE.

Now vnc switches to virtio-gpu-gl.

4. vnc calls console_select
5. displaychangelistener_display_console finds con->scanout.kind is SCANOUT_TEXTURE so it tries to scanout texture, but vnc is not an OpenGL display. It essentially becomes no-op and the display would be blank.

This patch will change it to call dpy_gfx_switch but not to call dpy_gfx_update.

Regards,
Akihiko Odaki

Reply via email to