aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-03-01 11:05:36 +0100
committerGerd Hoffmann <kraxel@redhat.com>2018-03-05 08:44:11 +0100
commit5ee1718f92bd82e0e581191b6326384d291199d3 (patch)
tree81433059eba70888fc0d259b5db0def5d2704f60 /ui
parentdb71589fd9428156a5b366e348d895d445f77449 (diff)
sdl: switch over to new display registry
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20180301100547.18962-3-kraxel@redhat.com
Diffstat (limited to 'ui')
-rw-r--r--ui/sdl.c24
-rw-r--r--ui/sdl2.c17
2 files changed, 28 insertions, 13 deletions
diff --git a/ui/sdl.c b/ui/sdl.c
index c4ae7ab05d..a5fd503c25 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -901,17 +901,7 @@ static const DisplayChangeListenerOps dcl_ops = {
.dpy_cursor_define = sdl_mouse_define,
};
-void sdl_display_early_init(DisplayOptions *opts)
-{
- if (opts->has_gl && opts->gl) {
- fprintf(stderr,
- "SDL1 display code has no opengl support.\n"
- "Please recompile qemu with SDL2, using\n"
- "./configure --enable-sdl --with-sdlabi=2.0\n");
- }
-}
-
-void sdl_display_init(DisplayState *ds, DisplayOptions *o)
+static void sdl1_display_init(DisplayState *ds, DisplayOptions *o)
{
int flags;
uint8_t data = 0;
@@ -1023,3 +1013,15 @@ void sdl_display_init(DisplayState *ds, DisplayOptions *o)
atexit(sdl_cleanup);
}
+
+static QemuDisplay qemu_display_sdl1 = {
+ .type = DISPLAY_TYPE_SDL,
+ .init = sdl1_display_init,
+};
+
+static void register_sdl1(void)
+{
+ qemu_display_register(&qemu_display_sdl1);
+}
+
+type_init(register_sdl1);
diff --git a/ui/sdl2.c b/ui/sdl2.c
index b5a0fa1d13..83b917fa37 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -751,7 +751,7 @@ static const DisplayChangeListenerOps dcl_gl_ops = {
};
#endif
-void sdl_display_early_init(DisplayOptions *o)
+static void sdl2_display_early_init(DisplayOptions *o)
{
assert(o->type == DISPLAY_TYPE_SDL);
if (o->has_gl && o->gl) {
@@ -761,7 +761,7 @@ void sdl_display_early_init(DisplayOptions *o)
}
}
-void sdl_display_init(DisplayState *ds, DisplayOptions *o)
+static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
{
int flags;
uint8_t data = 0;
@@ -861,3 +861,16 @@ void sdl_display_init(DisplayState *ds, DisplayOptions *o)
atexit(sdl_cleanup);
}
+
+static QemuDisplay qemu_display_sdl2 = {
+ .type = DISPLAY_TYPE_SDL,
+ .early_init = sdl2_display_early_init,
+ .init = sdl2_display_init,
+};
+
+static void register_sdl1(void)
+{
+ qemu_display_register(&qemu_display_sdl2);
+}
+
+type_init(register_sdl1);