RfC: rework display initialization
cover RfC: rework display initialization
Hi,
This series reworks the qemu display initialization. Changes:
* Create a QAPI DisplayOptions type for display configuration.
* Switch all display initialization calls to accept DisplayOptions instead of a bunch of bools.
* Add a registry for displays, and remove alot of #ifdefs from vl.c
* Build sdl, gtk and curses as modules.
For now I'm looking for comments especially on the DisplayOptions QAPI type. Is there a more elegant way than the empty DisplayNoOpts struct (see patch #5)?
cheers,
Gerd
Gerd Hoffmann (24):
sdl: remove -no-frame support
sdl: remove -alt-grab and -ctrl-grab support
sdl: use ctrl-alt-g as grab hotkey
vl: rename DisplayType to LegacyDisplayType
gtk: add and use DisplayOptions + DisplayGTK
sdl: use DisplayOptions
vl: drop no_quit variable
egl-headless: use DisplayOptions
curses: use DisplayOptions
cocoa: use DisplayOptions
vl: drop full_screen variable
vl: drop display_type variable
vl: drop request_opengl variable
console: add qemu display registry, add gtk
sdl: hook up to display registry
cocoa: hook up to display registry
curses: hook up to display registry
egl-headless: hook up to display registry
console: add and use qemu_display_find_default
console: add ui module loading support
sdl: build as module
gtk: build as module
curses: build as module
build: opengl should not need X11
configure | 17 +++-- Makefile.objs | 1 + include/qemu/module.h | 1 + include/ui/console.h | 77 +++------------------ ui/console.c | 59 ++++++++++++++++ ui/curses.c | 14 +++- ui/egl-headless.c | 20 +++++- ui/gtk.c | 45 ++++++++---- ui/sdl.c | 89 ++++++++++-------------- ui/sdl2.c | 92 ++++++++++++------------- vl.c | 186 +++++++++++++------------------------------------- qapi/ui.json | 49 +++++++++++++ ui/Makefile.objs | 26 ++++--- ui/cocoa.m | 16 ++++- 14 files changed, 348 insertions(+), 344 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/24 sdl: remove -no-frame support
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.
--- include/ui/console.h | 5 ++--- ui/sdl.c | 8 +------- ui/sdl2.c | 7 +------ vl.c | 15 ++++----------- 4 files changed, 8 insertions(+), 27 deletions(-)
include/ui/console.h +2 -3
@@ -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" );
ui/sdl.c +1 -7
@@ -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 ); }
ui/sdl2.c +1 -6
@@ -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
vl.c +4 -11
@@ -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);
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH 01/24] sdl: remove -no-frame support
Quoted 10 lines · Gerd Hoffmann
SDL2 doesn't support this any more, the
SDL_NOFRAMEwindow flag is gone. Drop the code, print a notice when the option is still used.Signed-off-by Gerd Hoffmann <[email protected]>--- include/ui/console.h | 5 ++--- ui/sdl.c | 8 +------- ui/sdl2.c | 7 +------ vl.c | 15 ++++----------- 4 files changed, 8 insertions(+), 27 deletions(-)
This needs to go through the deprecation process before we can drop it. There's still time to get it into 2.11 deprecated list which would cut the time needed to wait for real deletion.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [Qemu-devel] [PATCH 01/24] sdl: remove -no-frame support
Quoted 12 lines · Daniel P. Berrange
Quoted 10 lines · Gerd Hoffmann
SDL2 doesn't support this any more, the
SDL_NOFRAMEwindow flag is gone. Drop the code, print a notice when the option is still used.Signed-off-by Gerd Hoffmann <[email protected]>--- include/ui/console.h | 5 ++--- ui/sdl.c | 8 +------- ui/sdl2.c | 7 +------ vl.c | 15 ++++----------- 4 files changed, 8 insertions(+), 27 deletions(-)
Quoted 3 lines
This needs to go through the deprecation process before we can drop it. There's still time to get it into 2.11 deprecated list which would cut the time needed to wait for real deletion.
I fail to see the point. SDL2 simply doesn't support it, so it never worked with SDL2. We switched to SDL2 as default recently. So it seems fair to me to just say so instead of silently ignoring the option ...
cheers,
Gerd
Re: [Qemu-devel] [PATCH 01/24] sdl: remove -no-frame support
Quoted 13 lines · Gerd Hoffmann
Quoted 12 lines · Daniel P. Berrange
Quoted 10 lines · Gerd Hoffmann
SDL2 doesn't support this any more, the
SDL_NOFRAMEwindow flag is gone. Drop the code, print a notice when the option is still used.Signed-off-by Gerd Hoffmann <[email protected]>--- include/ui/console.h | 5 ++--- ui/sdl.c | 8 +------- ui/sdl2.c | 7 +------ vl.c | 15 ++++----------- 4 files changed, 8 insertions(+), 27 deletions(-)
Quoted 7 lines
Quoted 3 lines
This needs to go through the deprecation process before we can drop it. There's still time to get it into 2.11 deprecated list which would cut the time needed to wait for real deletion.
I fail to see the point. SDL2 simply doesn't support it, so it never worked with SDL2. We switched to SDL2 as default recently. So it seems fair to me to just say so instead of silently ignoring the option ...
We still support SDL don't we, which does support it, and which this option was targetted at ?
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [Qemu-devel] [PATCH 01/24] sdl: remove -no-frame support
Quoted 18 lines · Daniel P. Berrange
Quoted 17 lines · Gerd Hoffmann
Quoted 15 lines · Daniel P. Berrange
Quoted 10 lines · Gerd Hoffmann
SDL2 doesn't support this any more, the
SDL_NOFRAMEwindow flag is gone. Drop the code, print a notice when the option is still used.Signed-off-by Gerd Hoffmann <[email protected]>--- include/ui/console.h | 5 ++--- ui/sdl.c | 8 +------- ui/sdl2.c | 7 +------ vl.c | 15 ++++----------- 4 files changed, 8 insertions(+), 27 deletions(-)This needs to go through the deprecation process before we can drop it. There's still time to get it into 2.11 deprecated list which would cut the time needed to wait for real deletion.
Quoted 6 lines
Quoted 3 lines
I fail to see the point. SDL2 simply doesn't support it, so it never worked with SDL2. We switched to SDL2 as default recently. So it seems fair to me to just say so instead of silently ignoring the option ...
We still support SDL don't we, which does support it, and which this option was targetted at ?
Perhaps we might even consider deprecating SDL1 as a whole, then the deprecation of -no-frame is a natural side effect ?
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH 2/24 sdl: remove -alt-grab and -ctrl-grab support
In reply to Gerd HoffmannWith 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.
--- ui/sdl.c | 22 +++------------------- ui/sdl2.c | 23 +++-------------------- vl.c | 26 ++++---------------------- 3 files changed, 10 insertions(+), 61 deletions(-)
ui/sdl.c +3 -19
@@ -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 ) {
ui/sdl2.c +3 -20
@@ -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 ) {
vl.c +4 -22
@@ -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" );
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH 02/24] sdl: remove -alt-grab and -ctrl-grab support
Quoted 8 lines · Gerd Hoffmann
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.
These need to go through the proper deprecation process too.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [Qemu-devel] [PATCH 02/24] sdl: remove -alt-grab and -ctrl-grab support
Quoted 11 lines · Daniel P. Berrange
Quoted 8 lines · Gerd Hoffmann
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.
These need to go through the proper deprecation process too.
Ok, will do.
cheers,
Gerd
PATCH 3/24 sdl: use ctrl-alt-g as grab hotkey
In reply to Gerd HoffmannBe consistent with gtk and cocoa.
--- ui/sdl.c | 26 +++++++++++--------------- ui/sdl2.c | 22 +++++++++------------- 2 files changed, 20 insertions(+), 28 deletions(-)
ui/sdl.c +11 -15
@@ -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) {
ui/sdl2.c +9 -13
@@ -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) {
Signature · 1 line
2.9.3
PATCH 4/24 vl: rename DisplayType to LegacyDisplayType
In reply to Gerd Hoffmannqapi DisplayType will replace the current enum. For the transition both will coexist though, so rename it so we don't have a name clash.
--- vl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
vl.c +5 -5
@@ -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 ;
Signature · 1 line
2.9.3
PATCH 5/24 gtk: add and use DisplayOptions + DisplayGTK
In reply to Gerd HoffmannAdd 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?
--- include/ui/console.h | 9 ++++----- ui/gtk.c | 32 ++++++++++++++++++-------------- vl.c | 23 ++++++++++++++++++----- qapi/ui.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 24 deletions(-)
include/ui/console.h +4 -5
@@ -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" );
ui/gtk.c +18 -14
@@ -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 )
vl.c +18 -5
@@ -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 ;
qapi/ui.json +44 -0
47 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 6/24 sdl: use DisplayOptions
In reply to Gerd HoffmannSwitch sdl ui to use qapi DisplayOptions for configuration.
--- 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(-)
include/ui/console.h +4 -4
@@ -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" );
ui/sdl.c +13 -6
@@ -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 (); }
ui/sdl2.c +19 -14
@@ -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 ); }
vl.c +11 -2
@@ -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);
qapi/ui.json +3 -2
@@ -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' } }
Signature · 1 line
2.9.3
PATCH 7/24 vl: drop no_quit variable
In reply to Gerd HoffmannNot used any more, delete it.
--- vl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
vl.c +2 -5
@@ -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" ); }
Signature · 1 line
2.9.3
PATCH 8/24 egl-headless: use DisplayOptions
In reply to Gerd HoffmannSwitch egl-headless ui to use qapi DisplayOptions for configuration.
--- include/ui/console.h | 2 +- ui/egl-headless.c | 2 +- vl.c | 3 ++- qapi/ui.json | 5 +++-- 4 files changed, 7 insertions(+), 5 deletions(-)
include/ui/console.h +1 -1
@@ -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
ui/egl-headless.c +1 -1
@@ -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;
vl.c +2 -1
@@ -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
qapi/ui.json +3 -2
@@ -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' } }
Signature · 1 line
2.9.3
PATCH 9/24 curses: use DisplayOptions
In reply to Gerd HoffmannSwitch curses ui to use qapi DisplayOptions for configuration.
--- include/ui/console.h | 4 ++-- ui/curses.c | 2 +- vl.c | 4 +++- qapi/ui.json | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-)
include/ui/console.h +2 -2
@@ -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" );
ui/curses.c +1 -1
@@ -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 _WIN32if (!isatty (1 )) {
vl.c +3 -1
@@ -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);
qapi/ui.json +3 -2
@@ -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' } }
Signature · 1 line
2.9.3
PATCH 10/24 cocoa: use DisplayOptions
In reply to Gerd HoffmannSwitch cocoa ui to use qapi DisplayOptions for configuration.
--- include/ui/console.h | 4 ++-- vl.c | 3 ++- qapi/ui.json | 6 ++++-- ui/cocoa.m | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-)
include/ui/console.h +2 -2
@@ -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" );
vl.c +2 -1
@@ -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);
qapi/ui.json +4 -2
@@ -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' } }
ui/cocoa.m +2 -2
@@ -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]; }
Signature · 1 line
2.9.3
PATCH 11/24 vl: drop full_screen variable
In reply to Gerd HoffmannNot used any more, delete it.
--- vl.c | 2 -- 1 file changed, 2 deletions(-)
vl.c +0 -2
@@ -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 ;
Signature · 1 line
2.9.3
PATCH 12/24 vl: drop display_type variable
In reply to Gerd HoffmannSwitch over all leftover users to qapi DisplayType. The delete the unused display_type variable.
--- vl.c | 52 +++++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 39 deletions(-)
vl.c +13 -39
@@ -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
Signature · 1 line
2.9.3
PATCH 13/24 vl: drop request_opengl variable
In reply to Gerd HoffmannSwitch over the one leftover user to qapi DisplayType. The delete the unused request_opengl variable.
--- vl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
vl.c +1 -7
@@ -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
Signature · 1 line
2.9.3
PATCH 14/24 console: add qemu display registry, add gtk
In reply to Gerd HoffmannAdd 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.
--- include/ui/console.h | 32 ++++++++++++-------------------- ui/console.c | 34 ++++++++++++++++++++++++++++++++++ ui/gtk.c | 17 +++++++++++++++-- vl.c | 18 ++++++------------ 4 files changed, 67 insertions(+), 34 deletions(-)
include/ui/console.h +12 -20
@@ -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);
ui/console.c +34 -0
@@ -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;
ui/gtk.c +15 -2
@@ -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);
vl.c +6 -12
@@ -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 ; }
Signature · 1 line
2.9.3
PATCH 15/24 sdl: hook up to display registry
In reply to 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(-)
include/ui/console.h +0 -19
@@ -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);
ui/sdl.c +13 -11
@@ -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);
ui/sdl2.c +15 -2
@@ -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);
vl.c +1 -14
@@ -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 ;
Signature · 1 line
2.9.3
PATCH 16/24 cocoa: hook up to display registry
In reply to Gerd Hoffmann--- include/ui/console.h | 12 ------------ vl.c | 3 --- ui/cocoa.m | 14 +++++++++++++- 3 files changed, 13 insertions(+), 16 deletions(-)
include/ui/console.h +0 -12
@@ -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);
vl.c +0 -3
@@ -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 ;
ui/cocoa.m +13 -1
@@ -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);
Signature · 1 line
2.9.3
PATCH 17/24 curses: hook up to display registry
In reply to Gerd Hoffmann--- include/ui/console.h | 12 ------------ ui/curses.c | 14 +++++++++++++- vl.c | 17 ++--------------- 3 files changed, 15 insertions(+), 28 deletions(-)
include/ui/console.h +0 -12
@@ -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);
ui/curses.c +13 -1
@@ -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 _WIN32if (!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);
vl.c +2 -15
@@ -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 ();
Signature · 1 line
2.9.3
PATCH 18/24 egl-headless: hook up to display registry
In reply to Gerd Hoffmann--- include/ui/console.h | 3 --- ui/egl-headless.c | 20 +++++++++++++++++++- vl.c | 12 ------------ 3 files changed, 19 insertions(+), 16 deletions(-)
include/ui/console.h +0 -3
@@ -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
ui/egl-headless.c +19 -1
@@ -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);
vl.c +0 -12
@@ -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 ); }
Signature · 1 line
2.9.3
PATCH 19/24 console: add and use qemu_display_find_default
In reply to Gerd HoffmannUsing the new registry instead of #ifdefs in vl.c.
--- include/ui/console.h | 1 + ui/console.c | 19 +++++++++++++++++++ vl.c | 15 +++++---------- 3 files changed, 25 insertions(+), 10 deletions(-)
include/ui/console.h +1 -0
@@ -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);
ui/console.c +19 -0
@@ -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 );
vl.c +5 -10
@@ -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 ;
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH 19/24] console: add and use qemu_display_find_default
Quoted 64 lines · Gerd Hoffmann
Using the new registry instead of #ifdefs in
vl.c.Signed-off-by Gerd Hoffmann <[email protected]>---
include/ui/console.h | 1 + ui/console.c | 19 +++++++++++++++++++ vl.c | 15 +++++---------- 3 files changed, 25 insertions(+), 10 deletions(-)include/ui/console.h +1
-0@@ -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);ui/console.c +19
-0@@ -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 );vl.c +0
-5@@ -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 )
vl.c int main(int argc, char **argv, char **envp) · line 4413
Quoted 10 lines
vl.c +4
-5- 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
Mostly some questions on this:
- I'm curious, why is VNC not just one of the ones searched for in qemu_display_find_default()?
- What if there is another display type added? Would it be added to qemu_display_find_default() or in this if statement?
- Is there a reason that VNC doesn't follow the same registration mechanism you're proposing here (as in you've no changes to that module in this patch set).
- In the spirit of encapsulation, would it not make sense for the vnc_parse() to be in the VNC code itself as a fall back if no specific options are given to the -vnc option?
Thanks,
Darren.
Re: [Qemu-devel] [PATCH 19/24] console: add and use qemu_display_find_default
Hi,
Quoted 11 lines
Quoted 6 lines
vl.c +4
-1- 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
Mostly some questions on this:
- I'm curious, why is VNC not just one of the ones searched for in
qemu_display_find_default()?
vnc is a bit different. It's a remote display protocol, not a (local) user interface. There is no DISPLAY_TYPE_VNC for that reason (without this series too). And IMO it was a bad idea to add -display vnc=$config (same as -vnc $config) in the first place.
There can be only one user interface instance, i.e. you can't have gtk and sdl at the same time. With vnc (and spice) that works though, i.e. you can start qemu with some local user interface and enable vnc or spice (even both) remote access at the same time.
Quoted 2 lines
- What if there is another display type added? Would it be added to
qemu_display_find_default()or in this if statement?
qemu_display_find_default() most likely,
but depends on what exactly it is.
Quoted 3 lines
- Is there a reason that VNC doesn't follow the same registration mechanism you're proposing here (as in you've no changes to that module in this patch set).
See above ;)
Quoted 3 lines
- In the spirit of encapsulation, would it not make sense for the
vnc_parse()to be in the VNC code itself as a fall back if no specific options are given to the -vnc option?
It's not that simple. The default vnc server is started only in case no (graphical) local user interface is available, so it's not something the vnc code can figure purely on its own.
cheers,
Gerd
Re: [Qemu-devel] [PATCH 19/24] console: add and use qemu_display_find_default
Hi Gerd,
Thanks for clarifying things for me.
Quoted 19 lines · Gerd Hoffmann
Hi,
Quoted 11 lines
Quoted 6 lines
vl.c +4
-1- 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
Mostly some questions on this:
- I'm curious, why is VNC not just one of the ones searched for in
qemu_display_find_default()?vnc is a bit different. It's a remote display protocol, not a (local) user interface. There is no
DISPLAY_TYPE_VNCfor that reason (without this series too). And IMO it was a bad idea to add -display vnc=$config (same as -vnc $config) in the first place.
Quoted 4 lines
There can be only one user interface instance, i.e. you can't have gtk and sdl at the same time. With vnc (and spice) that works though, i.e. you can start qemu with some local user interface and enable vnc or spice (even both) remote access at the same time.
Ah, wasn't sure about being able to do both a local UI and VNC - I've only ever used one or the other :)
OK, so the odd thing then is the check for !remote_display earlier on in the function (missing from the quote above) which seems to end up initializing VNC (albeit with localhost) when CONFIG_VNC is defined, but no other local display type has been selected.
But, I suppose it's not strictly incorrect with the 'localhost' :)
Quoted 6 lines
Quoted 3 lines
- What if there is another display type added? Would it be added to
qemu_display_find_default()or in this if statement?
qemu_display_find_default()most likely,
but depends on what exactly it is.
OK, so neither SPICE or VNC really fit into this patchset because they are seen as additional to the display type, not the actual display type - SPICE is even more special too given the dependency on a guest VM driver to really function correctly.
I wonder should there be a, similar, qemu_display_find_remote_default() which would be used when no local display is defined. And that would use a similar mechanism to permit selecting VNC or SPICE via registration mechanisms over rather than the #ifdef style for remote displays that will remain ever after this patchset (certainly could be another patchset beyond this one).
Maybe it's not worth it, given that VNC is really he only remote UI module you can use.
Quoted 7 lines
Quoted 4 lines
- Is there a reason that VNC doesn't follow the same registration mechanism you're proposing here (as in you've no changes to that module in this patch set).
See above ;)
Quoted 7 lines
Quoted 3 lines
- In the spirit of encapsulation, would it not make sense for the
vnc_parse()to be in the VNC code itself as a fall back if no specific options are given to the -vnc option?It's not that simple. The default vnc server is started only in case no (graphical) local user interface is available, so it's not something the vnc code can figure purely on its own.
Fair enough.
Just a thought, but maybe the specific string could be defined in vnc.h instead of a string here at least? (e.g. VNC_DEFAULT_LOCALHOST_OPTIONS, or similar).
Thanks,
Darren.
Re: [Qemu-devel] [PATCH 19/24] console: add and use qemu_display_find_default
Hi,
Quoted 4 lines
OK, so the odd thing then is the check for !remote_display earlier on in the function (missing from the quote above) which seems to end up initializing VNC (albeit with localhost) when
CONFIG_VNCis defined, but no other local display type has been selected.
remote_display is set in case either -vnc or -spice was given on the command line, and qemu will not start a local user display in that case (unless you explicitly ask for it via -display).
Quoted 4 lines
OK, so neither SPICE or VNC really fit into this patchset because they are seen as additional to the display type, not the actual display type - SPICE is even more special too given the dependency on a guest VM driver to really function correctly.
Hmm? spice works just fine with any display.
Quoted 6 lines
I wonder should there be a, similar,
qemu_display_find_remote_default()which would be used when no local display is defined. And that would use a similar mechanism to permit selecting VNC or SPICE via registration mechanisms over rather than the #ifdef style for remote displays that will remain ever after this patchset (certainly could be another patchset beyond this one).
Well, historically qemu tried to do alot of stuff (like picking a display to use) automatically for the user. And we did stick to that for backward compatibility reasons. But this automagic causes quite some headache now and then, when changing things and the autmagic logic gets into the way. So I don't feel like adding more of this. Also vnc is in pretty much any qemu build, because it is enabled by default and doesn't need any external dependencies, so falling back to spice would be quite rare ...
cheers,
Gerd
Re: [Qemu-devel] [PATCH 19/24] console: add and use qemu_display_find_default
Quoted 10 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
OK, so the odd thing then is the check for !remote_display earlier on in the function (missing from the quote above) which seems to end up initializing VNC (albeit with localhost) when
CONFIG_VNCis defined, but no other local display type has been selected.
remote_displayis set in case either -vnc or -spice was given on the command line, and qemu will not start a local user display in that case (unless you explicitly ask for it via -display).
Makes sense.
Quoted 7 lines
Quoted 5 lines
OK, so neither SPICE or VNC really fit into this patchset because they are seen as additional to the display type, not the actual display type - SPICE is even more special too given the dependency on a guest VM driver to really function correctly.
Hmm? spice works just fine with any display.
Sorry, mixed that up with EGL I think.
Quoted 8 lines
Quoted 7 lines
I wonder should there be a, similar,
qemu_display_find_remote_default()which would be used when no local display is defined. And that would use a similar mechanism to permit selecting VNC or SPICE via registration mechanisms over rather than the #ifdef style for remote displays that will remain ever after this patchset (certainly could be another patchset beyond this one).
Quoted 5 lines
Well, historically qemu tried to do alot of stuff (like picking a display to use) automatically for the user. And we did stick to that for backward compatibility reasons. But this automagic causes quite some headache now and then, when changing things and the autmagic logic gets into the way. So I don't feel like adding more of this. Also vnc
Agree, there are times when automagic works - but unfortunately for more consistent usage, you are better being explicit.
Quoted 3 lines
is in pretty much any qemu build, because it is enabled by default and doesn't need any external dependencies, so falling back to spice would be quite rare ...
Understood - definitely VNC is a pretty good fall-back for most people.
Thanks for outlining your thoughts on this, very helpful in understanding the UI code and why somethings are how they are.
Thanks,
Darren.
PATCH 20/24 console: add ui module loading support
In reply to Gerd Hoffmann--- include/qemu/module.h | 1 + ui/console.c | 6 ++++++ 2 files changed, 7 insertions(+)
include/qemu/module.h +1 -0
@@ -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);
ui/console.c +6 -0
@@ -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 );
Signature · 1 line
2.9.3
PATCH 21/24 sdl: build as module
In reply to Gerd Hoffmann--- configure | 2 +- Makefile.objs | 1 + ui/Makefile.objs | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-)
configure +1 -1
@@ -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
Makefile.objs +1 -0
@@ -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)
ui/Makefile.objs +3 -3
@@ -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
Signature · 1 line
2.9.3
PATCH 22/24 gtk: build as module
In reply to Gerd Hoffmann--- configure | 5 ++--- ui/Makefile.objs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-)
configure +2 -3
@@ -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
ui/Makefile.objs +8 -8
@@ -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)
Signature · 1 line
2.9.3
PATCH 23/24 curses: build as module
In reply to Gerd Hoffmann--- configure | 6 +++--- ui/Makefile.objs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-)
configure +3 -3
@@ -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
ui/Makefile.objs +5 -1
@@ -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
Signature · 1 line
2.9.3
PATCH 24/24 build: opengl should not need X11
In reply to Gerd Hoffmann--- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
configure +2 -2
@@ -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"
Signature · 1 line
2.9.3
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PATCH 00/24] RfC: rework display initialization
Type: series
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'8ad8a3a49f build: opengl should not need X11 6f326898be curses: build as modulef28cbe0c71 gtk: build as moduleb40a8ab831 sdl: build as moduleb2ff35530c console: add ui module loading support 608541ecf1 console: add and use qemu_display_find_default c9ea5c8f98 egl-headless: hook up to display registry e4027611d6 curses: hook up to display registry e80738a2e4 cocoa: hook up to display registry d4e140bc0d sdl: hook up to display registry 527146bbaf console: add qemu display registry, add gtk 33878ca938 vl: drop request_opengl variable d788c7b02b vl: drop display_type variable 79864bf5a8 vl: drop full_screen variable 86920e800f cocoa: use DisplayOptionsc452a6e243 curses: use DisplayOptions2c82950f1c egl-headless: use DisplayOptions b144a95d3d vl: drop no_quit variable640b59b752 sdl: use DisplayOptions2a3081d35b gtk: add and use DisplayOptions + DisplayGTK 756824d0cf vl: rename DisplayType to LegacyDisplayType a7a6f0c0b2 sdl: use ctrl-alt-g as grab hotkey e4dde3438f sdl: remove -alt-grab and -ctrl-grab support 1c32dd624f sdl: remove -no-frame support
=== OUTPUT BEGIN ===
Checking PATCH 1/24: sdl: remove -no-frame support... Checking PATCH 2/24: sdl: remove -alt-grab and -ctrl-grab support...
ERROR: space prohibited after that '&' (ctx:WxW)
#48: FILE: ui/sdl.c:554:
+ mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
^ERROR: space prohibited after that '&' (ctx:WxW)
#96: FILE: ui/sdl2.c:333:
+ mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
^total: 2 errors, 0 warnings, 135 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 3/24: sdl: use ctrl-alt-g as grab hotkey... Checking PATCH 4/24: vl: rename DisplayType to LegacyDisplayType... Checking PATCH 5/24: gtk: add and use DisplayOptions + DisplayGTK... Checking PATCH 6/24: sdl: use DisplayOptions...
Checking PATCH 7/24: vl: drop no_quit variable...
Checking PATCH 8/24: egl-headless: use DisplayOptions... Checking PATCH 9/24: curses: use DisplayOptions...
Checking PATCH 10/24: cocoa: use DisplayOptions...
Checking PATCH 11/24: vl: drop full_screen variable... Checking PATCH 12/24: vl: drop display_type variable... Checking PATCH 13/24: vl: drop request_opengl variable... Checking PATCH 14/24: console: add qemu display registry, add gtk... Checking PATCH 15/24: sdl: hook up to display registry... Checking PATCH 16/24: cocoa: hook up to display registry... Checking PATCH 17/24: curses: hook up to display registry... Checking PATCH 18/24: egl-headless: hook up to display registry... Checking PATCH 19/24: console: add and use qemu_display_find_default... Checking PATCH 20/24: console: add ui module loading support... Checking PATCH 21/24: sdl: build as module...
Checking PATCH 22/24: gtk: build as module...
Checking PATCH 23/24: curses: build as module...
Checking PATCH 24/24: build: opengl should not need X11... === OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]