diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2018-03-05 15:16:30 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2018-03-05 15:16:30 +0000 |
| commit | 4ee02f53be79f21602ace1ff4057c45bbf86ca64 (patch) | |
| tree | 82bd6c34d73ce7ed8ae0ec582aa9940abc42ce8a /ui/console.c | |
| parent | 41dfc0dc55f0b338ab3c1d29a1721441b76ebd03 (diff) | |
| parent | 96400a148b3e1337e2c451e95bc3c3c69a05b67c (diff) | |
| download | focaccia-qemu-4ee02f53be79f21602ace1ff4057c45bbf86ca64.tar.gz focaccia-qemu-4ee02f53be79f21602ace1ff4057c45bbf86ca64.zip | |
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180305-pull-request' into staging
ui: build curses, gtk and sdl as modules. # gpg: Signature made Mon 05 Mar 2018 08:48:24 GMT # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20180305-pull-request: ui/sdl: build as module audio: rename CONFIG_* to CONFIG_AUDIO_* ui/curses: build as module ui/gtk: build as module configure: opengl doesn't depend on x11 configure: add X11 vars to config-host.mak console: add ui module loading support console: add and use qemu_display_find_default egl-headless: switch over to new display registry curses: switch over to new display registry cocoa: switch over to new display registry sdl: switch over to new display registry console: add qemu display registry, add gtk Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/console.c')
| -rw-r--r-- | ui/console.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/ui/console.c b/ui/console.c index 6a1f49916e..6ab4ff3baf 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2180,6 +2180,65 @@ PixelFormat qemu_default_pixelformat(int bpp) return pf; } +static QemuDisplay *dpys[DISPLAY_TYPE__MAX]; + +void qemu_display_register(QemuDisplay *ui) +{ + assert(ui->type < DISPLAY_TYPE__MAX); + dpys[ui->type] = ui; +} + +bool qemu_display_find_default(DisplayOptions *opts) +{ + static DisplayType prio[] = { + DISPLAY_TYPE_GTK, + DISPLAY_TYPE_SDL, + DISPLAY_TYPE_COCOA + }; + int i; + + for (i = 0; i < ARRAY_SIZE(prio); i++) { + if (dpys[prio[i]] == NULL) { + ui_module_load_one(DisplayType_lookup.array[prio[i]]); + } + if (dpys[prio[i]] == NULL) { + continue; + } + opts->type = prio[i]; + return true; + } + return false; +} + +void qemu_display_early_init(DisplayOptions *opts) +{ + assert(opts->type < DISPLAY_TYPE__MAX); + if (opts->type == DISPLAY_TYPE_NONE) { + return; + } + if (dpys[opts->type] == NULL) { + ui_module_load_one(DisplayType_lookup.array[opts->type]); + } + if (dpys[opts->type] == NULL) { + error_report("Display '%s' is not available.", + DisplayType_lookup.array[opts->type]); + exit(1); + } + if (dpys[opts->type]->early_init) { + dpys[opts->type]->early_init(opts); + } +} + +void qemu_display_init(DisplayState *ds, DisplayOptions *opts) +{ + assert(opts->type < DISPLAY_TYPE__MAX); + if (opts->type == DISPLAY_TYPE_NONE) { + return; + } + assert(dpys[opts->type] != NULL); + dpys[opts->type]->init(ds, opts); +} + void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **errp) { int val; |