opengl: add egl-headless display

Add egl-headless user interface.  It doesn't provide a real user
interface, it only provides opengl support using drm render nodes.
It will copy back the bits rendered by the guest using virgl back
to a DisplaySurface and kick the usual display update code paths,
so spice and vnc and screendump can pick it up.

Use it this way:
  qemu -display egl-headless -vnc $display
  qemu -display egl-headless -spice gl=off,$args

Note that you should prefer native spice opengl support (-spice
gl=on) if possible because that delivers better performance.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20170505104101.30589-7-kraxel@redhat.com
This commit is contained in:
Gerd Hoffmann 2017-05-05 12:41:01 +02:00
parent bc8c946f72
commit bb1599b64c
4 changed files with 178 additions and 0 deletions

16
vl.c
View file

@ -2050,6 +2050,7 @@ typedef enum DisplayType {
DT_SDL,
DT_COCOA,
DT_GTK,
DT_EGL,
DT_NONE,
} DisplayType;
@ -2127,6 +2128,15 @@ static DisplayType select_display(const char *p)
error_report("VNC requires a display argument vnc=<display>");
exit(1);
}
} else if (strstart(p, "egl-headless", &opts)) {
#ifdef CONFIG_OPENGL
request_opengl = 1;
display_opengl = 1;
display = DT_EGL;
#else
fprintf(stderr, "egl support is disabled\n");
exit(1);
#endif
} else if (strstart(p, "curses", &opts)) {
#ifdef CONFIG_CURSES
display = DT_CURSES;
@ -4659,6 +4669,12 @@ int main(int argc, char **argv, char **envp)
qemu_spice_display_init();
}
#ifdef CONFIG_OPENGL
if (display_type == DT_EGL) {
egl_headless_init();
}
#endif
if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
exit(1);
}