From nobody Wed Oct 22 13:02:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519820542063172.3865904548884; Wed, 28 Feb 2018 04:22:22 -0800 (PST) Received: from localhost ([::1]:43633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er0kW-0003E0-OY for importer@patchew.org; Wed, 28 Feb 2018 07:22:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er0ff-0007mG-U6 for qemu-devel@nongnu.org; Wed, 28 Feb 2018 07:17:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er0fc-0002GN-SF for qemu-devel@nongnu.org; Wed, 28 Feb 2018 07:17:19 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34621 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1er0fc-0002F6-Jh for qemu-devel@nongnu.org; Wed, 28 Feb 2018 07:17:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5518A40FB65B for ; Wed, 28 Feb 2018 12:17:11 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC845946BF; Wed, 28 Feb 2018 12:17:04 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EA3E717535; Wed, 28 Feb 2018 13:17:03 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 13:16:54 +0100 Message-Id: <20180228121703.20816-3-kraxel@redhat.com> In-Reply-To: <20180228121703.20816-1-kraxel@redhat.com> References: <20180228121703.20816-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 28 Feb 2018 12:17:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 28 Feb 2018 12:17:11 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 02/11] sdl: switch over to new display registry X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Message-id: 20180221131537.31341-3-kraxel@redhat.com --- include/ui/console.h | 19 ------------------- ui/sdl.c | 24 +++++++++++++----------- ui/sdl2.c | 17 +++++++++++++++-- vl.c | 15 +-------------- 4 files changed, 29 insertions(+), 46 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 817f9b9bcc..cb86e6a0dd 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -444,25 +444,6 @@ void qemu_display_register(QemuDisplay *ui); void qemu_display_early_init(DisplayOptions *opts); void qemu_display_init(DisplayState *ds, DisplayOptions *opts); =20 -/* sdl.c */ -#ifdef CONFIG_SDL -void sdl_display_early_init(DisplayOptions *opts); -void sdl_display_init(DisplayState *ds, DisplayOptions *opts); -#else -static inline void sdl_display_early_init(DisplayOptions *opts) -{ - /* This must never be called if CONFIG_SDL is disabled */ - error_report("SDL support is disabled"); - abort(); -} -static inline void sdl_display_init(DisplayState *ds, DisplayOptions *opts) -{ - /* This must never be called if CONFIG_SDL is disabled */ - error_report("SDL support is disabled"); - abort(); -} -#endif - /* cocoa.m */ #ifdef CONFIG_COCOA void cocoa_display_init(DisplayState *ds, DisplayOptions *opts); 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 =3D { .dpy_cursor_define =3D sdl_mouse_define, }; =20 -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=3D2.0\n"); - } -} - -void sdl_display_init(DisplayState *ds, DisplayOptions *o) +static void sdl1_display_init(DisplayState *ds, DisplayOptions *o) { int flags; uint8_t data =3D 0; @@ -1023,3 +1013,15 @@ void sdl_display_init(DisplayState *ds, DisplayOptio= ns *o) =20 atexit(sdl_cleanup); } + +static QemuDisplay qemu_display_sdl1 =3D { + .type =3D DISPLAY_TYPE_SDL, + .init =3D 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 =3D { }; #endif =20 -void sdl_display_early_init(DisplayOptions *o) +static void sdl2_display_early_init(DisplayOptions *o) { assert(o->type =3D=3D DISPLAY_TYPE_SDL); if (o->has_gl && o->gl) { @@ -761,7 +761,7 @@ void sdl_display_early_init(DisplayOptions *o) } } =20 -void sdl_display_init(DisplayState *ds, DisplayOptions *o) +static void sdl2_display_init(DisplayState *ds, DisplayOptions *o) { int flags; uint8_t data =3D 0; @@ -861,3 +861,16 @@ void sdl_display_init(DisplayState *ds, DisplayOptions= *o) =20 atexit(sdl_cleanup); } + +static QemuDisplay qemu_display_sdl2 =3D { + .type =3D DISPLAY_TYPE_SDL, + .early_init =3D sdl2_display_early_init, + .init =3D sdl2_display_init, +}; + +static void register_sdl1(void) +{ + qemu_display_register(&qemu_display_sdl2); +} + +type_init(register_sdl1); diff --git a/vl.c b/vl.c index 70458ba708..45900ba7e6 100644 --- a/vl.c +++ b/vl.c @@ -2085,7 +2085,6 @@ static void parse_display(const char *p) const char *opts; =20 if (strstart(p, "sdl", &opts)) { -#ifdef CONFIG_SDL dpy.type =3D DISPLAY_TYPE_SDL; while (*opts) { const char *nextopt; @@ -2146,10 +2145,6 @@ static void parse_display(const char *p) } opts =3D nextopt; } -#else - error_report("SDL support is disabled"); - exit(1); -#endif } else if (strstart(p, "vnc", &opts)) { if (*opts =3D=3D '=3D') { vnc_parse(opts + 1, &error_fatal); @@ -4327,12 +4322,7 @@ int main(int argc, char **argv, char **envp) "ignoring option"); } =20 - if (dpy.type =3D=3D DISPLAY_TYPE_SDL) { - sdl_display_early_init(&dpy); - } else { - qemu_display_early_init(&dpy); - } - + qemu_display_early_init(&dpy); qemu_console_early_init(); =20 if (dpy.has_gl && dpy.gl && display_opengl =3D=3D 0) { @@ -4664,9 +4654,6 @@ int main(int argc, char **argv, char **envp) case DISPLAY_TYPE_CURSES: curses_display_init(ds, &dpy); break; - case DISPLAY_TYPE_SDL: - sdl_display_init(ds, &dpy); - break; case DISPLAY_TYPE_COCOA: cocoa_display_init(ds, &dpy); break; --=20 2.9.3