From patchwork Fri Nov 17 10:30:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838959 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZW42vZ1z9rxj for ; Fri, 17 Nov 2017 21:44:48 +1100 (AEDT) Received: from localhost ([::1]:45053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe8c-0004CQ-Fl for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:44:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvE-0000o4-Nu for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvB-0007NB-Ri for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49580) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvB-0007LC-EZ for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B4837C82B for ; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23B795C891; Fri, 17 Nov 2017 10:30:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5FD1EECE; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:23 +0100 Message-Id: <20171117103046.15943-2-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 17 Nov 2017 10:30:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 01/24] sdl: remove -no-frame support 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" SDL2 doesn't support this any more, the SDL_NOFRAME window flag is gone. Drop the code, print a notice when the option is still used. Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 5 ++--- ui/sdl.c | 8 +------- ui/sdl2.c | 7 +------ vl.c | 15 ++++----------- 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 580dfc57ee..7b35778444 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -436,7 +436,7 @@ void surface_gl_setup_viewport(QemuGLShader *gls, /* sdl.c */ #ifdef CONFIG_SDL void sdl_display_early_init(int opengl); -void sdl_display_init(DisplayState *ds, int full_screen, int no_frame); +void sdl_display_init(DisplayState *ds, int full_screen); #else static inline void sdl_display_early_init(int opengl) { @@ -444,8 +444,7 @@ static inline void sdl_display_early_init(int opengl) error_report("SDL support is disabled"); abort(); } -static inline void sdl_display_init(DisplayState *ds, int full_screen, - int no_frame) +static inline void sdl_display_init(DisplayState *ds, int full_screen) { /* This must never be called if CONFIG_SDL is disabled */ error_report("SDL support is disabled"); diff --git a/ui/sdl.c b/ui/sdl.c index 7b71a9ac58..f3adbb7a64 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -48,7 +48,6 @@ static int gui_saved_width; static int gui_saved_height; static int gui_saved_grab; static int gui_fullscreen; -static int gui_noframe; static int gui_key_modifier_pressed; static int gui_keysym; static int gui_grab_code = KMOD_LALT | KMOD_LCTRL; @@ -114,8 +113,6 @@ static void do_sdl_resize(int width, int height, int bpp) } else { flags |= SDL_RESIZABLE; } - if (gui_noframe) - flags |= SDL_NOFRAME; tmp_screen = SDL_SetVideoMode(width, height, bpp, flags); if (!real_screen) { @@ -944,7 +941,7 @@ void sdl_display_early_init(int opengl) } } -void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) +void sdl_display_init(DisplayState *ds, int full_screen) { int flags; uint8_t data = 0; @@ -963,9 +960,6 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) exit(1); } - if (no_frame) - gui_noframe = 1; - if (!full_screen) { setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0); } diff --git a/ui/sdl2.c b/ui/sdl2.c index 53dd447fd2..3802a9b477 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -38,7 +38,6 @@ static int gui_grab; /* if true, all keyboard/mouse events are grabbed */ static int gui_saved_grab; static int gui_fullscreen; -static int gui_noframe; static int gui_key_modifier_pressed; static int gui_keysym; static int gui_grab_code = KMOD_LALT | KMOD_LCTRL; @@ -756,7 +755,7 @@ void sdl_display_early_init(int opengl) } } -void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) +void sdl_display_init(DisplayState *ds, int full_screen) { int flags; uint8_t data = 0; @@ -764,10 +763,6 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) int i; SDL_SysWMinfo info; - if (no_frame) { - gui_noframe = 1; - } - #ifdef __linux__ /* on Linux, SDL may use fbcon|directfb|svgalib when run without * accessible $DISPLAY to open X11 window. This is often the case diff --git a/vl.c b/vl.c index 7372424fa7..4d8553b433 100644 --- a/vl.c +++ b/vl.c @@ -151,7 +151,6 @@ static int rtc_date_offset = -1; /* -1 means no change */ QEMUClockType rtc_clock; int vga_interface_type = VGA_NONE; static int full_screen = 0; -static int no_frame = 0; int no_quit = 0; static bool grab_on_hover; Chardev *serial_hds[MAX_SERIAL_PORTS]; @@ -2165,13 +2164,7 @@ static DisplayType select_display(const char *p) if (strstart(opts, ",frame=", &nextopt)) { opts = nextopt; - if (strstart(opts, "on", &nextopt)) { - no_frame = 0; - } else if (strstart(opts, "off", &nextopt)) { - no_frame = 1; - } else { - goto invalid_sdl_args; - } + warn_report("frame sdl option is unsupported, ignoring"); } else if (strstart(opts, ",alt_grab=", &nextopt)) { opts = nextopt; if (strstart(opts, "on", &nextopt)) { @@ -3784,7 +3777,7 @@ int main(int argc, char **argv, char **envp) full_screen = 1; break; case QEMU_OPTION_no_frame: - no_frame = 1; + warn_report("-no-frame switch is unsupported, ignoring"); break; case QEMU_OPTION_alt_grab: alt_grab = 1; @@ -4473,7 +4466,7 @@ int main(int argc, char **argv, char **envp) #endif } - if ((no_frame || alt_grab || ctrl_grab) && display_type != DT_SDL) { + if ((alt_grab || ctrl_grab) && display_type != DT_SDL) { error_report("-no-frame, -alt-grab and -ctrl-grab are only valid " "for SDL, ignoring option"); } @@ -4824,7 +4817,7 @@ int main(int argc, char **argv, char **envp) curses_display_init(ds, full_screen); break; case DT_SDL: - sdl_display_init(ds, full_screen, no_frame); + sdl_display_init(ds, full_screen); break; case DT_COCOA: cocoa_display_init(ds, full_screen); From patchwork Fri Nov 17 10:30:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZLG5D27z9ryk for ; Fri, 17 Nov 2017 21:37:09 +1100 (AEDT) Received: from localhost ([::1]:45001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe1C-0005A9-U7 for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:37:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvB-0000lr-L8 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdv9-0007JW-Gx for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43546) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdv9-0007Iu-81 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:51 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 636206917 for ; Fri, 17 Nov 2017 10:30:50 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 221B58B11F; Fri, 17 Nov 2017 10:30:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 691EF31FD5; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:24 +0100 Message-Id: <20171117103046.15943-3-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 17 Nov 2017 10:30:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 02/24] sdl: remove -alt-grab and -ctrl-grab support 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" With absolute pointer devices such as usb-tablet being widely used mouse grabs (for relative pointing devices) should be rarely needed these days. So the benefit of the options to configure the hotkey modifiers for grab (and other actions) seems questionable. Which is expecially true for the -ctrl-grab which isn't handled in the handle_keyup() code. Drop the code, print a notice when the option is still used. Signed-off-by: Gerd Hoffmann --- ui/sdl.c | 22 +++------------------- ui/sdl2.c | 23 +++-------------------- vl.c | 26 ++++---------------------- 3 files changed, 10 insertions(+), 61 deletions(-) diff --git a/ui/sdl.c b/ui/sdl.c index f3adbb7a64..2c85482b5e 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -364,12 +364,7 @@ static void sdl_update_caption(void) if (!runstate_is_running()) status = " [Stopped]"; else if (gui_grab) { - if (alt_grab) - status = " - Press Ctrl-Alt-Shift to exit mouse grab"; - else if (ctrl_grab) - status = " - Press Right-Ctrl to exit mouse grab"; - else - status = " - Press Ctrl-Alt to exit mouse grab"; + status = " - Press Ctrl-Alt to exit mouse grab"; } if (qemu_name) { @@ -556,14 +551,7 @@ static void handle_keydown(SDL_Event *ev) int mod_state; int keycode; - if (alt_grab) { - mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) == - (gui_grab_code | KMOD_LSHIFT); - } else if (ctrl_grab) { - mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL; - } else { - mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code; - } + mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code; gui_key_modifier_pressed = mod_state; if (gui_key_modifier_pressed) { @@ -701,11 +689,7 @@ static void handle_keyup(SDL_Event *ev) { int mod_state; - if (!alt_grab) { - mod_state = (ev->key.keysym.mod & gui_grab_code); - } else { - mod_state = (ev->key.keysym.mod & (gui_grab_code | KMOD_LSHIFT)); - } + mod_state = (ev->key.keysym.mod & gui_grab_code); if (!mod_state && gui_key_modifier_pressed) { gui_key_modifier_pressed = 0; if (gui_keysym == 0) { diff --git a/ui/sdl2.c b/ui/sdl2.c index 3802a9b477..e15566877b 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -139,13 +139,7 @@ static void sdl_update_caption(struct sdl2_console *scon) if (!runstate_is_running()) { status = " [Stopped]"; } else if (gui_grab) { - if (alt_grab) { - status = " - Press Ctrl-Alt-Shift to exit grab"; - } else if (ctrl_grab) { - status = " - Press Right-Ctrl to exit grab"; - } else { - status = " - Press Ctrl-Alt to exit grab"; - } + status = " - Press Ctrl-Alt to exit grab"; } if (qemu_name) { @@ -336,14 +330,7 @@ static void handle_keydown(SDL_Event *ev) int mod_state, win; struct sdl2_console *scon = get_scon_from_window(ev->key.windowID); - if (alt_grab) { - mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) == - (gui_grab_code | KMOD_LSHIFT); - } else if (ctrl_grab) { - mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL; - } else { - mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code; - } + mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code; gui_key_modifier_pressed = mod_state; if (gui_key_modifier_pressed) { @@ -420,11 +407,7 @@ static void handle_keyup(SDL_Event *ev) int mod_state; struct sdl2_console *scon = get_scon_from_window(ev->key.windowID); - if (!alt_grab) { - mod_state = (ev->key.keysym.mod & gui_grab_code); - } else { - mod_state = (ev->key.keysym.mod & (gui_grab_code | KMOD_LSHIFT)); - } + mod_state = (ev->key.keysym.mod & gui_grab_code); if (!mod_state && gui_key_modifier_pressed) { gui_key_modifier_pressed = 0; if (gui_keysym == 0) { diff --git a/vl.c b/vl.c index 4d8553b433..7dab7523a6 100644 --- a/vl.c +++ b/vl.c @@ -175,8 +175,6 @@ QEMUOptionRom option_rom[MAX_OPTION_ROMS]; int nb_option_roms; int old_param = 0; const char *qemu_name; -int alt_grab = 0; -int ctrl_grab = 0; unsigned int nb_prom_envs = 0; const char *prom_envs[MAX_PROM_ENVS]; int boot_menu; @@ -2167,22 +2165,10 @@ static DisplayType select_display(const char *p) warn_report("frame sdl option is unsupported, ignoring"); } else if (strstart(opts, ",alt_grab=", &nextopt)) { opts = nextopt; - if (strstart(opts, "on", &nextopt)) { - alt_grab = 1; - } else if (strstart(opts, "off", &nextopt)) { - alt_grab = 0; - } else { - goto invalid_sdl_args; - } + warn_report("ctrl_grab sdl option is unsupported, ignoring"); } else if (strstart(opts, ",ctrl_grab=", &nextopt)) { opts = nextopt; - if (strstart(opts, "on", &nextopt)) { - ctrl_grab = 1; - } else if (strstart(opts, "off", &nextopt)) { - ctrl_grab = 0; - } else { - goto invalid_sdl_args; - } + warn_report("alt_grab sdl option is unsupported, ignoring"); } else if (strstart(opts, ",window_close=", &nextopt)) { opts = nextopt; if (strstart(opts, "on", &nextopt)) { @@ -3780,10 +3766,10 @@ int main(int argc, char **argv, char **envp) warn_report("-no-frame switch is unsupported, ignoring"); break; case QEMU_OPTION_alt_grab: - alt_grab = 1; + warn_report("-alt-grab switch is unsupported, ignoring"); break; case QEMU_OPTION_ctrl_grab: - ctrl_grab = 1; + warn_report("-ctrl-grab switch is unsupported, ignoring"); break; case QEMU_OPTION_no_quit: no_quit = 1; @@ -4466,10 +4452,6 @@ int main(int argc, char **argv, char **envp) #endif } - if ((alt_grab || ctrl_grab) && display_type != DT_SDL) { - error_report("-no-frame, -alt-grab and -ctrl-grab are only valid " - "for SDL, ignoring option"); - } if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) { error_report("-no-quit is only valid for GTK and SDL, " "ignoring option"); From patchwork Fri Nov 17 10:30:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZLy1lGFz9s7h for ; Fri, 17 Nov 2017 21:37:46 +1100 (AEDT) Received: from localhost ([::1]:45003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe1o-0005iZ-91 for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:37:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvB-0000ll-IP for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdv9-0007JM-5i for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54148) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdv8-0007Il-Tj for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D13380473 for ; Fri, 17 Nov 2017 10:30:50 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ED417C19C; Fri, 17 Nov 2017 10:30:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7149C3F139; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:25 +0100 Message-Id: <20171117103046.15943-4-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 17 Nov 2017 10:30:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 03/24] sdl: use ctrl-alt-g as grab hotkey 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: Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Be consistent with gtk and cocoa. Signed-off-by: Gerd Hoffmann --- ui/sdl.c | 26 +++++++++++--------------- ui/sdl2.c | 22 +++++++++------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/ui/sdl.c b/ui/sdl.c index 2c85482b5e..6ce67eeb5a 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -364,7 +364,7 @@ static void sdl_update_caption(void) if (!runstate_is_running()) status = " [Stopped]"; else if (gui_grab) { - status = " - Press Ctrl-Alt to exit mouse grab"; + status = " - Press Ctrl-Alt-G to exit mouse grab"; } if (qemu_name) { @@ -561,6 +561,16 @@ static void handle_keydown(SDL_Event *ev) toggle_full_screen(); gui_keysym = 1; break; + case 0x22: /* 'g' key */ + if (!gui_grab) { + if (qemu_console_is_graphic(NULL)) { + sdl_grab_start(); + } + } else if (!gui_fullscreen) { + sdl_grab_end(); + } + gui_keysym = 1; + break; case 0x16: /* 'u' key on US keyboard */ if (scaling_active) { scaling_active = 0; @@ -692,20 +702,6 @@ static void handle_keyup(SDL_Event *ev) mod_state = (ev->key.keysym.mod & gui_grab_code); if (!mod_state && gui_key_modifier_pressed) { gui_key_modifier_pressed = 0; - if (gui_keysym == 0) { - /* exit/enter grab if pressing Ctrl-Alt */ - if (!gui_grab) { - if (qemu_console_is_graphic(NULL)) { - sdl_grab_start(); - } - } else if (!gui_fullscreen) { - sdl_grab_end(); - } - /* SDL does not send back all the modifiers key, so we must - * correct it. */ - reset_keys(); - return; - } gui_keysym = 0; } if (qemu_console_is_graphic(NULL) && !gui_keysym) { diff --git a/ui/sdl2.c b/ui/sdl2.c index e15566877b..105c461b21 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -139,7 +139,7 @@ static void sdl_update_caption(struct sdl2_console *scon) if (!runstate_is_running()) { status = " [Stopped]"; } else if (gui_grab) { - status = " - Press Ctrl-Alt to exit grab"; + status = " - Press Ctrl-Alt-G to exit grab"; } if (qemu_name) { @@ -364,6 +364,14 @@ static void handle_keydown(SDL_Event *ev) toggle_full_screen(scon); gui_keysym = 1; break; + case SDL_SCANCODE_G: + gui_keysym = 1; + if (!gui_grab) { + sdl_grab_start(scon); + } else if (!gui_fullscreen) { + sdl_grab_end(scon); + } + break; case SDL_SCANCODE_U: sdl2_window_destroy(scon); sdl2_window_create(scon); @@ -410,18 +418,6 @@ static void handle_keyup(SDL_Event *ev) mod_state = (ev->key.keysym.mod & gui_grab_code); if (!mod_state && gui_key_modifier_pressed) { gui_key_modifier_pressed = 0; - if (gui_keysym == 0) { - /* exit/enter grab if pressing Ctrl-Alt */ - if (!gui_grab) { - sdl_grab_start(scon); - } else if (!gui_fullscreen) { - sdl_grab_end(scon); - } - /* SDL does not send back all the modifiers key, so we must - * correct it. */ - sdl2_reset_keys(scon); - return; - } gui_keysym = 0; } if (!gui_keysym) { From patchwork Fri Nov 17 10:30:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZGq6TF6z9ryk for ; Fri, 17 Nov 2017 21:34:11 +1100 (AEDT) Received: from localhost ([::1]:44983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdyL-0002ec-W7 for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:34:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvB-0000lm-Id for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdv9-0007JE-3g for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46924) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdv8-0007Ie-Tp for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:51 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10EE87CB8F for ; Fri, 17 Nov 2017 10:30:50 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2683A8B120; Fri, 17 Nov 2017 10:30:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 786E43F13A; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:26 +0100 Message-Id: <20171117103046.15943-5-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 17 Nov 2017 10:30:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 04/24] vl: rename DisplayType to LegacyDisplayType 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" qapi DisplayType will replace the current enum. For the transition both will coexist though, so rename it so we don't have a name clash. Signed-off-by: Gerd Hoffmann --- vl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vl.c b/vl.c index 7dab7523a6..3310ae60d3 100644 --- a/vl.c +++ b/vl.c @@ -2139,7 +2139,7 @@ static void select_vgahw(const char *p) } } -typedef enum DisplayType { +typedef enum LegacyDisplayType { DT_DEFAULT, DT_CURSES, DT_SDL, @@ -2147,12 +2147,12 @@ typedef enum DisplayType { DT_GTK, DT_EGL, DT_NONE, -} DisplayType; +} LegacyDisplayType; -static DisplayType select_display(const char *p) +static LegacyDisplayType select_display(const char *p) { const char *opts; - DisplayType display = DT_DEFAULT; + LegacyDisplayType display = DT_DEFAULT; if (strstart(p, "sdl", &opts)) { #ifdef CONFIG_SDL @@ -3092,7 +3092,7 @@ int main(int argc, char **argv, char **envp) const char *incoming = NULL; bool userconfig = true; bool nographic = false; - DisplayType display_type = DT_DEFAULT; + LegacyDisplayType display_type = DT_DEFAULT; int display_remote = 0; const char *log_mask = NULL; const char *log_file = NULL; From patchwork Fri Nov 17 10:30:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZSg1xKCz9ryk for ; Fri, 17 Nov 2017 21:42:43 +1100 (AEDT) Received: from localhost ([::1]:45045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe6b-0001yN-As for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:42:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvG-0000pS-1T for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdv9-0007Jj-JO for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51864) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdv9-0007J1-As for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8DB17C03BD52 for ; Fri, 17 Nov 2017 10:30:50 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id F23E36444C; Fri, 17 Nov 2017 10:30:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 82B1B3F417; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:27 +0100 Message-Id: <20171117103046.15943-6-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 Nov 2017 10:30:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 05/24] gtk: add and use DisplayOptions + DisplayGTK 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add QAPI DisplayType enum, DisplayOptions union and DisplayGTK struct. Switch gtk configuration to use the qapi type. Some bookkeeping (fullscreen for example) is done twice now, this is temporary until more/all UIs are switched over to qapi configuration. FIXME: more elegant solution than DisplayNoOpts struct? Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 9 ++++----- ui/gtk.c | 32 ++++++++++++++++++-------------- vl.c | 23 ++++++++++++++++++----- qapi/ui.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 24 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 7b35778444..58d1a3d27c 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -511,18 +511,17 @@ int index_from_key(const char *key, size_t key_length); /* gtk.c */ #ifdef CONFIG_GTK -void early_gtk_display_init(int opengl); -void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover); +void early_gtk_display_init(DisplayOptions *opts); +void gtk_display_init(DisplayState *ds, DisplayOptions *opts); #else -static inline void gtk_display_init(DisplayState *ds, bool full_screen, - bool grab_on_hover) +static inline void gtk_display_init(DisplayState *ds, DisplayOptions *opts) { /* This must never be called if CONFIG_GTK is disabled */ error_report("GTK support is disabled"); abort(); } -static inline void early_gtk_display_init(int opengl) +static inline void early_gtk_display_init(DisplayOptions *opts) { /* This must never be called if CONFIG_GTK is disabled */ error_report("GTK support is disabled"); diff --git a/ui/gtk.c b/ui/gtk.c index 342e96fbe9..c2426dd44e 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -180,6 +180,8 @@ struct GtkDisplayState { bool modifier_pressed[ARRAY_SIZE(modifier_keycode)]; bool has_evdev; bool ignore_keys; + + DisplayOptions *opts; }; typedef struct VCChardev { @@ -728,9 +730,14 @@ static gboolean gd_window_close(GtkWidget *widget, GdkEvent *event, void *opaque) { GtkDisplayState *s = opaque; + bool allow_close = true; int i; - if (!no_quit) { + if (s->opts->has_window_close && !s->opts->window_close) { + allow_close = false; + } + + if (allow_close) { for (i = 0; i < s->nb_vcs; i++) { if (s->vc[i].type != GD_VC_GFX) { continue; @@ -2235,7 +2242,7 @@ static void gd_set_keycode_type(GtkDisplayState *s) static gboolean gtkinit; -void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) +void gtk_display_init(DisplayState *ds, DisplayOptions *opts) { VirtualConsole *vc; @@ -2247,6 +2254,8 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) fprintf(stderr, "gtk initialization failed\n"); exit(1); } + assert(opts->type == DISPLAY_TYPE_GTK); + s->opts = opts; s->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); #if GTK_CHECK_VERSION(3, 2, 0) @@ -2328,17 +2337,19 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) vc && vc->type == GD_VC_VTE); #endif - if (full_screen) { + if (opts->has_full_screen && + opts->full_screen) { gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); } - if (grab_on_hover) { + if (opts->u.gtk.has_grab_on_hover && + opts->u.gtk.grab_on_hover) { gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item)); } gd_set_keycode_type(s); } -void early_gtk_display_init(int opengl) +void early_gtk_display_init(DisplayOptions *opts) { /* The QEMU code relies on the assumption that it's always run in * the C locale. Therefore it is not prepared to deal with @@ -2364,11 +2375,8 @@ void early_gtk_display_init(int opengl) return; } - switch (opengl) { - case -1: /* default */ - case 0: /* off */ - break; - case 1: /* on */ + assert(opts->type == DISPLAY_TYPE_GTK); + if (opts->has_gl && opts->gl) { #if defined(CONFIG_OPENGL) #if defined(CONFIG_GTK_GL) gtk_gl_area_init(); @@ -2376,10 +2384,6 @@ void early_gtk_display_init(int opengl) gtk_egl_init(); #endif #endif - break; - default: - g_assert_not_reached(); - break; } #if defined(CONFIG_VTE) diff --git a/vl.c b/vl.c index 3310ae60d3..af67c86de0 100644 --- a/vl.c +++ b/vl.c @@ -151,8 +151,8 @@ static int rtc_date_offset = -1; /* -1 means no change */ QEMUClockType rtc_clock; int vga_interface_type = VGA_NONE; static int full_screen = 0; +static DisplayOptions dpy; int no_quit = 0; -static bool grab_on_hover; Chardev *serial_hds[MAX_SERIAL_PORTS]; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; Chardev *virtcon_hds[MAX_VIRTIO_CONSOLES]; @@ -2224,24 +2224,29 @@ static LegacyDisplayType select_display(const char *p) } else if (strstart(p, "gtk", &opts)) { #ifdef CONFIG_GTK display = DT_GTK; + dpy.type = DISPLAY_TYPE_GTK; while (*opts) { const char *nextopt; if (strstart(opts, ",grab_on_hover=", &nextopt)) { opts = nextopt; + dpy.u.gtk.has_grab_on_hover = true; if (strstart(opts, "on", &nextopt)) { - grab_on_hover = true; + dpy.u.gtk.grab_on_hover = true; } else if (strstart(opts, "off", &nextopt)) { - grab_on_hover = false; + dpy.u.gtk.grab_on_hover = false; } else { goto invalid_gtk_args; } } else if (strstart(opts, ",gl=", &nextopt)) { opts = nextopt; + dpy.has_gl = true; if (strstart(opts, "on", &nextopt)) { request_opengl = 1; + dpy.gl = true; } else if (strstart(opts, "off", &nextopt)) { request_opengl = 0; + dpy.gl = false; } else { goto invalid_gtk_args; } @@ -2258,6 +2263,7 @@ static LegacyDisplayType select_display(const char *p) #endif } else if (strstart(p, "none", &opts)) { display = DT_NONE; + dpy.type = DISPLAY_TYPE_NONE; } else { error_report("unknown display type"); exit(1); @@ -3374,6 +3380,7 @@ int main(int argc, char **argv, char **envp) qemu_opts_parse_noisily(olist, "graphics=off", false); nographic = true; display_type = DT_NONE; + dpy.type = DISPLAY_TYPE_NONE; break; case QEMU_OPTION_curses: #ifdef CONFIG_CURSES @@ -3761,6 +3768,8 @@ int main(int argc, char **argv, char **envp) break; case QEMU_OPTION_full_screen: full_screen = 1; + dpy.has_full_screen = true; + dpy.full_screen = true; break; case QEMU_OPTION_no_frame: warn_report("-no-frame switch is unsupported, ignoring"); @@ -3773,6 +3782,8 @@ int main(int argc, char **argv, char **envp) break; case QEMU_OPTION_no_quit: no_quit = 1; + dpy.has_window_close = true; + dpy.window_close = false; break; case QEMU_OPTION_sdl: #ifdef CONFIG_SDL @@ -4441,6 +4452,7 @@ int main(int argc, char **argv, char **envp) if (display_type == DT_DEFAULT && !display_remote) { #if defined(CONFIG_GTK) display_type = DT_GTK; + dpy.type = DISPLAY_TYPE_GTK; #elif defined(CONFIG_SDL) display_type = DT_SDL; #elif defined(CONFIG_COCOA) @@ -4449,6 +4461,7 @@ int main(int argc, char **argv, char **envp) vnc_parse("localhost:0,to=99,id=default", &error_abort); #else display_type = DT_NONE; + dpy.type = DISPLAY_TYPE_NONE; #endif } @@ -4458,7 +4471,7 @@ int main(int argc, char **argv, char **envp) } if (display_type == DT_GTK) { - early_gtk_display_init(request_opengl); + early_gtk_display_init(&dpy); } if (display_type == DT_SDL) { @@ -4805,7 +4818,7 @@ int main(int argc, char **argv, char **envp) cocoa_display_init(ds, full_screen); break; case DT_GTK: - gtk_display_init(ds, full_screen, grab_on_hover); + gtk_display_init(ds, &dpy); break; default: break; diff --git a/qapi/ui.json b/qapi/ui.json index 07b468f625..dbb745bd53 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -982,3 +982,47 @@ 'data': { '*device': 'str', '*head' : 'int', 'events' : [ 'InputEvent' ] } } + + +## +# @DisplayNoOpts: +# +# WIP +# +## +{ 'struct' : 'DisplayNoOpts', + 'data' : { } } + +## +# @DisplayGTK: +# +# WIP +# +## +{ 'struct' : 'DisplayGTK', + 'data' : { '*grab-on-hover' : 'bool' } } + +## +# @DisplayType: +# +# WIP +# +## +{ 'enum' : 'DisplayType', + 'data' : [ 'default', 'none', 'gtk' ] } + +## +# @DisplayOptions: +# +# WIP +# +## +{ 'union' : 'DisplayOptions', + 'base' : { 'type' : 'DisplayType', + '*full-screen' : 'bool', + '*window-close' : 'bool', + '*gl' : 'bool' }, + 'discriminator' : 'type', + 'data' : { 'default' : 'DisplayNoOpts', + 'none' : 'DisplayNoOpts', + 'gtk' : 'DisplayGTK' } } From patchwork Fri Nov 17 10:30:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZSg59Jjz9s7h for ; Fri, 17 Nov 2017 21:42:43 +1100 (AEDT) Received: from localhost ([::1]:45046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe6b-0001yU-LT for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:42:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvE-0000nw-G0 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvB-0007N3-Pi for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51898) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvB-0007L6-DK for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 91B4FC01A69E for ; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 005D25C893; Fri, 17 Nov 2017 10:30:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8DE9D409C3; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:28 +0100 Message-Id: <20171117103046.15943-7-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 Nov 2017 10:30:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 06/24] sdl: use DisplayOptions 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch sdl ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 8 ++++---- ui/sdl.c | 19 +++++++++++++------ ui/sdl2.c | 33 +++++++++++++++++++-------------- vl.c | 13 +++++++++++-- qapi/ui.json | 5 +++-- 5 files changed, 50 insertions(+), 28 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 58d1a3d27c..deee5bb606 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -435,16 +435,16 @@ void surface_gl_setup_viewport(QemuGLShader *gls, /* sdl.c */ #ifdef CONFIG_SDL -void sdl_display_early_init(int opengl); -void sdl_display_init(DisplayState *ds, int full_screen); +void sdl_display_early_init(DisplayOptions *opts); +void sdl_display_init(DisplayState *ds, DisplayOptions *opts); #else -static inline void sdl_display_early_init(int opengl) +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, int full_screen) +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"); diff --git a/ui/sdl.c b/ui/sdl.c index 6ce67eeb5a..972592fe42 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -39,6 +39,7 @@ static DisplayChangeListener *dcl; static DisplaySurface *surface; +static DisplayOptions *opts; static SDL_Surface *real_screen; static SDL_Surface *guest_screen = NULL; static int gui_grab; /* if true, all keyboard/mouse events are grabbed */ @@ -788,6 +789,7 @@ static void handle_activation(SDL_Event *ev) static void sdl_refresh(DisplayChangeListener *dcl) { SDL_Event ev1, *ev = &ev1; + bool allow_close = true; int idle = 1; if (last_vm_running != runstate_is_running()) { @@ -812,7 +814,10 @@ static void sdl_refresh(DisplayChangeListener *dcl) handle_keyup(ev); break; case SDL_QUIT: - if (!no_quit) { + if (opts->has_window_close && !opts->window_close) { + allow_close = false; + } + if (allow_close) { no_shutdown = 0; qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); } @@ -911,9 +916,9 @@ static const DisplayChangeListenerOps dcl_ops = { .dpy_cursor_define = sdl_mouse_define, }; -void sdl_display_early_init(int opengl) +void sdl_display_early_init(DisplayOptions *opts) { - if (opengl == 1 /* on */) { + if (opts->has_gl && opts->gl) { fprintf(stderr, "SDL1 display code has no opengl support.\n" "Please recompile qemu with SDL2, using\n" @@ -921,7 +926,7 @@ void sdl_display_early_init(int opengl) } } -void sdl_display_init(DisplayState *ds, int full_screen) +void sdl_display_init(DisplayState *ds, DisplayOptions *o) { int flags; uint8_t data = 0; @@ -929,6 +934,8 @@ void sdl_display_init(DisplayState *ds, int full_screen) SDL_SysWMinfo info; char *filename; + assert(o->type == DISPLAY_TYPE_SDL); + opts = o; #if defined(__APPLE__) /* always use generic keymaps */ if (!keyboard_layout) @@ -940,7 +947,7 @@ void sdl_display_init(DisplayState *ds, int full_screen) exit(1); } - if (!full_screen) { + if (opts->has_full_screen && opts->full_screen) { setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0); } #ifdef __linux__ @@ -981,7 +988,7 @@ void sdl_display_init(DisplayState *ds, int full_screen) g_free(filename); } - if (full_screen) { + if (opts->has_full_screen && opts->full_screen) { gui_fullscreen = 1; sdl_grab_start(); } diff --git a/ui/sdl2.c b/ui/sdl2.c index 105c461b21..34002129e1 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -32,6 +32,7 @@ static int sdl2_num_outputs; static struct sdl2_console *sdl2_console; +static DisplayOptions *opts; static SDL_Surface *guest_sprite_surface; static int gui_grab; /* if true, all keyboard/mouse events are grabbed */ @@ -507,6 +508,7 @@ static void handle_mousewheel(SDL_Event *ev) static void handle_windowevent(SDL_Event *ev) { struct sdl2_console *scon = get_scon_from_window(ev->window.windowID); + bool allow_close = true; if (!scon) { return; @@ -544,7 +546,10 @@ static void handle_windowevent(SDL_Event *ev) update_displaychangelistener(&scon->dcl, 500); break; case SDL_WINDOWEVENT_CLOSE: - if (!no_quit) { + if (opts->has_window_close && !opts->window_close) { + allow_close = false; + } + if (allow_close) { no_shutdown = 0; qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); } @@ -565,6 +570,7 @@ static void handle_windowevent(SDL_Event *ev) void sdl2_poll_events(struct sdl2_console *scon) { SDL_Event ev1, *ev = &ev1; + bool allow_close = true; int idle = 1; if (scon->last_vm_running != runstate_is_running()) { @@ -587,7 +593,10 @@ void sdl2_poll_events(struct sdl2_console *scon) handle_textinput(ev); break; case SDL_QUIT: - if (!no_quit) { + if (opts->has_window_close && !opts->window_close) { + allow_close = false; + } + if (allow_close) { no_shutdown = 0; qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); } @@ -717,24 +726,17 @@ static const DisplayChangeListenerOps dcl_gl_ops = { }; #endif -void sdl_display_early_init(int opengl) +void sdl_display_early_init(DisplayOptions *o) { - switch (opengl) { - case -1: /* default */ - case 0: /* off */ - break; - case 1: /* on */ + assert(o->type == DISPLAY_TYPE_SDL); + if (o->has_gl && o->gl) { #ifdef CONFIG_OPENGL display_opengl = 1; #endif - break; - default: - g_assert_not_reached(); - break; } } -void sdl_display_init(DisplayState *ds, int full_screen) +void sdl_display_init(DisplayState *ds, DisplayOptions *o) { int flags; uint8_t data = 0; @@ -742,6 +744,9 @@ void sdl_display_init(DisplayState *ds, int full_screen) int i; SDL_SysWMinfo info; + assert(o->type == DISPLAY_TYPE_SDL); + opts = o; + #ifdef __linux__ /* on Linux, SDL may use fbcon|directfb|svgalib when run without * accessible $DISPLAY to open X11 window. This is often the case @@ -816,7 +821,7 @@ void sdl_display_init(DisplayState *ds, int full_screen) g_free(filename); } - if (full_screen) { + if (opts->has_full_screen && opts->full_screen) { gui_fullscreen = 1; sdl_grab_start(0); } diff --git a/vl.c b/vl.c index af67c86de0..b34fbf1a09 100644 --- a/vl.c +++ b/vl.c @@ -2157,6 +2157,7 @@ static LegacyDisplayType select_display(const char *p) if (strstart(p, "sdl", &opts)) { #ifdef CONFIG_SDL display = DT_SDL; + dpy.type = DISPLAY_TYPE_SDL; while (*opts) { const char *nextopt; @@ -2171,19 +2172,25 @@ static LegacyDisplayType select_display(const char *p) warn_report("alt_grab sdl option is unsupported, ignoring"); } else if (strstart(opts, ",window_close=", &nextopt)) { opts = nextopt; + dpy.has_window_close = true; if (strstart(opts, "on", &nextopt)) { no_quit = 0; + dpy.window_close = true; } else if (strstart(opts, "off", &nextopt)) { no_quit = 1; + dpy.window_close = false; } else { goto invalid_sdl_args; } } else if (strstart(opts, ",gl=", &nextopt)) { opts = nextopt; + dpy.has_gl = true; if (strstart(opts, "on", &nextopt)) { request_opengl = 1; + dpy.gl = true; } else if (strstart(opts, "off", &nextopt)) { request_opengl = 0; + dpy.gl = false; } else { goto invalid_sdl_args; } @@ -3788,6 +3795,7 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_sdl: #ifdef CONFIG_SDL display_type = DT_SDL; + dpy.type = DISPLAY_TYPE_SDL; break; #else error_report("SDL support is disabled"); @@ -4455,6 +4463,7 @@ int main(int argc, char **argv, char **envp) dpy.type = DISPLAY_TYPE_GTK; #elif defined(CONFIG_SDL) display_type = DT_SDL; + dpy.type = DISPLAY_TYPE_SDL; #elif defined(CONFIG_COCOA) display_type = DT_COCOA; #elif defined(CONFIG_VNC) @@ -4475,7 +4484,7 @@ int main(int argc, char **argv, char **envp) } if (display_type == DT_SDL) { - sdl_display_early_init(request_opengl); + sdl_display_early_init(&dpy); } qemu_console_early_init(); @@ -4812,7 +4821,7 @@ int main(int argc, char **argv, char **envp) curses_display_init(ds, full_screen); break; case DT_SDL: - sdl_display_init(ds, full_screen); + sdl_display_init(ds, &dpy); break; case DT_COCOA: cocoa_display_init(ds, full_screen); diff --git a/qapi/ui.json b/qapi/ui.json index dbb745bd53..e7d3e8729b 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1009,7 +1009,7 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'default', 'none', 'gtk' ] } + 'data' : [ 'default', 'none', 'gtk', 'sdl' ] } ## # @DisplayOptions: @@ -1025,4 +1025,5 @@ 'discriminator' : 'type', 'data' : { 'default' : 'DisplayNoOpts', 'none' : 'DisplayNoOpts', - 'gtk' : 'DisplayGTK' } } + 'gtk' : 'DisplayGTK', + 'sdl' : 'DisplayNoOpts' } } From patchwork Fri Nov 17 10:30:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838943 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZHm0TYbz9ryk for ; Fri, 17 Nov 2017 21:35:00 +1100 (AEDT) Received: from localhost ([::1]:44989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdz8-0003G2-3q for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:34:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvF-0000op-AD for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvE-0007Pp-13 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53924) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvD-0007OO-Ph for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DDAC6D9659 for ; Fri, 17 Nov 2017 10:30:54 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id E37D011A2B9; Fri, 17 Nov 2017 10:30:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 94FEA409CD; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:29 +0100 Message-Id: <20171117103046.15943-8-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 17 Nov 2017 10:30:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 07/24] vl: drop no_quit variable 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Not used any more, delete it. Signed-off-by: Gerd Hoffmann --- vl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vl.c b/vl.c index b34fbf1a09..d461800f13 100644 --- a/vl.c +++ b/vl.c @@ -152,7 +152,6 @@ QEMUClockType rtc_clock; int vga_interface_type = VGA_NONE; static int full_screen = 0; static DisplayOptions dpy; -int no_quit = 0; Chardev *serial_hds[MAX_SERIAL_PORTS]; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; Chardev *virtcon_hds[MAX_VIRTIO_CONSOLES]; @@ -2174,10 +2173,8 @@ static LegacyDisplayType select_display(const char *p) opts = nextopt; dpy.has_window_close = true; if (strstart(opts, "on", &nextopt)) { - no_quit = 0; dpy.window_close = true; } else if (strstart(opts, "off", &nextopt)) { - no_quit = 1; dpy.window_close = false; } else { goto invalid_sdl_args; @@ -3788,7 +3785,6 @@ int main(int argc, char **argv, char **envp) warn_report("-ctrl-grab switch is unsupported, ignoring"); break; case QEMU_OPTION_no_quit: - no_quit = 1; dpy.has_window_close = true; dpy.window_close = false; break; @@ -4474,7 +4470,8 @@ int main(int argc, char **argv, char **envp) #endif } - if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) { + if (dpy.has_window_close && + (display_type != DT_GTK && display_type != DT_SDL)) { error_report("-no-quit is only valid for GTK and SDL, " "ignoring option"); } From patchwork Fri Nov 17 10:30:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838936 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZD32wNbz9sBW for ; Fri, 17 Nov 2017 21:31:47 +1100 (AEDT) Received: from localhost ([::1]:44973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdw1-0000oF-CO for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:31:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvB-0000lq-Jp for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvA-0007KO-Ch for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51880) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvA-0007Jf-6E for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:52 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54057C01F291 for ; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id E55948B11F; Fri, 17 Nov 2017 10:30:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9F112409CE; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:30 +0100 Message-Id: <20171117103046.15943-9-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 Nov 2017 10:30:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 08/24] egl-headless: use DisplayOptions 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch egl-headless ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 2 +- ui/egl-headless.c | 2 +- vl.c | 3 ++- qapi/ui.json | 5 +++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index deee5bb606..4cb623112e 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -530,6 +530,6 @@ static inline void early_gtk_display_init(DisplayOptions *opts) #endif /* egl-headless.c */ -void egl_headless_init(void); +void egl_headless_init(DisplayOptions *opts); #endif diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 5d50226869..38b3766548 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -154,7 +154,7 @@ static const DisplayChangeListenerOps egl_ops = { .dpy_gl_update = egl_scanout_flush, }; -void egl_headless_init(void) +void egl_headless_init(DisplayOptions *opts) { QemuConsole *con; egl_dpy *edpy; diff --git a/vl.c b/vl.c index d461800f13..b5cf02bb46 100644 --- a/vl.c +++ b/vl.c @@ -2214,6 +2214,7 @@ static LegacyDisplayType select_display(const char *p) request_opengl = 1; display_opengl = 1; display = DT_EGL; + dpy.type = DISPLAY_TYPE_EGL_HEADLESS; #else fprintf(stderr, "egl support is disabled\n"); exit(1); @@ -4845,7 +4846,7 @@ int main(int argc, char **argv, char **envp) #ifdef CONFIG_OPENGL_DMABUF if (display_type == DT_EGL) { - egl_headless_init(); + egl_headless_init(&dpy); } #endif diff --git a/qapi/ui.json b/qapi/ui.json index e7d3e8729b..372205c98f 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1009,7 +1009,7 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'default', 'none', 'gtk', 'sdl' ] } + 'data' : [ 'default', 'none', 'gtk', 'sdl', 'egl-headless' ] } ## # @DisplayOptions: @@ -1026,4 +1026,5 @@ 'data' : { 'default' : 'DisplayNoOpts', 'none' : 'DisplayNoOpts', 'gtk' : 'DisplayGTK', - 'sdl' : 'DisplayNoOpts' } } + 'sdl' : 'DisplayNoOpts', + 'egl-headless' : 'DisplayNoOpts' } } From patchwork Fri Nov 17 10:30:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZQ653JVz9ryk for ; Fri, 17 Nov 2017 21:40:30 +1100 (AEDT) Received: from localhost ([::1]:45017 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe4S-0008Gs-KR for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:40:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvB-0000lu-MI for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvA-0007Kf-EH for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46936) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvA-0007Jn-69 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:52 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 64E567CB9C for ; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0222B8B120; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A92FB409D1; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:31 +0100 Message-Id: <20171117103046.15943-10-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 17 Nov 2017 10:30:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 09/24] curses: use DisplayOptions 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch curses ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 4 ++-- ui/curses.c | 2 +- vl.c | 4 +++- qapi/ui.json | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 4cb623112e..9749503aa7 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -496,9 +496,9 @@ static inline int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp) /* curses.c */ #ifdef CONFIG_CURSES -void curses_display_init(DisplayState *ds, int full_screen); +void curses_display_init(DisplayState *ds, DisplayOptions *opts); #else -static inline void curses_display_init(DisplayState *ds, int full_screen) +static inline void curses_display_init(DisplayState *ds, DisplayOptions *opts) { /* This must never be called if CONFIG_CURSES is disabled */ error_report("curses support is disabled"); diff --git a/ui/curses.c b/ui/curses.c index 85503876c0..479b77bd03 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -434,7 +434,7 @@ static const DisplayChangeListenerOps dcl_ops = { .dpy_text_cursor = curses_cursor_position, }; -void curses_display_init(DisplayState *ds, int full_screen) +void curses_display_init(DisplayState *ds, DisplayOptions *opts) { #ifndef _WIN32 if (!isatty(1)) { diff --git a/vl.c b/vl.c index b5cf02bb46..b1036626eb 100644 --- a/vl.c +++ b/vl.c @@ -2222,6 +2222,7 @@ static LegacyDisplayType select_display(const char *p) } else if (strstart(p, "curses", &opts)) { #ifdef CONFIG_CURSES display = DT_CURSES; + dpy.type = DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); exit(1); @@ -3390,6 +3391,7 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_curses: #ifdef CONFIG_CURSES display_type = DT_CURSES; + dpy.type = DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); exit(1); @@ -4816,7 +4818,7 @@ int main(int argc, char **argv, char **envp) /* init local displays */ switch (display_type) { case DT_CURSES: - curses_display_init(ds, full_screen); + curses_display_init(ds, &dpy); break; case DT_SDL: sdl_display_init(ds, &dpy); diff --git a/qapi/ui.json b/qapi/ui.json index 372205c98f..4bb3f938f1 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1009,7 +1009,7 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'default', 'none', 'gtk', 'sdl', 'egl-headless' ] } + 'data' : [ 'default', 'none', 'gtk', 'sdl', 'egl-headless', 'curses' ] } ## # @DisplayOptions: @@ -1027,4 +1027,5 @@ 'none' : 'DisplayNoOpts', 'gtk' : 'DisplayGTK', 'sdl' : 'DisplayNoOpts', - 'egl-headless' : 'DisplayNoOpts' } } + 'egl-headless' : 'DisplayNoOpts', + 'curses' : 'DisplayNoOpts' } } From patchwork Fri Nov 17 10:30:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838947 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZLz0rCKz9s82 for ; Fri, 17 Nov 2017 21:37:47 +1100 (AEDT) Received: from localhost ([::1]:45005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe1o-0005jb-Vg for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:37:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvI-0000rh-44 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvF-0007Rc-5b for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49622) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvE-0007QC-RZ for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:57 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E60386A7DC; Fri, 17 Nov 2017 10:30:55 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 049445FCCC; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BB74E409E2; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:32 +0100 Message-Id: <20171117103046.15943-11-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 17 Nov 2017 10:30:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 10/24] cocoa: use DisplayOptions 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: Peter Maydell , Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch cocoa ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 4 ++-- vl.c | 3 ++- qapi/ui.json | 6 ++++-- ui/cocoa.m | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 9749503aa7..f96fd907d0 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -454,9 +454,9 @@ static inline void sdl_display_init(DisplayState *ds, DisplayOptions *opts) /* cocoa.m */ #ifdef CONFIG_COCOA -void cocoa_display_init(DisplayState *ds, int full_screen); +void cocoa_display_init(DisplayState *ds, DisplayOptions *opts); #else -static inline void cocoa_display_init(DisplayState *ds, int full_screen) +static inline void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) { /* This must never be called if CONFIG_COCOA is disabled */ error_report("Cocoa support is disabled"); diff --git a/vl.c b/vl.c index b1036626eb..7d7e4ba9a1 100644 --- a/vl.c +++ b/vl.c @@ -4465,6 +4465,7 @@ int main(int argc, char **argv, char **envp) dpy.type = DISPLAY_TYPE_SDL; #elif defined(CONFIG_COCOA) display_type = DT_COCOA; + dpy.type = DISPLAY_TYPE_COCOA; #elif defined(CONFIG_VNC) vnc_parse("localhost:0,to=99,id=default", &error_abort); #else @@ -4824,7 +4825,7 @@ int main(int argc, char **argv, char **envp) sdl_display_init(ds, &dpy); break; case DT_COCOA: - cocoa_display_init(ds, full_screen); + cocoa_display_init(ds, &dpy); break; case DT_GTK: gtk_display_init(ds, &dpy); diff --git a/qapi/ui.json b/qapi/ui.json index 4bb3f938f1..2baa5127cf 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1009,7 +1009,8 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'default', 'none', 'gtk', 'sdl', 'egl-headless', 'curses' ] } + 'data' : [ 'default', 'none', 'gtk', 'sdl', + 'egl-headless', 'curses', 'cocoa' ] } ## # @DisplayOptions: @@ -1028,4 +1029,5 @@ 'gtk' : 'DisplayGTK', 'sdl' : 'DisplayNoOpts', 'egl-headless' : 'DisplayNoOpts', - 'curses' : 'DisplayNoOpts' } } + 'curses' : 'DisplayNoOpts', + 'cocoa' : 'DisplayNoOpts' } } diff --git a/ui/cocoa.m b/ui/cocoa.m index 330ccebf90..9560c07105 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1671,12 +1671,12 @@ static void addRemovableDevicesMenuItems(void) qapi_free_BlockInfoList(pointerToFree); } -void cocoa_display_init(DisplayState *ds, int full_screen) +void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) { COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n"); /* if fullscreen mode is to be used */ - if (full_screen == true) { + if (opts->have_full_screen && opts->full_screen) { [NSApp activateIgnoringOtherApps: YES]; [(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil]; } From patchwork Fri Nov 17 10:30:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZHf3mlqz9ryk for ; Fri, 17 Nov 2017 21:34:54 +1100 (AEDT) Received: from localhost ([::1]:44985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdz2-0003Di-HI for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:34:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvB-0000lp-Ji for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvA-0007KX-DV for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41754) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvA-0007Js-7Y for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:52 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7493FC0587C5 for ; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A4A98B121; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C8F92409EE; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:33 +0100 Message-Id: <20171117103046.15943-12-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 17 Nov 2017 10:30:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 11/24] vl: drop full_screen variable 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Not used any more, delete it. Signed-off-by: Gerd Hoffmann --- vl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/vl.c b/vl.c index 7d7e4ba9a1..85c41953b3 100644 --- a/vl.c +++ b/vl.c @@ -150,7 +150,6 @@ static int rtc_utc = 1; static int rtc_date_offset = -1; /* -1 means no change */ QEMUClockType rtc_clock; int vga_interface_type = VGA_NONE; -static int full_screen = 0; static DisplayOptions dpy; Chardev *serial_hds[MAX_SERIAL_PORTS]; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; @@ -3774,7 +3773,6 @@ int main(int argc, char **argv, char **envp) loadvm = optarg; break; case QEMU_OPTION_full_screen: - full_screen = 1; dpy.has_full_screen = true; dpy.full_screen = true; break; From patchwork Fri Nov 17 10:30:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838964 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZcd2GsRz9s7h for ; Fri, 17 Nov 2017 21:49:37 +1100 (AEDT) Received: from localhost ([::1]:45094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFeDH-0007j5-F8 for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:49:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvL-0000uG-Ru for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvE-0007R4-Q9 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51926) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvE-0007PM-Ek for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E8FAC04AC4D for ; Fri, 17 Nov 2017 10:30:55 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E54911A2BF; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D1645409EF; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:34 +0100 Message-Id: <20171117103046.15943-13-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 Nov 2017 10:30:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 12/24] vl: drop display_type variable 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch over all leftover users to qapi DisplayType. The delete the unused display_type variable. Signed-off-by: Gerd Hoffmann --- vl.c | 52 +++++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 39 deletions(-) diff --git a/vl.c b/vl.c index 85c41953b3..36eec0d1e0 100644 --- a/vl.c +++ b/vl.c @@ -2137,24 +2137,12 @@ static void select_vgahw(const char *p) } } -typedef enum LegacyDisplayType { - DT_DEFAULT, - DT_CURSES, - DT_SDL, - DT_COCOA, - DT_GTK, - DT_EGL, - DT_NONE, -} LegacyDisplayType; - -static LegacyDisplayType select_display(const char *p) +static void parse_display(const char *p) { const char *opts; - LegacyDisplayType display = DT_DEFAULT; if (strstart(p, "sdl", &opts)) { #ifdef CONFIG_SDL - display = DT_SDL; dpy.type = DISPLAY_TYPE_SDL; while (*opts) { const char *nextopt; @@ -2212,7 +2200,6 @@ static LegacyDisplayType select_display(const char *p) #ifdef CONFIG_OPENGL_DMABUF request_opengl = 1; display_opengl = 1; - display = DT_EGL; dpy.type = DISPLAY_TYPE_EGL_HEADLESS; #else fprintf(stderr, "egl support is disabled\n"); @@ -2220,7 +2207,6 @@ static LegacyDisplayType select_display(const char *p) #endif } else if (strstart(p, "curses", &opts)) { #ifdef CONFIG_CURSES - display = DT_CURSES; dpy.type = DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); @@ -2228,7 +2214,6 @@ static LegacyDisplayType select_display(const char *p) #endif } else if (strstart(p, "gtk", &opts)) { #ifdef CONFIG_GTK - display = DT_GTK; dpy.type = DISPLAY_TYPE_GTK; while (*opts) { const char *nextopt; @@ -2267,14 +2252,11 @@ static LegacyDisplayType select_display(const char *p) exit(1); #endif } else if (strstart(p, "none", &opts)) { - display = DT_NONE; dpy.type = DISPLAY_TYPE_NONE; } else { error_report("unknown display type"); exit(1); } - - return display; } static int balloon_parse(const char *arg) @@ -3103,7 +3085,6 @@ int main(int argc, char **argv, char **envp) const char *incoming = NULL; bool userconfig = true; bool nographic = false; - LegacyDisplayType display_type = DT_DEFAULT; int display_remote = 0; const char *log_mask = NULL; const char *log_file = NULL; @@ -3378,18 +3359,16 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_display: - display_type = select_display(optarg); + parse_display(optarg); break; case QEMU_OPTION_nographic: olist = qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "graphics=off", false); nographic = true; - display_type = DT_NONE; dpy.type = DISPLAY_TYPE_NONE; break; case QEMU_OPTION_curses: #ifdef CONFIG_CURSES - display_type = DT_CURSES; dpy.type = DISPLAY_TYPE_CURSES; #else error_report("curses support is disabled"); @@ -3791,7 +3770,6 @@ int main(int argc, char **argv, char **envp) break; case QEMU_OPTION_sdl: #ifdef CONFIG_SDL - display_type = DT_SDL; dpy.type = DISPLAY_TYPE_SDL; break; #else @@ -4408,7 +4386,7 @@ int main(int argc, char **argv, char **envp) exit(1); } #ifdef CONFIG_CURSES - if (display_type == DT_CURSES) { + if (dpy.type == DISPLAY_TYPE_CURSES) { error_report("curses display cannot be used with -daemonize"); exit(1); } @@ -4454,35 +4432,31 @@ int main(int argc, char **argv, char **envp) display_remote++; } #endif - if (display_type == DT_DEFAULT && !display_remote) { + if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) { #if defined(CONFIG_GTK) - display_type = DT_GTK; dpy.type = DISPLAY_TYPE_GTK; #elif defined(CONFIG_SDL) - display_type = DT_SDL; dpy.type = DISPLAY_TYPE_SDL; #elif defined(CONFIG_COCOA) - display_type = DT_COCOA; dpy.type = DISPLAY_TYPE_COCOA; #elif defined(CONFIG_VNC) vnc_parse("localhost:0,to=99,id=default", &error_abort); #else - display_type = DT_NONE; dpy.type = DISPLAY_TYPE_NONE; #endif } if (dpy.has_window_close && - (display_type != DT_GTK && display_type != DT_SDL)) { + (dpy.type != DISPLAY_TYPE_GTK && dpy.type != DISPLAY_TYPE_SDL)) { error_report("-no-quit is only valid for GTK and SDL, " "ignoring option"); } - if (display_type == DT_GTK) { + if (dpy.type == DISPLAY_TYPE_GTK) { early_gtk_display_init(&dpy); } - if (display_type == DT_SDL) { + if (dpy.type == DISPLAY_TYPE_SDL) { sdl_display_early_init(&dpy); } @@ -4815,17 +4789,17 @@ int main(int argc, char **argv, char **envp) ds = init_displaystate(); /* init local displays */ - switch (display_type) { - case DT_CURSES: + switch (dpy.type) { + case DISPLAY_TYPE_CURSES: curses_display_init(ds, &dpy); break; - case DT_SDL: + case DISPLAY_TYPE_SDL: sdl_display_init(ds, &dpy); break; - case DT_COCOA: + case DISPLAY_TYPE_COCOA: cocoa_display_init(ds, &dpy); break; - case DT_GTK: + case DISPLAY_TYPE_GTK: gtk_display_init(ds, &dpy); break; default: @@ -4846,7 +4820,7 @@ int main(int argc, char **argv, char **envp) } #ifdef CONFIG_OPENGL_DMABUF - if (display_type == DT_EGL) { + if (dpy.type == DISPLAY_TYPE_EGL_HEADLESS) { egl_headless_init(&dpy); } #endif From patchwork Fri Nov 17 10:30:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZD515p2z9s82 for ; Fri, 17 Nov 2017 21:31:49 +1100 (AEDT) Received: from localhost ([::1]:44974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdw3-0000pc-58 for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:31:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvB-0000lj-Hz for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvA-0007K6-7i for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51878) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvA-0007JS-1P for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4115AC01F290 for ; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id E72676444C; Fri, 17 Nov 2017 10:30:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D895940C16; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:35 +0100 Message-Id: <20171117103046.15943-14-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 Nov 2017 10:30:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 13/24] vl: drop request_opengl variable 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch over the one leftover user to qapi DisplayType. The delete the unused request_opengl variable. Signed-off-by: Gerd Hoffmann --- vl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/vl.c b/vl.c index 36eec0d1e0..c04cef83da 100644 --- a/vl.c +++ b/vl.c @@ -136,7 +136,6 @@ static const char *data_dir[16]; static int data_dir_idx; const char *bios_name = NULL; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; -int request_opengl = -1; int display_opengl; const char* keyboard_layout = NULL; ram_addr_t ram_size; @@ -2170,10 +2169,8 @@ static void parse_display(const char *p) opts = nextopt; dpy.has_gl = true; if (strstart(opts, "on", &nextopt)) { - request_opengl = 1; dpy.gl = true; } else if (strstart(opts, "off", &nextopt)) { - request_opengl = 0; dpy.gl = false; } else { goto invalid_sdl_args; @@ -2198,7 +2195,6 @@ static void parse_display(const char *p) } } else if (strstart(p, "egl-headless", &opts)) { #ifdef CONFIG_OPENGL_DMABUF - request_opengl = 1; display_opengl = 1; dpy.type = DISPLAY_TYPE_EGL_HEADLESS; #else @@ -2232,10 +2228,8 @@ static void parse_display(const char *p) opts = nextopt; dpy.has_gl = true; if (strstart(opts, "on", &nextopt)) { - request_opengl = 1; dpy.gl = true; } else if (strstart(opts, "off", &nextopt)) { - request_opengl = 0; dpy.gl = false; } else { goto invalid_gtk_args; @@ -4462,7 +4456,7 @@ int main(int argc, char **argv, char **envp) qemu_console_early_init(); - if (request_opengl == 1 && display_opengl == 0) { + if (dpy.has_gl && dpy.gl && display_opengl == 0) { #if defined(CONFIG_OPENGL) error_report("OpenGL is not supported by the display"); #else From patchwork Fri Nov 17 10:30:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838963 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZb40tSYz9rxj for ; Fri, 17 Nov 2017 21:48:16 +1100 (AEDT) Received: from localhost ([::1]:45090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFeBy-0006rS-8s for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:48:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvH-0000qs-DR for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvA-0007LH-VG for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53140) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvA-0007K2-Lv for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E29D419D4C9 for ; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61A067C18F; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E29AC40C17; Fri, 17 Nov 2017 11:30:46 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:36 +0100 Message-Id: <20171117103046.15943-15-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 17 Nov 2017 10:30:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 14/24] console: add qemu display registry, add gtk 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a registry for user interfaces. Add qemu_display_init and qemu_display_early_init helper functions for display initialization. Hook up gtk ui as first user. Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 32 ++++++++++++-------------------- ui/console.c | 34 ++++++++++++++++++++++++++++++++++ ui/gtk.c | 17 +++++++++++++++-- vl.c | 18 ++++++------------ 4 files changed, 67 insertions(+), 34 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index f96fd907d0..b293c26477 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -433,6 +433,18 @@ void surface_gl_setup_viewport(QemuGLShader *gls, int ww, int wh); #endif +typedef struct QemuDisplay QemuDisplay; + +struct QemuDisplay { + DisplayType type; + void (*early_init)(DisplayOptions *opts); + void (*init)(DisplayState *ds, DisplayOptions *opts); +}; + +void qemu_display_register(QemuDisplay *ui); +void qemu_display_early_init(DisplayOptions *opts); +void qemu_display_init(DisplayState *ds, DisplayOptions *opts); + /* sdl.c */ #ifdef CONFIG_SDL void sdl_display_early_init(DisplayOptions *opts); @@ -509,26 +521,6 @@ static inline void curses_display_init(DisplayState *ds, DisplayOptions *opts) /* input.c */ int index_from_key(const char *key, size_t key_length); -/* gtk.c */ -#ifdef CONFIG_GTK -void early_gtk_display_init(DisplayOptions *opts); -void gtk_display_init(DisplayState *ds, DisplayOptions *opts); -#else -static inline void gtk_display_init(DisplayState *ds, DisplayOptions *opts) -{ - /* This must never be called if CONFIG_GTK is disabled */ - error_report("GTK support is disabled"); - abort(); -} - -static inline void early_gtk_display_init(DisplayOptions *opts) -{ - /* This must never be called if CONFIG_GTK is disabled */ - error_report("GTK support is disabled"); - abort(); -} -#endif - /* egl-headless.c */ void egl_headless_init(DisplayOptions *opts); diff --git a/ui/console.c b/ui/console.c index c4c95abed7..aa8afbfe26 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2168,6 +2168,40 @@ 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; +} + +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) { + 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; diff --git a/ui/gtk.c b/ui/gtk.c index c2426dd44e..18020543ce 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2242,7 +2242,7 @@ static void gd_set_keycode_type(GtkDisplayState *s) static gboolean gtkinit; -void gtk_display_init(DisplayState *ds, DisplayOptions *opts) +static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) { VirtualConsole *vc; @@ -2349,7 +2349,7 @@ void gtk_display_init(DisplayState *ds, DisplayOptions *opts) gd_set_keycode_type(s); } -void early_gtk_display_init(DisplayOptions *opts) +static void early_gtk_display_init(DisplayOptions *opts) { /* The QEMU code relies on the assumption that it's always run in * the C locale. Therefore it is not prepared to deal with @@ -2390,3 +2390,16 @@ void early_gtk_display_init(DisplayOptions *opts) type_register(&char_gd_vc_type_info); #endif } + +static QemuDisplay qemu_display_gtk = { + .type = DISPLAY_TYPE_GTK, + .early_init = early_gtk_display_init, + .init = gtk_display_init, +}; + +static void register_gtk(void) +{ + qemu_display_register(&qemu_display_gtk); +} + +type_init(register_gtk); diff --git a/vl.c b/vl.c index c04cef83da..57e775f8cd 100644 --- a/vl.c +++ b/vl.c @@ -2209,7 +2209,6 @@ static void parse_display(const char *p) exit(1); #endif } else if (strstart(p, "gtk", &opts)) { -#ifdef CONFIG_GTK dpy.type = DISPLAY_TYPE_GTK; while (*opts) { const char *nextopt; @@ -2241,10 +2240,6 @@ static void parse_display(const char *p) } opts = nextopt; } -#else - error_report("GTK support is disabled"); - exit(1); -#endif } else if (strstart(p, "none", &opts)) { dpy.type = DISPLAY_TYPE_NONE; } else { @@ -4439,6 +4434,9 @@ int main(int argc, char **argv, char **envp) dpy.type = DISPLAY_TYPE_NONE; #endif } + if (dpy.type == DISPLAY_TYPE_DEFAULT) { + dpy.type = DISPLAY_TYPE_NONE; + } if (dpy.has_window_close && (dpy.type != DISPLAY_TYPE_GTK && dpy.type != DISPLAY_TYPE_SDL)) { @@ -4446,12 +4444,10 @@ int main(int argc, char **argv, char **envp) "ignoring option"); } - if (dpy.type == DISPLAY_TYPE_GTK) { - early_gtk_display_init(&dpy); - } - if (dpy.type == DISPLAY_TYPE_SDL) { sdl_display_early_init(&dpy); + } else { + qemu_display_early_init(&dpy); } qemu_console_early_init(); @@ -4793,10 +4789,8 @@ int main(int argc, char **argv, char **envp) case DISPLAY_TYPE_COCOA: cocoa_display_init(ds, &dpy); break; - case DISPLAY_TYPE_GTK: - gtk_display_init(ds, &dpy); - break; default: + qemu_display_init(ds, &dpy); break; } From patchwork Fri Nov 17 10:30:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZHg3sVNz9ryk for ; Fri, 17 Nov 2017 21:34:55 +1100 (AEDT) Received: from localhost ([::1]:44987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdz3-0003Ej-HN for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:34:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvD-0000mU-Qr for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvB-0007MS-Jm for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46942) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvB-0007Kz-7g for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B9067CB8F for ; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id B311E7C19A; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 03F924FD43; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:37 +0100 Message-Id: <20171117103046.15943-16-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 17 Nov 2017 10:30:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 15/24] sdl: hook up to 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- 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 b293c26477..63534ac20a 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -445,25 +445,6 @@ void qemu_display_register(QemuDisplay *ui); void qemu_display_early_init(DisplayOptions *opts); void qemu_display_init(DisplayState *ds, DisplayOptions *opts); -/* 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 972592fe42..cd850277ca 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -916,17 +916,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; @@ -1033,3 +1023,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 34002129e1..0b53a12e54 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -726,7 +726,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) { @@ -736,7 +736,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; @@ -836,3 +836,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); diff --git a/vl.c b/vl.c index 57e775f8cd..474d982da9 100644 --- a/vl.c +++ b/vl.c @@ -2141,7 +2141,6 @@ static void parse_display(const char *p) const char *opts; if (strstart(p, "sdl", &opts)) { -#ifdef CONFIG_SDL dpy.type = DISPLAY_TYPE_SDL; while (*opts) { const char *nextopt; @@ -2182,10 +2181,6 @@ static void parse_display(const char *p) } opts = nextopt; } -#else - error_report("SDL support is disabled"); - exit(1); -#endif } else if (strstart(p, "vnc", &opts)) { if (*opts == '=') { vnc_parse(opts + 1, &error_fatal); @@ -4444,12 +4439,7 @@ int main(int argc, char **argv, char **envp) "ignoring option"); } - if (dpy.type == DISPLAY_TYPE_SDL) { - sdl_display_early_init(&dpy); - } else { - qemu_display_early_init(&dpy); - } - + qemu_display_early_init(&dpy); qemu_console_early_init(); if (dpy.has_gl && dpy.gl && display_opengl == 0) { @@ -4783,9 +4773,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; From patchwork Fri Nov 17 10:30:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZQ66C8Fz9s7h for ; Fri, 17 Nov 2017 21:40:30 +1100 (AEDT) Received: from localhost ([::1]:45019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe4S-0008Ho-Qe for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:40:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvG-0000pj-88 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvE-0007QD-6h for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53928) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvD-0007OY-UC for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CF5EDA313; Fri, 17 Nov 2017 10:30:55 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 424AB11A4C6; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0D1A24FD5F; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:38 +0100 Message-Id: <20171117103046.15943-17-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 17 Nov 2017 10:30:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 16/24] cocoa: hook up to 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: Peter Maydell , Paolo Bonzini , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 12 ------------ vl.c | 3 --- ui/cocoa.m | 14 +++++++++++++- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 63534ac20a..81db3a0f67 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -445,18 +445,6 @@ void qemu_display_register(QemuDisplay *ui); void qemu_display_early_init(DisplayOptions *opts); void qemu_display_init(DisplayState *ds, DisplayOptions *opts); -/* cocoa.m */ -#ifdef CONFIG_COCOA -void cocoa_display_init(DisplayState *ds, DisplayOptions *opts); -#else -static inline void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) -{ - /* This must never be called if CONFIG_COCOA is disabled */ - error_report("Cocoa support is disabled"); - abort(); -} -#endif - /* vnc.c */ void vnc_display_init(const char *id); void vnc_display_open(const char *id, Error **errp); diff --git a/vl.c b/vl.c index 474d982da9..d57671b755 100644 --- a/vl.c +++ b/vl.c @@ -4773,9 +4773,6 @@ int main(int argc, char **argv, char **envp) case DISPLAY_TYPE_CURSES: curses_display_init(ds, &dpy); break; - case DISPLAY_TYPE_COCOA: - cocoa_display_init(ds, &dpy); - break; default: qemu_display_init(ds, &dpy); break; diff --git a/ui/cocoa.m b/ui/cocoa.m index 9560c07105..16d760eae5 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1671,7 +1671,7 @@ static void addRemovableDevicesMenuItems(void) qapi_free_BlockInfoList(pointerToFree); } -void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) +static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) { COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n"); @@ -1701,3 +1701,15 @@ void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) */ addRemovableDevicesMenuItems(); } + +static QemuDisplay qemu_display_cocoa = { + .type = DISPLAY_TYPE_COCOA, + .init = cocoa_display_init, +}; + +static void register_cocoa(void) +{ + qemu_display_register(&qemu_display_cocoa); +} + +type_init(register_cocoa); From patchwork Fri Nov 17 10:30:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838949 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZPR1Trfz9ryk for ; Fri, 17 Nov 2017 21:39:55 +1100 (AEDT) Received: from localhost ([::1]:45013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe3t-0007nx-6A for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:39:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvD-0000mP-Pt for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvB-0007M7-EU for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53142) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvB-0007Ku-5C for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A16B37E8F for ; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id B86D78B103; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 161D84FD60; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:39 +0100 Message-Id: <20171117103046.15943-18-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 17 Nov 2017 10:30:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 17/24] curses: hook up to 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 12 ------------ ui/curses.c | 14 +++++++++++++- vl.c | 17 ++--------------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 81db3a0f67..c93a331d35 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -475,18 +475,6 @@ static inline int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp) } #endif -/* curses.c */ -#ifdef CONFIG_CURSES -void curses_display_init(DisplayState *ds, DisplayOptions *opts); -#else -static inline void curses_display_init(DisplayState *ds, DisplayOptions *opts) -{ - /* This must never be called if CONFIG_CURSES is disabled */ - error_report("curses support is disabled"); - abort(); -} -#endif - /* input.c */ int index_from_key(const char *key, size_t key_length); diff --git a/ui/curses.c b/ui/curses.c index 479b77bd03..d55e6d74a1 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -434,7 +434,7 @@ static const DisplayChangeListenerOps dcl_ops = { .dpy_text_cursor = curses_cursor_position, }; -void curses_display_init(DisplayState *ds, DisplayOptions *opts) +static void curses_display_init(DisplayState *ds, DisplayOptions *opts) { #ifndef _WIN32 if (!isatty(1)) { @@ -455,3 +455,15 @@ void curses_display_init(DisplayState *ds, DisplayOptions *opts) invalidate = 1; } + +static QemuDisplay qemu_display_curses = { + .type = DISPLAY_TYPE_CURSES, + .init = curses_display_init, +}; + +static void register_curses(void) +{ + qemu_display_register(&qemu_display_curses); +} + +type_init(register_curses); diff --git a/vl.c b/vl.c index d57671b755..07f049044b 100644 --- a/vl.c +++ b/vl.c @@ -2197,12 +2197,7 @@ static void parse_display(const char *p) exit(1); #endif } else if (strstart(p, "curses", &opts)) { -#ifdef CONFIG_CURSES dpy.type = DISPLAY_TYPE_CURSES; -#else - error_report("curses support is disabled"); - exit(1); -#endif } else if (strstart(p, "gtk", &opts)) { dpy.type = DISPLAY_TYPE_GTK; while (*opts) { @@ -4766,17 +4761,9 @@ int main(int argc, char **argv, char **envp) qemu_register_reset(restore_boot_order, g_strdup(boot_order)); } - ds = init_displaystate(); - /* init local displays */ - switch (dpy.type) { - case DISPLAY_TYPE_CURSES: - curses_display_init(ds, &dpy); - break; - default: - qemu_display_init(ds, &dpy); - break; - } + ds = init_displaystate(); + qemu_display_init(ds, &dpy); /* must be after terminal init, SDL library changes signal handlers */ os_setup_signal_handling(); From patchwork Fri Nov 17 10:30:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZVW1xdQz9rxj for ; Fri, 17 Nov 2017 21:44:19 +1100 (AEDT) Received: from localhost ([::1]:45051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe89-0003hh-BI for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:44:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvE-0000n0-1K for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvB-0007N9-RT for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41756) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvB-0007LN-Hh for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BBDA1C0587D9 for ; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6635783CA0; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1F0EC4FD62; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:40 +0100 Message-Id: <20171117103046.15943-19-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 17 Nov 2017 10:30:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 18/24] egl-headless: hook up to 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 3 --- ui/egl-headless.c | 20 +++++++++++++++++++- vl.c | 12 ------------ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index c93a331d35..6c89599355 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -478,7 +478,4 @@ static inline 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 diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 38b3766548..655ef4eecb 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -154,7 +154,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; @@ -178,3 +183,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); diff --git a/vl.c b/vl.c index 07f049044b..df0c10398d 100644 --- a/vl.c +++ b/vl.c @@ -2189,13 +2189,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 - fprintf(stderr, "egl support is disabled\n"); - exit(1); -#endif } else if (strstart(p, "curses", &opts)) { dpy.type = DISPLAY_TYPE_CURSES; } else if (strstart(p, "gtk", &opts)) { @@ -4778,12 +4772,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); } From patchwork Fri Nov 17 10:30:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZD72Jq0z9s82 for ; Fri, 17 Nov 2017 21:31:51 +1100 (AEDT) Received: from localhost ([::1]:44975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdw5-0000qd-CW for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:31:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvD-0000mD-OI for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvB-0007Lu-BM for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51896) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvB-0007Kx-5i for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69CABC01A661 for ; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id C215E8B11C; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 27FF14FD63; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:41 +0100 Message-Id: <20171117103046.15943-20-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 Nov 2017 10:30:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 19/24] console: add and use qemu_display_find_default 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 , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Using the new registry instead of #ifdefs in vl.c. Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 1 + ui/console.c | 19 +++++++++++++++++++ vl.c | 15 +++++---------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 6c89599355..7c9e40cc9a 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -442,6 +442,7 @@ struct QemuDisplay { }; void qemu_display_register(QemuDisplay *ui); +bool qemu_display_find_default(DisplayOptions *opts); void qemu_display_early_init(DisplayOptions *opts); void qemu_display_init(DisplayState *ds, DisplayOptions *opts); diff --git a/ui/console.c b/ui/console.c index aa8afbfe26..4c9ac8b21a 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2176,6 +2176,25 @@ void qemu_display_register(QemuDisplay *ui) 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) { + continue; + } + opts->type = prio[i]; + return true; + } + return false; +} + void qemu_display_early_init(DisplayOptions *opts) { assert(opts->type < DISPLAY_TYPE__MAX); diff --git a/vl.c b/vl.c index df0c10398d..f861562bb2 100644 --- a/vl.c +++ b/vl.c @@ -4406,17 +4406,12 @@ int main(int argc, char **argv, char **envp) } #endif if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) { -#if defined(CONFIG_GTK) - dpy.type = DISPLAY_TYPE_GTK; -#elif defined(CONFIG_SDL) - dpy.type = DISPLAY_TYPE_SDL; -#elif defined(CONFIG_COCOA) - dpy.type = DISPLAY_TYPE_COCOA; -#elif defined(CONFIG_VNC) - vnc_parse("localhost:0,to=99,id=default", &error_abort); -#else - dpy.type = DISPLAY_TYPE_NONE; + if (!qemu_display_find_default(&dpy)) { + dpy.type = DISPLAY_TYPE_NONE; +#if defined(CONFIG_VNC) + vnc_parse("localhost:0,to=99,id=default", &error_abort); #endif + } } if (dpy.type == DISPLAY_TYPE_DEFAULT) { dpy.type = DISPLAY_TYPE_NONE; From patchwork Fri Nov 17 10:30:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838948 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZM01zCxz9ryk for ; Fri, 17 Nov 2017 21:37:48 +1100 (AEDT) Received: from localhost ([::1]:45007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe1q-0005lM-8n for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:37:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvH-0000qZ-2n for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvC-0007NT-1W for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53900) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvB-0007Lb-Ou for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCFA8D5704 for ; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95EB66444C; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2FEF94FD7F; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:42 +0100 Message-Id: <20171117103046.15943-21-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 17 Nov 2017 10:30:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 20/24] console: add ui module loading support 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: Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- include/qemu/module.h | 1 + ui/console.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/qemu/module.h b/include/qemu/module.h index 56dd218205..9fea75aaeb 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -53,6 +53,7 @@ typedef enum { #define trace_init(function) module_init(function, MODULE_INIT_TRACE) #define block_module_load_one(lib) module_load_one("block-", lib) +#define ui_module_load_one(lib) module_load_one("ui-", lib) void register_module_init(void (*fn)(void), module_init_type type); void register_dso_module_init(void (*fn)(void), module_init_type type); diff --git a/ui/console.c b/ui/console.c index 4c9ac8b21a..9937da06a4 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2187,6 +2187,9 @@ bool qemu_display_find_default(DisplayOptions *opts) 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]; @@ -2202,6 +2205,9 @@ void qemu_display_early_init(DisplayOptions *opts) 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); From patchwork Fri Nov 17 10:30:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZS85fCjz9s82 for ; Fri, 17 Nov 2017 21:42:15 +1100 (AEDT) Received: from localhost ([::1]:45042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe68-0001UP-Vx for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:42:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvE-0000nt-EA for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvC-0007OC-W4 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53908) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvC-0007Nc-Ng for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:54 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6A9ED9659 for ; Fri, 17 Nov 2017 10:30:53 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1F968B11D; Fri, 17 Nov 2017 10:30:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 38D9598618; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:43 +0100 Message-Id: <20171117103046.15943-22-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 17 Nov 2017 10:30:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 21/24] sdl: build as module 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: Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- configure | 2 +- Makefile.objs | 1 + ui/Makefile.objs | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 0e856bbc04..7d1e9b187d 100755 --- a/configure +++ b/configure @@ -5754,7 +5754,7 @@ if test "$modules" = "yes"; then echo "CONFIG_MODULES=y" >> $config_host_mak fi if test "$sdl" = "yes" ; then - echo "CONFIG_SDL=y" >> $config_host_mak + echo "CONFIG_SDL=m" >> $config_host_mak echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak echo "SDL_LIBS=$sdl_libs" >> $config_host_mak diff --git a/Makefile.objs b/Makefile.objs index 285c6f3c15..a567df479c 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -56,6 +56,7 @@ common-obj-y += hw/ common-obj-y += replay/ common-obj-y += ui/ +common-obj-m += ui/ common-obj-y += bt-host.o bt-vhci.o bt-host.o-cflags := $(BLUEZ_CFLAGS) diff --git a/ui/Makefile.objs b/ui/Makefile.objs index ec8533d6d9..6c13d7e5ed 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -8,15 +8,15 @@ vnc-obj-y += vnc-ws.o vnc-obj-y += vnc-jobs.o common-obj-y += keymaps.o console.o cursor.o qemu-pixman.o -common-obj-y += input.o input-keymap.o input-legacy.o +common-obj-y += input.o input-keymap.o input-legacy.o x_keymap.o common-obj-$(CONFIG_LINUX) += input-linux.o common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o -common-obj-$(CONFIG_SDL) += sdl.mo x_keymap.o common-obj-$(CONFIG_COCOA) += cocoa.o common-obj-$(CONFIG_CURSES) += curses.o common-obj-$(CONFIG_VNC) += $(vnc-obj-y) -common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o +common-obj-$(CONFIG_GTK) += gtk.o +common-obj-$(CONFIG_SDL) += sdl.mo ifeq ($(CONFIG_SDLABI),1.2) sdl.mo-objs := sdl.o sdl_zoom.o endif From patchwork Fri Nov 17 10:30:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838965 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZd5752tz9s82 for ; Fri, 17 Nov 2017 21:50:01 +1100 (AEDT) Received: from localhost ([::1]:45096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFeDg-0007zL-4t for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:50:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvG-0000ps-FH for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvE-0007QO-A2 for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41780) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvD-0007OU-SR for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03117C058EDD for ; Fri, 17 Nov 2017 10:30:55 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id A166111A4C8; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 40F1199AF6; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:44 +0100 Message-Id: <20171117103046.15943-23-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 17 Nov 2017 10:30:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 22/24] gtk: build as module 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: Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- configure | 5 ++--- ui/Makefile.objs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 7d1e9b187d..91c9323a50 100755 --- a/configure +++ b/configure @@ -2470,7 +2470,6 @@ if test "$gtk" != "no"; then gtk_cflags="$gtk_cflags $x11_cflags" gtk_libs="$gtk_libs $x11_libs" fi - libs_softmmu="$gtk_libs $libs_softmmu" gtk="yes" elif test "$gtk" = "yes"; then feature_not_found "gtk" "Install gtk3-devel" @@ -2720,7 +2719,6 @@ if test "$vte" != "no"; then vte_cflags=$($pkg_config --cflags $vtepackage) vte_libs=$($pkg_config --libs $vtepackage) vteversion=$($pkg_config --modversion $vtepackage) - libs_softmmu="$vte_libs $libs_softmmu" vte="yes" elif test "$vte" = "yes"; then if test "$gtkabi" = "3.0"; then @@ -5860,7 +5858,7 @@ if test "$glib_subprocess" = "yes" ; then echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak fi if test "$gtk" = "yes" ; then - echo "CONFIG_GTK=y" >> $config_host_mak + echo "CONFIG_GTK=m" >> $config_host_mak echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak echo "GTK_LIBS=$gtk_libs" >> $config_host_mak @@ -5911,6 +5909,7 @@ fi if test "$vte" = "yes" ; then echo "CONFIG_VTE=y" >> $config_host_mak echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak + echo "VTE_LIBS=$vte_libs" >> $config_host_mak fi if test "$virglrenderer" = "yes" ; then echo "CONFIG_VIRGL=y" >> $config_host_mak diff --git a/ui/Makefile.objs b/ui/Makefile.objs index 6c13d7e5ed..be3dc44cc6 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -14,7 +14,6 @@ common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o common-obj-$(CONFIG_COCOA) += cocoa.o common-obj-$(CONFIG_CURSES) += curses.o common-obj-$(CONFIG_VNC) += $(vnc-obj-y) -common-obj-$(CONFIG_GTK) += gtk.o common-obj-$(CONFIG_SDL) += sdl.mo ifeq ($(CONFIG_SDLABI),1.2) @@ -29,6 +28,11 @@ endif sdl.mo-cflags := $(SDL_CFLAGS) sdl.mo-libs := $(SDL_LIBS) +common-obj-$(CONFIG_GTK) += gtk.mo +gtk.mo-objs := gtk.o +gtk.mo-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) +gtk.mo-libs := $(GTK_LIBS) $(VTE_LIBS) + ifeq ($(CONFIG_OPENGL),y) common-obj-y += shader.o common-obj-y += console-gl.o @@ -36,17 +40,13 @@ common-obj-y += egl-helpers.o common-obj-y += egl-context.o common-obj-$(CONFIG_OPENGL_DMABUF) += egl-headless.o ifeq ($(CONFIG_GTK_GL),y) -common-obj-$(CONFIG_GTK) += gtk-gl-area.o +gtk.mo-objs += gtk-gl-area.o else -common-obj-$(CONFIG_GTK) += gtk-egl.o +gtk.mo-objs += gtk-egl.o +gtk.mo-libs += $(OPENGL_LIBS) endif endif -gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) -gtk-egl.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) -gtk-gl-area.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) - -gtk-egl.o-libs += $(OPENGL_LIBS) shader.o-libs += $(OPENGL_LIBS) console-gl.o-libs += $(OPENGL_LIBS) egl-helpers.o-libs += $(OPENGL_LIBS) From patchwork Fri Nov 17 10:30:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZXY3RJbz9rxj for ; Fri, 17 Nov 2017 21:46:05 +1100 (AEDT) Received: from localhost ([::1]:45082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFe9r-0005Rf-KU for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:46:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvE-0000o2-Lp for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvC-0007NY-2R for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49582) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvB-0007Ln-QC for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:53 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED3427C830 for ; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99B0F7C18F; Fri, 17 Nov 2017 10:30:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4904799AF7; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:45 +0100 Message-Id: <20171117103046.15943-24-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 17 Nov 2017 10:30:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 23/24] curses: build as module 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: Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- configure | 6 +++--- ui/Makefile.objs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 91c9323a50..67a8c2e83a 100755 --- a/configure +++ b/configure @@ -3190,8 +3190,6 @@ EOF unset IFS if compile_prog "$curses_inc" "$curses_lib" ; then curses_found=yes - QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS" - libs_softmmu="$curses_lib $libs_softmmu" break fi done @@ -5761,7 +5759,9 @@ if test "$cocoa" = "yes" ; then echo "CONFIG_COCOA=y" >> $config_host_mak fi if test "$curses" = "yes" ; then - echo "CONFIG_CURSES=y" >> $config_host_mak + echo "CONFIG_CURSES=m" >> $config_host_mak + echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak + echo "CURSES_LIBS=$curses_lib" >> $config_host_mak fi if test "$pipe2" = "yes" ; then echo "CONFIG_PIPE2=y" >> $config_host_mak diff --git a/ui/Makefile.objs b/ui/Makefile.objs index be3dc44cc6..42ef071d17 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -12,7 +12,6 @@ common-obj-y += input.o input-keymap.o input-legacy.o x_keymap.o common-obj-$(CONFIG_LINUX) += input-linux.o common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o common-obj-$(CONFIG_COCOA) += cocoa.o -common-obj-$(CONFIG_CURSES) += curses.o common-obj-$(CONFIG_VNC) += $(vnc-obj-y) common-obj-$(CONFIG_SDL) += sdl.mo @@ -33,6 +32,11 @@ gtk.mo-objs := gtk.o gtk.mo-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) gtk.mo-libs := $(GTK_LIBS) $(VTE_LIBS) +common-obj-$(CONFIG_CURSES) += curses.mo +curses.mo-objs := curses.o +curses.mo-cflags := $(CURSES_CFLAGS) +curses.mo-libs := $(CURSES_LIBS) + ifeq ($(CONFIG_OPENGL),y) common-obj-y += shader.o common-obj-y += console-gl.o From patchwork Fri Nov 17 10:30:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 838961 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydZY16zJtz9rxj for ; Fri, 17 Nov 2017 21:46:29 +1100 (AEDT) Received: from localhost ([::1]:45084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFeAG-0005iV-4a for incoming@patchwork.ozlabs.org; Fri, 17 Nov 2017 05:46:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFdvE-0000nv-Fs for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:31:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFdvC-0007Nn-GT for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51908) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFdvC-0007Mb-9R for qemu-devel@nongnu.org; Fri, 17 Nov 2017 05:30:54 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6BFD3C014170 for ; Fri, 17 Nov 2017 10:30:53 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-103.ams2.redhat.com [10.36.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 146DA7C199; Fri, 17 Nov 2017 10:30:53 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 501AE99AFA; Fri, 17 Nov 2017 11:30:47 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 17 Nov 2017 11:30:46 +0100 Message-Id: <20171117103046.15943-25-kraxel@redhat.com> In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com> References: <20171117103046.15943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 Nov 2017 10:30:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 24/24] build: opengl should not need X11 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: Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Gerd Hoffmann --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 67a8c2e83a..e344c0d08e 100755 --- a/configure +++ b/configure @@ -3685,8 +3685,8 @@ libs_softmmu="$libs_softmmu $fdt_libs" if test "$opengl" != "no" ; then opengl_pkgs="epoxy libdrm gbm" if $pkg_config $opengl_pkgs x11; then - opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags" - opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs" + opengl_cflags="$($pkg_config --cflags $opengl_pkgs)" + opengl_libs="$($pkg_config --libs $opengl_pkgs)" opengl=yes if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then gtk_gl="yes"