Ui 20210624 patches
The following changes since commit b22726abdfa54592d6ad88f65b0297c0e8b363e2:
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.1-pull-request' into staging (2021-06-22 16:07:53 +0100)
are available in the Git repository at:
git://git.kraxel.org/qemu tags/ui-20210624-pull-request
for you to fetch changes up to 66c2207fd28a6025792fbb75151ee848b911dc35:
ui: Make the DisplayType enum entries conditional (2021-06-23 14:42:30 +0200)
----------------------------------------------------------------
ui: better cocoa integration (ui info + clipboard).
ui: add lang1+lang2 keys, fixes, doc updates.
----------------------------------------------------------------
Ahmed Abouzied (1):
Add display suboptions to man pages
Akihiko Odaki (3):
ui/cocoa: Set UI information
ui/cocoa: Add clipboard support
input: Add lang1 and lang2 to QKeyCode
Thomas Huth (1):
ui: Make the DisplayType enum entries conditional
include/ui/clipboard.h | 2 +- softmmu/vl.c | 20 +++++- ui/clipboard.c | 2 +- ui/console.c | 8 ++- qapi/ui.json | 29 ++++++-- qemu-options.hx | 35 ++++----- ui/cocoa.m | 158 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 224 insertions(+), 30 deletions(-)
Signature · 1 line
2.31.1
[PULL 1/5] ui/cocoa: Set UI information
From: Akihiko Odaki <[email protected]>
Message-Id: <[email protected]>
--- ui/cocoa.m | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
ui/cocoa.m +49 -0
@@ -518,6 +518,43 @@ QemuCocoaView *cocoaView; } } +- (void) updateUIInfo +{ + NSSize frameSize; + QemuUIInfo info; + + if (!qemu_console_is_graphic(dcl.con)) { + return; + } + + if ([self window]) { + NSDictionary *description = [[[self window] screen] deviceDescription]; + CGDirectDisplayID display = [[description objectForKey:@"NSScreenNumber"] unsignedIntValue]; + NSSize screenSize = [[[self window] screen] frame].size; + CGSize screenPhysicalSize = CGDisplayScreenSize(display); + + frameSize = isFullscreen ? screenSize : [self frame].size; + info.width_mm = frameSize.width / screenSize.width * screenPhysicalSize.width; + info.height_mm = frameSize.height / screenSize.height * screenPhysicalSize.height; + } else { + frameSize = [self frame].size; + info.width_mm = 0; + info.height_mm = 0; + } + + info.xoff = 0; + info.yoff = 0; + info.width = frameSize.width; + info.height = frameSize.height; + + dpy_set_ui_info(dcl.con, &info); +} + +- (void)viewDidMoveToWindow +{ + [self updateUIInfo]; +} + - (void) switchSurface:(pixman_image_t *)image { COCOA_DEBUG("QemuCocoaView: switchSurface\n");
@@ -1172,6 +1209,16 @@ QemuCocoaView *cocoaView; return [self verifyQuit]; } +- (void)windowDidChangeScreen:(NSNotification *)notification +{ + [cocoaView updateUIInfo]; +} + +- (void)windowDidResize:(NSNotification *)notification +{ + [cocoaView updateUIInfo]; +} + /* Called when the user clicks on a window's close button */ - (BOOL)windowShouldClose:(id)sender {
@@ -1836,6 +1883,8 @@ static void cocoa_switch(DisplayChangeListener *dcl, COCOA_DEBUG("qemu_cocoa: cocoa_switch\n"); + [cocoaView updateUIInfo]; + // The DisplaySurface will be freed as soon as this callback returns. // We take a reference to the underlying pixman image here so it does // not disappear from under our feet; the switchSurface method will
Signature · 1 line
2.31.1
[PULL 5/5] ui: Make the DisplayType enum entries conditional
In reply to Gerd HoffmannFrom: Thomas Huth <[email protected]>
Libvirt's "domcapabilities" command has a way to state whether certain graphic frontends are available in QEMU or not. Originally, libvirt looked at the "--help" output of the QEMU binary to determine whether SDL was available or not (by looking for the "-sdl" parameter in the help text), but since libvirt stopped doing this analysis of the help text, the detection of SDL is currently broken, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1790902
QEMU should provide a way via the QMP interface instead. A simple way, without introducing additional commands, is to make the DisplayType enum entries conditional, so that the enum only contains the entries if the corresponding CONFIG_xxx switches have been set. This of course only gives an indication which possibilities have been enabled during compile-time of QEMU (and does not take into account whether modules are later available or not for example - for this we'd need a separate command), but anyway, this should already be good enough for the above bug ticket, and it's a good idea anyway to make the QMP interface conditional here, so let's simply do it.
Message-Id: <[email protected]>
--- softmmu/vl.c | 20 +++++++++++++++++--- ui/console.c | 8 +++++++- qapi/ui.json | 23 +++++++++++++++++------ 3 files changed, 41 insertions(+), 10 deletions(-)
softmmu/vl.c +17 -3
@@ -1068,6 +1068,7 @@ static void parse_display(const char *p)* Not clear yet what happens to them long-term. Should * replaced by something better or deprecated and dropped. */ +#if defined(CONFIG_SDL ) dpy.type =DISPLAY_TYPE_SDL ;while (*opts) {const char *nextopt;
@@ -1131,6 +1132,10 @@ static void parse_display(const char *p) } opts = nextopt; } +#else +error_report ("SDL display supported is not available in this binary" ); +exit (1 ); +#endif }else if (strstart (p,"vnc" , &opts)) {/* * vnc isn't a (local) DisplayType but a protocol for remote
@@ -1867,13 +1872,22 @@ static void qemu_apply_machine_options(void)static void qemu_create_early_backends (void ) {MachineClass *machine_class =MACHINE_GET_CLASS (current_machine); +#if defined(CONFIG_SDL ) +const bool use_sdl = (dpy.type ==DISPLAY_TYPE_SDL ); +#else +const bool use_sdl = false; +#endif +#if defined(CONFIG_GTK ) +const bool use_gtk = (dpy.type ==DISPLAY_TYPE_GTK ); +#else +const bool use_gtk = false; +#endif -if ((alt_grab || ctrl_grab) && dpy.type !=DISPLAY_TYPE_SDL ) { +if ((alt_grab || ctrl_grab) && !use_sdl) {error_report ("-alt-grab and -ctrl-grab are only valid " "for SDL, ignoring option" ); } -if (dpy.has_window_close && - (dpy.type !=DISPLAY_TYPE_GTK && dpy.type !=DISPLAY_TYPE_SDL )) { +if (dpy.has_window_close && !use_gtk && !use_sdl) {error_report ("-no-quit is only valid for GTK and SDL, " "ignoring option" ); }
ui/console.c +7 -1
@@ -2370,13 +2370,19 @@ void qemu_display_register(QemuDisplay *ui)bool qemu_display_find_default (DisplayOptions *opts) { static DisplayType prio[] = { +#if defined(CONFIG_GTK ) DISPLAY_TYPE_GTK, +#endif +#if defined(CONFIG_SDL ) DISPLAY_TYPE_SDL, +#endif +#if defined(CONFIG_COCOA ) DISPLAY_TYPE_COCOA +#endif };int i; -for (i =0 ; i <ARRAY_SIZE (prio); i++) { +for (i =0 ; i < (int )ARRAY_SIZE (prio); i++) {if (dpys[prio[i]] ==NULL ) {ui_module_load_one (DisplayType_str (prio[i])); }
qapi/ui.json +17 -6
@@ -1130,9 +1130,16 @@ # ## { 'enum' : 'DisplayType', - 'data' : [ 'default', 'none', 'gtk', 'sdl', - 'egl-headless', 'curses', 'cocoa', - 'spice-app'] } + 'data' : [ + { 'name': 'default' }, + { 'name': 'none' }, + { 'name': 'gtk', 'if': 'defined(CONFIG_GTK)' }, + { 'name': 'sdl', 'if': 'defined(CONFIG_SDL)' }, + { 'name': 'egl-headless', + 'if': 'defined(CONFIG_OPENGL) && defined(CONFIG_GBM)' }, + { 'name': 'curses', 'if': 'defined(CONFIG_CURSES)' }, + { 'name': 'cocoa', 'if': 'defined(CONFIG_COCOA)' }, + { 'name': 'spice-app', 'if': 'defined(CONFIG_SPICE)'} ] } ## # @DisplayOptions:
@@ -1156,9 +1163,13 @@ '*show-cursor' : 'bool', '*gl' : 'DisplayGLMode' }, 'discriminator' : 'type', - 'data' : { 'gtk' : 'DisplayGTK', - 'curses' : 'DisplayCurses', - 'egl-headless' : 'DisplayEGLHeadless'} } + 'data' : { + 'gtk': { 'type': 'DisplayGTK', 'if': 'defined(CONFIG_GTK)' }, + 'curses': { 'type': 'DisplayCurses', 'if': 'defined(CONFIG_CURSES)' }, + 'egl-headless': { 'type': 'DisplayEGLHeadless', + 'if': 'defined(CONFIG_OPENGL) && defined(CONFIG_GBM)' } + } +} ## # @query-display-options:
Signature · 1 line
2.31.1
[PULL 4/5] Add display suboptions to man pages
In reply to Gerd HoffmannFrom: Ahmed Abouzied <[email protected]>
Updates man pages with the suboptions for the -display.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/128
Message-Id: <[email protected]>
--- qemu-options.hx | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
qemu-options.hx +18 -17
@@ -1819,11 +1819,22 @@ SRST old style -sdl/-curses/... options. Use ``-display help`` to list the available display types. Valid values for type are - ``sdl`` + ``spice-app[,gl=on|off]`` + Start QEMU as a Spice server and launch the default Spice client + application. The Spice server will redirect the serial consoles + and QEMU monitors. (Since 4.0) + + ``sdl[,window-close=on|off][,gl=on|core|es|off]`` + Display video output via SDL (usually in a separate graphics window; see the SDL documentation for other possibilities). - ``curses`` + ``gtk[,grab-on-hover=on|off][,gl=on|off]`` + Display video output in a GTK window. This interface provides + drop-down menus and other UI elements to configure and control + the VM during runtime. + + ``curses [,charset=<encoding>]`` Display video output via curses. For graphics device models which support a text mode, QEMU can display this output using a curses/ncurses interface. Nothing is displayed when the graphics
@@ -1834,6 +1845,11 @@ SRST ``charset=CP850`` for IBM CP850 encoding. The default is ``CP437``. + ``egl-headless[,rendernode<file>]`` + Offload all OpenGL operations to a local DRI device. For any + graphical display, this display needs to be paired with either + VNC or SPICE displays. + ``none`` Do not display video output. The guest will still see an emulated graphics card, but its output will not be displayed to
@@ -1842,23 +1858,8 @@ SRST also changes the destination of the serial and parallel port data. - ``gtk`` - Display video output in a GTK window. This interface provides - drop-down menus and other UI elements to configure and control - the VM during runtime. - ``vnc`` - Start a VNC server on display <arg> - ``egl-headless`` - Offload all OpenGL operations to a local DRI device. For any - graphical display, this display needs to be paired with either - VNC or SPICE displays. - - ``spice-app`` - Start QEMU as a Spice server and launch the default Spice client - application. The Spice server will redirect the serial consoles - and QEMU monitors. (Since 4.0) ERST DEF("nographic", 0, QEMU_OPTION_nographic,
Signature · 1 line
2.31.1
[PULL 3/5] input: Add lang1 and lang2 to QKeyCode
In reply to Gerd HoffmannFrom: Akihiko Odaki <[email protected]>
lang1 and lang2 represents the keys with the same names in the keyboard/keypad usage page (0x07) included in the "HID Usage Tables for Universal Serial Bus (USB)" version 1.22. Although the keys are described as "Hangul/English toggle key" and "Hanja conversion key" in the specification, the meaning depends on the variety of the keyboard, and it will be used as the representations of Kana and Eisu keys on Japanese Macs in qemu_input_map_osx_to_qcode, which is used by ui/gtk.
Message-Id: <[email protected]>
--- qapi/ui.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
qapi/ui.json +5 -1
@@ -786,6 +786,9 @@ # @muhenkan: since 2.12 # @katakanahiragana: since 2.12 # +# @lang1: since 6.1 +# @lang2: since 6.1 +# # 'sysrq' was mistakenly added to hack around the fact that # the ps2 driver was not generating correct scancodes sequences # when 'alt+print' was pressed. This flaw is now fixed and the
@@ -818,7 +821,8 @@ 'audionext', 'audioprev', 'audiostop', 'audioplay', 'audiomute', 'volumeup', 'volumedown', 'mediaselect', 'mail', 'calculator', 'computer', - 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks' ] } + 'ac_home', 'ac_back', 'ac_forward', 'ac_refresh', 'ac_bookmarks', + 'lang1', 'lang2' ] } ## # @KeyValue:
Signature · 1 line
2.31.1
[PULL 2/5] ui/cocoa: Add clipboard support
In reply to Gerd HoffmannFrom: Akihiko Odaki <[email protected]>
Message-Id: <[email protected]>
--- include/ui/clipboard.h | 2 +- ui/clipboard.c | 2 +- ui/cocoa.m | 109 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 2 deletions(-)
include/ui/clipboard.h +1 -1
@@ -187,7 +187,7 @@ void qemu_clipboard_set_data(QemuClipboardPeer *peer,QemuClipboardInfo *info, QemuClipboardType type, uint32_t size, - void *data, + const void *data, bool update);#endif /* QEMU_CLIPBOARD_H */
ui/clipboard.c +1 -1
@@ -73,7 +73,7 @@ void qemu_clipboard_set_data(QemuClipboardPeer *peer, QemuClipboardInfo *info, QemuClipboardType type, uint32_t size, - void *data, + const void *data, bool update) { if (!info ||
ui/cocoa.m +109 -0
145 lines not on this page · raw message
Signature · 1 line
2.31.1
Peter Maydell
AppliedQuoted 11 lines · Gerd Hoffmann
The following changes since commit
b22726abdfa54592d6ad88f65b0297c0e8b363e2:Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.1-pull-request' into staging (2021-06-22 16:07:53 +0100)
are available in the Git repository at:
git://git.kraxel.org/qemutags/ui-20210624-pull-requestfor you to fetch changes up to
66c2207fd28a6025792fbb75151ee848b911dc35:
Quoted 7 lines
ui: Make the DisplayType enum entries conditional (2021-06-23 14:42:30 +0200)
----------------------------------------------------------------
ui: better cocoa integration (ui info + clipboard).
ui: add lang1+lang2 keys, fixes, doc updates.----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.
-- PMM