aboutsummaryrefslogtreecommitdiff
path: root/ui
AgeCommit message (Collapse)AuthorFilesLines
9 daysui/vnc: Update display update interval when VM state changes to RUNNINGJuraj Marcin2-0/+14
If a virtual machine is paused for an extended period time, for example, due to an incoming migration, there are also no changes on the screen. VNC in such case increases the display update interval by VNC_REFRESH_INTERVAL_INC (50 ms). The update interval can then grow up to VNC_REFRESH_INTERVAL_MAX (3000 ms). When the machine resumes, it can then take up to 3 seconds for the first display update. Furthermore, the update interval is then halved with each display update with changes on the screen. If there are moving elements on the screen, such as a video, this can be perceived as freezing and stuttering for few seconds before the movement is smooth again. This patch resolves this issue, by adding a listener to VM state changes and changing the update interval when the VM state changes to RUNNING. The update_displaychangelistener() function updates the internal timer, and the display is refreshed immediately if the timer is expired. Signed-off-by: Juraj Marcin <jmarcin@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Link: https://lore.kernel.org/r/20250521151616.3951178-1-jmarcin@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
2025-05-24ui/gtk-egl: Render guest content with padding in fixed-scale modeWeifeng Liu3-8/+40
Scaling was not respected when rendering frames in gtk-egl.c (used if gl=on and X11 mode). To fix this, add fields x and y to struct egl_fb for x offset and y offset so we can add padding to window. Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com> Message-ID: <20250511073337.876650-10-weifeng.liu.z@gmail.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-24ui/gtk-gl-area: Render guest content with padding in fixed-scale modeWeifeng Liu1-1/+32
In fixed-scale mode (zoom-to-fit=false), we expect that scale should not change, meaning that if window size is larger than guest surface, padding is supposed to be added to preserve the scale. However, in OpenGL mode (gl=on), guest surface is always painted to the whole canvas without any padding. This change tries to fix this bug by adding appropriate padding when drawing surfaces. Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com> Message-ID: <20250511073337.876650-9-weifeng.liu.z@gmail.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-24ui/gtk: Consider scaling when propagating ui infoWeifeng Liu1-2/+23
The ui width and height sent to guest is supposed to be in buffer coordinate. Hence conversion is required. If scaling (global window scale and zooming scale) is not respected in non-free-scale mode, window size could keep changing because of the existence of the iteration of the following steps: 1. In resize event or configure event, a size larger (or smaller) than the currently used one might be calculated due to not considering scaling. 2. On reception of the display size change event in guest, the guest might decide to do a mode setting and use the larger (or smaller) mode. 3. When the new guest scan-out command arrives, QEMU would request the window size to change to fit the new buffer size. This will trigger a resize event or a configure event, making us go back to step 1. Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com> Message-ID: <20250511073337.876650-8-weifeng.liu.z@gmail.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-24ui/gtk: Don't update scale in fixed scale mode in gtk-egl.cWeifeng Liu1-4/+6
Scale shouldn't be changed until user explicitly requests it in fixed scale mode (full-screen=false and free-scale=false). Use function gd_update_scale to complete scale updating instead. Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com> Message-ID: <20250511073337.876650-7-weifeng.liu.z@gmail.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-24ui/sdl: Consider scaling in mouse event handlingWeifeng Liu1-5/+15
When using sdl display backend, if the window is scaled, incorrect mouse positions will be reported since scaling is not properly handled. Fix it by transforming the positions from window coordinate to guest buffer coordinate. Signed-off-by: Weifeng Liu <weifeng.liu@intel.com> Message-ID: <20250511073337.876650-6-weifeng.liu.z@gmail.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-24ui/gtk: Update scales in fixed-scale mode when rendering GL areaWeifeng Liu1-2/+10
When gl=on, scale_x and scale_y were set to 1 on startup that didn't reflect the real situation of the scan-out in free scale mode, resulting in incorrect cursor coordinates to be sent when moving the mouse pointer. Simply updating the scales before rendering the image fixes this issue. Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com> Message-ID: <20250511073337.876650-5-weifeng.liu.z@gmail.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-24gtk/ui: Introduce helper gd_update_scaleWeifeng Liu1-11/+19
The code snippet updating scale_x/scale_y is general and will be used in next patch. Make it a function. Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com> Message-ID: <20250511073337.876650-4-weifeng.liu.z@gmail.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-24ui/gtk: Use consistent naming for variables in different coordinatesWeifeng Liu3-77/+82
Now that we've documented definitions and presentation of various coordinates, let's enforce the rules. Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com> Message-ID: <20250511073337.876650-3-weifeng.liu.z@gmail.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-24ui/gtk: Document scale and coordinate handlingWeifeng Liu1-0/+65
The existence of multiple scaling factors forces us to deal with various coordinate systems and this would be confusing. It would be beneficial to define the concepts clearly and use consistent representation for variables in different coordinates. Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com> Message-ID: <20250511073337.876650-2-weifeng.liu.z@gmail.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-24ui/vdagent: remove migration blockerMarc-André Lureau1-11/+0
Fixes: https://issues.redhat.com/browse/RHEL-81894 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-24ui/vdagent: add migration supportMarc-André Lureau1-0/+142
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-24ui/vdagent: factor out clipboard peer registrationMarc-André Lureau1-6/+14
This allows common code reuse during migration. Note that resetting the serial is now done regardless if the clipboard peer was registered or not. This should still be correct. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-24ui/vdagent: keep "connected" stateMarc-André Lureau1-0/+7
During post-load of migration, virtio will notify of fe_open state. However vdagent code will handle this as a reconnection. This will trigger a connection reset/caps with the agent. Check if the state actually changed before resetting the connection. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-24ui/vdagent: replace Buffer with GByteArrayMarc-André Lureau1-13/+12
Buffer is slightly more advanced than GByteArray, since it has a cursor/position. But vdagent code doesn't need it. This simplify a bit the code, and migration state. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-24ui/clipboard: delay clipboard update when not runningMarc-André Lureau1-2/+38
When VM is paused, we shouldn't notify of clipboard changes, similar to how input are being treated. On unsuspend, notify of the current state. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-24ui/clipboard: add vmstate_cbinfoMarc-André Lureau1-0/+26
Add a VMStateDescriptor for QemuClipboardInfo. Each clipboard owner will have to save its QemuClipboardInfo and reregister its owned clipboard after loading. (the global cbinfo has only pointers to owners, so it can't restore the relation with its owner if it was to handle migration) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-24ui/gtk: warn if setting the clipboard failedMarc-André Lureau1-5/+8
Just in case. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-21ui/vnc: fix tight palette pixel encoding for 8/16-bpp formatsDaniel P. Berrangé1-4/+12
When sending a tight rectangle with the palette filter, if the client format was 8/16bpp, the colours on big endian hosts are not set as we're sending the wrong bytes. We must first cast the 32-bit colour to a 16/8-bit value, and then send the result. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-21ui/vnc: take account of client byte order in pixman formatDaniel P. Berrangé3-9/+11
The set_pixel_conversion() method is responsible for determining whether the VNC client pixel format matches the server format, and thus whether we can use the fast path "copy" impl for sending pixels, or must use the generic impl with bit swizzling. The VNC server format is set at build time to VNC_SERVER_FB_FORMAT, which corresponds to PIXMAN_x8r8g8b8. The qemu_pixman_get_format() method is then responsible for converting the VNC pixel format into a pixman format. The VNC client pixel shifts are relative to the associated endianness. The pixman formats are always relative to the host native endianness. The qemu_pixman_get_format() method does not take into account the VNC client endianness, and is thus returning a pixman format that is only valid with the host endianness matches that of the VNC client. This has been broken since pixman was introduced to the VNC server: commit 9f64916da20eea67121d544698676295bbb105a7 Author: Gerd Hoffmann <kraxel@redhat.com> Date: Wed Oct 10 13:29:43 2012 +0200 pixman/vnc: use pixman images in vnc. The flaw can be demonstrated using the Tigervnc client by using vncviewer -AutoSelect=0 -PreferredEncoding=raw server:display connecting from a LE client to a QEMU on a BE server, or the reverse. The bug was masked, however, because almost all VNC clients will advertize support for the "tight" encoding and the QEMU VNC server will prefer "tight" if advertized. The tight_pack24 method is responsible for taking a set of pixels which have already been converted into client endianness and then repacking them into the TPIXEL format which the RFB spec defines as "TPIXEL is only 3 bytes long, where the first byte is the red component, the second byte is the green component, and the third byte is the blue component of the pixel color value" IOW, the TPIXEL format is fixed on the wire, regardless of what the VNC client declare as its endianness. Since the VNC pixel encoding code was failing to honour the endian flag of the client, the tight_pack24 method was always operating on data in native endianness. Its impl cancelled out the VNC pixel encoding bug. With the VNC pixel encoding code now fixed, the tight_pack24 method needs to take into account that it is operating on data in client endianness, not native endianness. It thus may need to invert the pixel shifts. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-21ui/vnc.c: replace big endian flag with byte order valueDaniel P. Berrangé5-7/+7
It will make it easier to do certain comparisons in future if we store G_BIG_ENDIAN/G_LITTLE_ENDIAN directly, instead of a boolean flag, as we can then compare directly to the G_BYTE_ORDER constant. Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-05-12meson: remove unnecessary dependencies from specific_ssPaolo Bonzini1-3/+0
All dependencies that are in common_ss (which includes system_ss) automatically have their include path added when building the target-specific files. So the hack in ui/meson.build is not needed anymore since commit 727bb5b477e ("meson: pick libfdt from common_ss when building target-specific files", 2024-05-10); drop it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-06ui/spice: support multi plane dmabuf scanoutQiang Yu1-34/+64
We need spice version >= 0.15.3 which has spice_qxl_gl_scanout2 API for multi plane scanout support. v2: * use new dmabuf API and check length * check spice_qxl_gl_scanout2 present instead of bump spice version dependency Signed-off-by: Qiang Yu <yuq825@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Marc-André Lureau <marcandre.lureau@redhat.com> [ Fix style ] Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20250327025848.46962-7-yuq825@gmail.com>
2025-05-06ui/dbus: change dbus ScanoutDMABUF interfaceQiang Yu2-7/+152
To handle multi plane. v3: * rename interface * add x/y/backing_width/backing_height arg v2: * use new dmabuf API and check length Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Message-ID: <20250327025848.46962-6-yuq825@gmail.com> [ Fix style ] Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-05-06ui/egl: support multi-plane dmabuf when egl export/importQiang Yu3-50/+121
v2: * use new dmabuf API and check length Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> [ Fix style ] Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20250327025848.46962-5-yuq825@gmail.com>
2025-05-06ui/egl: use DRM_FORMAT_MOD_INVALID as default modifierQiang Yu1-1/+2
0 is used as DRM_FORMAT_MOD_LINEAR already. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Message-ID: <20250327025848.46962-4-yuq825@gmail.com>
2025-05-06ui/egl: require EGL_EXT_image_dma_buf_import_modifiersQiang Yu1-4/+6
It's used already, just check it explicitly. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Message-ID: <20250327025848.46962-3-yuq825@gmail.com>
2025-05-06ui/dmabuf: extend QemuDmaBuf to support multi-planeQiang Yu4-33/+65
mesa/radeonsi is going to support explicit modifier which may export a multi-plane texture. For example, texture with DCC enabled (a compressed format) has two planes, one with compressed data, the other with meta data for compression. v2: * change API qemu_dmabuf_get_fd/offset/stride to qemu_dmabuf_get_fds/offsets/strides. * change API qemu_dmabuf_dup_fd to qemu_dmabuf_dup_fds. * add an extra arg to these API for the length of the array. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> [ Fix style ] Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20250327025848.46962-2-yuq825@gmail.com>
2025-04-25qom: Make InterfaceInfo[] uses constPhilippe Mathieu-Daudé3-3/+3
Mechanical change using: $ sed -i -E 's/\(InterfaceInfo.?\[/\(const InterfaceInfo\[/g' \ $(git grep -lE '\(InterfaceInfo.?\[\]\)') Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20250424194905.82506-7-philmd@linaro.org>
2025-04-25qom: Have class_init() take a const data argumentPhilippe Mathieu-Daudé9-13/+13
Mechanical change using gsed, then style manually adapted to pass checkpatch.pl script. Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250424194905.82506-4-philmd@linaro.org>
2025-04-24Merge tag 'pull-misc-2025-04-24' of https://repo.or.cz/qemu/armbru into stagingStefan Hajnoczi2-3/+0
Miscellaneous patches for 2025-04-24 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmgJ7dYSHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZTiZIP/1PFAg/s3SoiLQwH/ZrjyUkm1kiKnjOH # CC5Stw6I9tuYnDAhASAdSymofLv0NNydNe5ai6ZZAWRyRYjIcfNigKAGK4Di+Uhe # nYxT0Yk8hNGwMhl6NnBp4mmCUNCwcbjT9uXdiYQxFYO/qqYR1388xJjeN3c362l3 # AaLrE5bX5sqa6TAkTeRPjeIqxlyGT7jnCrN7I1hMhDvbc3ITF3AMfYFMjnmAQgr+ # mTWGS1QogqqkloODbR1DKD1CAWOlpK+0HibhNF+lz71P0HlwVvy+HPXso505Wf0B # dMwlSrZ1DnqNVF/y5IhMEMslahKajbjbFVhBjmrGl/8T821etCxxgB20c0vyFRy8 # qTyJGwBZaEo0VWr70unSmq45TRoeQvdHAw/e+GtilR0ci80q2ly4gbObnw7L8le+ # gqZo4IWmrwp2sbPepE57sYKQpEndwbRayf/kcFd0LPPpeINu9ZooXkYX0pOo6Cdg # vDKMaEB1/fmPhjSlknxkKN9LZdR+nDw8162S1CKsUdWanAOjmP8haN19aoHhIekZ # q+r2qUq/U827yNy9/qbInmsoFYDz9s6sAOE63jibd5rZZ9Anei6NOSgLzA4CqCR1 # +d0+TXp19gP9mLMFs7/ZclwkXCz47OQYhXYphjI3wM9x+xbdRcI4n+DOH5u5coKx # AsA6+2n0GF4Y # =GaoH # -----END PGP SIGNATURE----- # gpg: Signature made Thu 24 Apr 2025 03:52:54 EDT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-misc-2025-04-24' of https://repo.or.cz/qemu/armbru: cleanup: Drop pointless label at end of function cleanup: Drop pointless return at end of function cleanup: Re-run return_directly.cocci Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2025-04-24cleanup: Drop pointless return at end of functionMarkus Armbruster2-3/+0
A few functions now end with a label. The next commit will clean them up. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20250407082643.2310002-3-armbru@redhat.com> [Straightforward conflict with commit 988ad4ccebb6 (hw/loongarch/virt: Fix cpuslot::cpu set at last in virt_cpu_plug()) resolved]
2025-04-23include/system: Move exec/memory.h to system/memory.hRichard Henderson1-1/+1
Convert the existing includes with sed -i ,exec/memory.h,system/memory.h,g Move the include within cpu-all.h into a !CONFIG_USER_ONLY block. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2025-03-05ui/console-vc: implement DCH (delete) and ICH (insert) commandsRoman Penyaev1-0/+88
This patch implements DCH (delete character) and ICH (insert character) commands. DCH - Delete Character: "As characters are deleted, the remaining characters between the cursor and right margin move to the left. Character attributes move with the characters. The terminal adds blank spaces with no visual character attributes at the right margin. DCH has no effect outside the scrolling margins" [1]. ICH - Insert Character: "The ICH sequence inserts Pn blank characters with the normal character attribute. The cursor remains at the beginning of the blank characters. Text between the cursor and right margin moves to the right. Characters scrolled past the right margin are lost. ICH has no effect outside the scrolling margins" [2]. Without these commands console is barely usable. [1] https://vt100.net/docs/vt510-rm/DCH.html [1] https://vt100.net/docs/vt510-rm/ICH.html Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20250226075913.353676-6-r.peniaev@gmail.com>
2025-03-05ui/console-vc: add support for cursor DECSC and DECRC commandsRoman Penyaev1-6/+34
There are aliases for save and restore cursor commands: * save cursor `ESC 7` (DEC Save Cursor [1], older VT100) `ESC [ s` (CSI Save Cursor, standard ANSI) * load cursor `ESC 8` (DEC Restore Cursor [2], older VT100) `ESC [ u` (CSI Restore Cursor, standard ANSI) This change introduces older DEC sequencies for compatibility with some scripts (for example [3]) and tools. This change also adds saving and restoring of character attributes, which is according to the VT spec [1][2] [1] https://vt100.net/docs/vt510-rm/DECSC.html [2] https://vt100.net/docs/vt510-rm/DECRC.html [3] https://wiki.archlinux.org/title/Working_with_the_serial_console#Resizing_a_terminal Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20250226075913.353676-5-r.peniaev@gmail.com>
2025-03-05ui/console-vc: report cursor position in the screen not in the scroll bufferRoman Penyaev1-2/+1
The format of the CSI cursor position report is `ESC[row;columnR`, where `row` is a row of a cursor in the screen, not in the scrollback buffer. What's the difference? Let's say the terminal screen has 24 lines, no matter how long the scrollback buffer may be, the last line is the 24th. For example the following command can be executed in xterm on the last screen line: $ echo -en '\e[6n'; IFS='[;' read -sdR _ row col; echo $row:$col 24:1 It shows the cursor position on the current screen and not relative to the backscroll buffer. Before this change the row number was always increasing for the QEMU VC and represents the cursor position relative to the backscroll buffer. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20250226075913.353676-4-r.peniaev@gmail.com>
2025-03-05ui/console-vc: report to the application instead of screen renderingRoman Penyaev1-4/+3
Terminal Device Status Report (DSR) [1] should be sent to an application, not rendered to the screen. This patch fixes rendering of terminal report, which appear only on the graphical screen of the terminal (console "vc") and can be reproduced by the following command: echo -en '\e[6n'; IFS='[;' read -sdR _ row col; echo $row:$col Command requests cursor position and waits for terminal response, but instead, the response is rendered to the graphical screen and never sent to an application. Why bother? Busybox shell (ash) in Alpine distribution requests cursor position on each shell prompt (once <ENTER> is pressed), which makes a prompt on a graphical screen corrupted with repeating Cursor Position Report (CPR) [2]: [root@alpine ~]# \033[57;1R] Which is very annoying and incorrect. [1] https://vt100.net/docs/vt100-ug/chapter3.html#DSR [2] https://vt100.net/docs/vt100-ug/chapter3.html#CPR Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20250226075913.353676-3-r.peniaev@gmail.com>
2025-03-05ui/console-vc: introduce parsing of the 'ESC ( <ch>' sequenceRoman Penyaev1-0/+16
This change introduces parsing of the 'ESC ( <ch>' sequence, which is supposed to change character set [1]. In the QEMU case, the introduced parsing logic does not actually change the character set, but simply parses the sequence and does not let output of a tool to be corrupted with leftovers: `top` sends 'ESC ( B', so if character sequence is not parsed correctly, chracter 'B' appears in the output: Btop - 11:08:42 up 5 min, 1 user, load average: 0BB Tasks:B 158 Btotal,B 1 Brunning,B 157 Bsleeping,B 0 BsBB %Cpu(s):B 0.0 Bus,B 0.0 Bsy,B 0.0 Bni,B 99.8 Bid,B 0.2 BB MiB Mem :B 7955.6 Btotal,B 7778.6 Bfree,B 79.6 BB MiB Swap:B 0.0 Btotal,B 0.0 Bfree,B 0.0 BB PID USER PR NI VIRT RES SHR S B B 735 root 20 0 9328 3540 3152 R B B 1 root 20 0 20084 10904 8404 S B B 2 root 20 0 0 0 0 S B [1] https://vt100.net/docs/vt100-ug/chapter3.html#SCS Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20250226075913.353676-2-r.peniaev@gmail.com>
2025-02-14Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into stagingStefan Hajnoczi2-5/+2
trivial patches for 2025-02-14 # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmeu2oYACgkQgqpKJDse # lHh57xAAstKzxMB7qJRfU9FHLT2KcSiCSesaGKVmwtaRzoSvf+m7DVSS0/DziEUl # ha7Obs3zKSX8fIcClo7MiVXhs+7NOh7zeHK5xxD+U85yDrS3aBmU6NEHTUTZsarN # ADjvMlhQBiElUbtEtNQg3oNp1n1bHhTpSWnbm+Se2QlALnECo1JAV+1DDC64Fi/h # ZEhOcg4UWzoFgXli/CqLQ0SBGJLdD2KvHb2IHhP49l14vgVlMbd8CS8qfwfgqU6K # sTdcO4NOIKWvLWNzrb5yvB473l0RGjbM4WzggwkL8WgxoOdwVqjtRkeOrmZI0MwR # g9yLrb6WV4/01sXLbgh4uTpVxzouZ9w2F/8bTdEahmy8nR0yJ2DugDeg36oB2Mux # vQTC7cbeV1eRKnTW0omguVybqeQ1mIvfBdjMR1D0GHX6y7d1ExCo4tap/AKBv4E9 # +34eIq5mezE/AuFcigP//mQOY0pxnG9ahmYvNKb+30olOJzmBB0vSP15n0Ojjjn0 # N/0mFmYg/P9000B8MqNrh3WaiTIKBvf98RGrqUgl4IqB3wnmBlFgY1TdI5ZcDKHK # lWhV3+zdnzR0terkoiVwRGjaZYArsf2t21GaEsXhJjjuY+a+1CRGGwPTfBADbv8I # FKKPpK0xXF4xdCVdGUA5FzUzTInS7j9AnhIOwOyp8q7dJDENF1k= # =SPBO # -----END PGP SIGNATURE----- # gpg: Signature made Fri 14 Feb 2025 00:54:14 EST # gpg: using RSA key 64AA2AB531D56903366BFEF982AA4A243B1E9478 # gpg: Good signature from "Michael Tokarev <mjt@debian.org>" [unknown] # gpg: aka "Michael Tokarev <mjt@corpit.ru>" [unknown] # gpg: aka "Michael Tokarev <mjt@tls.msk.ru>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 9D8B E14E 3F2A 9DD7 9199 28F1 61AD 3D98 ECDF 2C8E # Subkey fingerprint: 64AA 2AB5 31D5 6903 366B FEF9 82AA 4A24 3B1E 9478 * tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu: make-release: don't rely on $CWD when excluding subproject directories target/riscv: Fix minor whitespace issue in riscv_cpu_properties qemu/timer: Clarify timer_new*() must be freed with timer_free() overall: Remove unnecessary g_strdup_printf() calls Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2025-02-14overall: Remove unnecessary g_strdup_printf() callsPhilippe Mathieu-Daudé2-5/+2
Replace g_strdup_printf("%s", value) -> g_strdup(value) to avoid unnecessary string formatting. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-13ui/sdl2: reenable the SDL2 Windows keyboard hook procedureVolker Rümelin2-30/+0
Windows only: The libSDL2 Windows message loop needs the libSDL2 Windows low level keyboard hook procedure to grab the left and right Windows keys correctly. Reenable the SDL2 Windows keyboard hook procedure. Since SDL2 2.30.4 the SDL2 keyboard hook procedure also filters out the special left Control key event for every Alt Gr key event on keyboards with an international layout. This means the QEMU low level keyboard hook procedure is no longer needed. Remove the QEMU Windows keyboard hook procedure. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2139 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2323 Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Link: https://lore.kernel.org/r/20241231115950.6732-1-vr_qemu@t-online.de Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-02-10qapi: Move include/qapi/qmp/ to include/qobject/Daniel P. Berrangé1-1/+1
The general expectation is that header files should follow the same file/path naming scheme as the corresponding source file. There are various historical exceptions to this practice in QEMU, with one of the most notable being the include/qapi/qmp/ directory. Most of the headers there correspond to source files in qobject/. This patch corrects most of that inconsistency by creating include/qobject/ and moving the headers for qobject/ there. This also fixes MAINTAINERS for include/qapi/qmp/dispatch.h: scripts/get_maintainer.pl now reports "QAPI" instead of "No maintainers found". Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Acked-by: Halil Pasic <pasic@linux.ibm.com> #s390x Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20241118151235.2665921-2-armbru@redhat.com> [Rebased]
2025-02-03dbus: add -audio dbus nsamples optionMarc-André Lureau1-0/+12
Allow to set the number of audio samples per read/write to dbus. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-02-03ui/dbus: clarify the kind of win32 handle that is sharedMarc-André Lureau1-2/+2
"-display dbus" hands over a file mapping handle to the peer process (not a file handle). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-02-03ui/dbus: on win32, allow ANONYMOUS with p2pMarc-André Lureau2-3/+15
GLib doesn't implement EXTERNAL on win32 at the moment, and disables ANONYMOUS by default. zbus dropped support for COOKIE_SHA1 in 5.0, making it no longer possible to connect to qemu -display dbus. Since p2p connections are gated by existing QMP (or a D-Bus connection), qemu -display dbus p2p can accept authentication with ANONYMOUS. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-01-09qom: Use object_get_container()Peter Xu2-2/+2
Use object_get_container() whenever applicable across the tree. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20241121192202.4155849-13-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2024-12-31ui & main loop: Redesign of system-specific main thread event handlingPhil Dennis-Jordan3-41/+21
macOS's Cocoa event handling must be done on the initial (main) thread of the process. Furthermore, if library or application code uses libdispatch, the main dispatch queue must be handling events on the main thread as well. So far, this has affected Qemu in both the Cocoa and SDL UIs, although in different ways: the Cocoa UI replaces the default qemu_main function with one that spins Qemu's internal main event loop off onto a background thread. SDL (which uses Cocoa internally) on the other hand uses a polling approach within Qemu's main event loop. Events are polled during the SDL UI's dpy_refresh callback, which happens to run on the main thread by default. As UIs are mutually exclusive, this works OK as long as nothing else needs platform-native event handling. In the next patch, a new device is introduced based on the ParavirtualizedGraphics.framework in macOS. This uses libdispatch internally, and only works when events are being handled on the main runloop. With the current system, it works when using either the Cocoa or the SDL UI. However, it does not when running headless. Moreover, any attempt to install a similar scheme to the Cocoa UI's main thread replacement fails when combined with the SDL UI. This change tidies up main thread management to be more flexible. * The qemu_main global function pointer is a custom function for the main thread, and it may now be NULL. When it is, the main thread runs the main Qemu loop. This represents the traditional setup. * When non-null, spawning the main Qemu event loop on a separate thread is now done centrally rather than inside the Cocoa UI code. * For most platforms, qemu_main is indeed NULL by default, but on Darwin, it defaults to a function that runs the CFRunLoop. * The Cocoa UI sets qemu_main to a function which runs the NSApplication event handling runloop, as is usual for a Cocoa app. * The SDL UI overrides the qemu_main function to NULL, thus specifying that Qemu's main loop must run on the main thread. * The GTK UI also overrides the qemu_main function to NULL. * For other UIs, or in the absence of UIs, the platform's default behaviour is followed. This means that on macOS, the platform's runloop events are always handled, regardless of chosen UI. The new PV graphics device will thus work in all configurations. There is no functional change on other operating systems. Implementing this via a global function pointer variable is a bit ugly, but it's probably worth investigating the existing UI thread rule violations in the SDL (e.g. #2537) and GTK+ back-ends. Fixing those issues might precipitate requirements similar but not identical to those of the Cocoa UI; hopefully we'll see some kind of pattern emerge, which can then be used as a basis for an overhaul. (In fact, it may turn out to be simplest to split the UI/native platform event thread from the QEMU main event loop on all platforms, with any UI or even none at all.) Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-ID: <20241223221645.29911-2-phil@philjordan.eu> [PMD: Declare 'qemu_main' symbol in tests/qtest/fuzz/fuzz.c, add missing g_assert_not_reached() call in main()] Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-12-20include: Rename sysemu/ -> system/Philippe Mathieu-Daudé17-28/+28
Headers in include/sysemu/ are not only related to system *emulation*, they are also used by virtualization. Rename as system/ which is clearer. Files renamed manually then mechanical change using sed tool. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Lei Yang <leiyang@redhat.com> Message-Id: <20241203172445.28576-1-philmd@linaro.org>
2024-12-10ui: Replace type_register() with type_register_static()Zhao Liu4-4/+4
Replace type_register() with type_register_static() because type_register() will be deprecated. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Link: https://lore.kernel.org/r/20241029085934.2799066-15-zhao1.liu@intel.com
2024-12-03ui/cocoa: Temporarily ignore annoying deprecated declaration warningsPhilippe Mathieu-Daudé1-0/+5
These warnings are breaking some build configurations since 2 months now (https://gitlab.com/qemu-project/qemu/-/issues/2575): ui/cocoa.m:662:14: error: 'CVDisplayLinkCreateWithCGDisplay' is deprecated: first deprecated in macOS 15.0 - use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) [-Werror,-Wdeprecated-declarations] 662 | if (!CVDisplayLinkCreateWithCGDisplay(display, &displayLink)) { | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVDisplayLink.h:89:20: note: 'CVDisplayLinkCreateWithCGDisplay' has been explicitly marked deprecated here 89 | CV_EXPORT CVReturn CVDisplayLinkCreateWithCGDisplay( | ^ ui/cocoa.m:663:29: error: 'CVDisplayLinkGetNominalOutputVideoRefreshPeriod' is deprecated: first deprecated in macOS 15.0 - use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) [-Werror,-Wdeprecated-declarations] 663 | CVTime period = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(displayLink); | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVDisplayLink.h:182:18: note: 'CVDisplayLinkGetNominalOutputVideoRefreshPeriod' has been explicitly marked deprecated here 182 | CV_EXPORT CVTime CVDisplayLinkGetNominalOutputVideoRefreshPeriod( CVDisplayLinkRef CV_NONNULL displayLink ); | ^ ui/cocoa.m:664:13: error: 'CVDisplayLinkRelease' is deprecated: first deprecated in macOS 15.0 - use NSView.displayLink(target:selector:), NSWindow.displayLink(target:selector:), or NSScreen.displayLink(target:selector:) [-Werror,-Wdeprecated-declarations] 664 | CVDisplayLinkRelease(displayLink); | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVDisplayLink.h:249:16: note: 'CVDisplayLinkRelease' has been explicitly marked deprecated here 249 | CV_EXPORT void CVDisplayLinkRelease( CV_RELEASES_ARGUMENT CVDisplayLinkRef CV_NULLABLE displayLink ); | ^ 3 errors generated. For the next release, ignore the warnings using #pragma directives. At least until we figure the correct new API usage. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu> Tested-by: Phil Dennis-Jordan <phil@philjordan.eu> Message-Id: <20241121131954.98949-1-philmd@linaro.org>