Skip to content

Commit

Permalink
egl-headless: switch over to new display registry
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-6-kraxel@redhat.com
  • Loading branch information
kraxel committed Mar 5, 2018
1 parent b076661 commit 16ab0a7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
3 changes: 0 additions & 3 deletions include/ui/console.h
Expand Up @@ -456,7 +456,4 @@ int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
/* input.c */
int index_from_key(const char *key, size_t key_length);

/* egl-headless.c */
void egl_headless_init(DisplayOptions *opts);

#endif
20 changes: 19 additions & 1 deletion ui/egl-headless.c
Expand Up @@ -164,7 +164,12 @@ static const DisplayChangeListenerOps egl_ops = {
.dpy_gl_update = egl_scanout_flush,
};

void egl_headless_init(DisplayOptions *opts)
static void early_egl_headless_init(DisplayOptions *opts)
{
display_opengl = 1;
}

static void egl_headless_init(DisplayState *ds, DisplayOptions *opts)
{
QemuConsole *con;
egl_dpy *edpy;
Expand All @@ -188,3 +193,16 @@ void egl_headless_init(DisplayOptions *opts)
register_displaychangelistener(&edpy->dcl);
}
}

static QemuDisplay qemu_display_egl = {
.type = DISPLAY_TYPE_EGL_HEADLESS,
.early_init = early_egl_headless_init,
.init = egl_headless_init,
};

static void register_egl(void)
{
qemu_display_register(&qemu_display_egl);
}

type_init(register_egl);
12 changes: 0 additions & 12 deletions vl.c
Expand Up @@ -2160,13 +2160,7 @@ static void parse_display(const char *p)
exit(1);
}
} else if (strstart(p, "egl-headless", &opts)) {
#ifdef CONFIG_OPENGL_DMABUF
display_opengl = 1;
dpy.type = DISPLAY_TYPE_EGL_HEADLESS;
#else
error_report("egl support is disabled");
exit(1);
#endif
} else if (strstart(p, "curses", &opts)) {
dpy.type = DISPLAY_TYPE_CURSES;
} else if (strstart(p, "gtk", &opts)) {
Expand Down Expand Up @@ -4672,12 +4666,6 @@ int main(int argc, char **argv, char **envp)
qemu_spice_display_init();
}

#ifdef CONFIG_OPENGL_DMABUF
if (dpy.type == DISPLAY_TYPE_EGL_HEADLESS) {
egl_headless_init(&dpy);
}
#endif

if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
exit(1);
}
Expand Down

0 comments on commit 16ab0a7

Please sign in to comment.