aboutsummaryrefslogtreecommitdiff
path: root/ui/gtk.c
AgeCommit message (Collapse)AuthorFilesLines
2024-09-10qapi/ui: Drop temporary 'prefix'Markus Armbruster1-2/+2
Recent commit "qapi: Smarter camel_to_upper() to reduce need for 'prefix'" added a temporary 'prefix' to delay changing the generated code. Revert it. This improves DisplayGLMode's generated enumeration constant prefix from DISPLAYGL_MODE to DISPLAY_GL_MODE. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240904111836.3273842-9-armbru@redhat.com>
2024-07-23util/fifo8: Rename fifo8_pop_buf() -> fifo8_pop_bufptr()Philippe Mathieu-Daudé1-1/+1
Since fifo8_pop_buf() return a const buffer (which points directly into the FIFO backing store). Rename it using the 'bufptr' suffix to better reflect that it is a pointer to the internal buffer that is being returned. This will help differentiate with methods *copying* the FIFO data. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-Id: <20240722160745.67904-6-philmd@linaro.org>
2024-07-16ui/console: Convert mouse visibility parameter into boolAkihiko Odaki1-1/+1
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Phil Dennis-Jordan <phil@philjordan.eu> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240715-cursor-v3-2-afa5b9492dbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-05-14ui/gtk: Fix mouse/motion event scaling issue with GTK display backendhikalium1-5/+13
Remove gtk_widget_get_scale_factor() usage from the calculation of the motion events in the GTK backend to make it work correctly on environments that have `gtk_widget_get_scale_factor() != 1`. This scale factor usage had been introduced in the commit f14aab420c and at that time the window size was used for calculating the things and it was working correctly. However, in the commit 2f31663ed4 the logic switched to use the widget size instead of window size and because of the change the usage of scale factor becomes invalid (since widgets use `vc->gfx.scale_{x, y}` for scaling). Tested on Crostini on ChromeOS (15823.51.0) with an external display. Fixes: 2f31663ed4 ("ui/gtk: use widget size for cursor motion event") Fixes: f14aab420c ("ui: fix incorrect pointer position on highdpi with gtk") Signed-off-by: hikalium <hikalium@hikalium.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240512111435.30121-3-hikalium@hikalium.com>
2024-05-14ui/gtk: Add gd_motion_event trace eventhikalium1-0/+2
Add gd_motion_event trace event for making it easy to debug gd_motion_event related issues. Signed-off-by: hikalium <hikalium@hikalium.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240512111435.30121-2-hikalium@hikalium.com>
2024-05-14ui/console: Use qemu_dmabuf_set_..() helpers insteadDongwon Kim1-3/+3
This commit updates all occurrences where these fields were set directly have been updated to utilize helper functions. v7: removed prefix, "dpy_gl_" from all helpers v8: Introduction of helpers was removed as those were already added by the previous commit Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-5-dongwon.kim@intel.com>
2024-05-14ui/console: Use qemu_dmabuf_get_..() helpers insteadDongwon Kim1-2/+4
This commit updates all instances where fields within the QemuDmaBuf struct are directly accessed, replacing them with calls to these new helper functions. v6: fix typos in helper names in ui/spice-display.c v7: removed prefix, "dpy_gl_" from all helpers v8: Introduction of helpers was removed as those were already added by the previous commit v11: -- Use new qemu_dmabuf_close() instead of close(qemu_dmabuf_get_fd()). (Daniel P. Berrangé <berrange@redhat.com>) -- Use new qemu_dmabuf_dup_fd() instead of dup(qemu_dmabuf_get_fd()). (Daniel P. Berrangé <berrange@redhat.com>) Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-4-dongwon.kim@intel.com>
2024-05-14ui/gtk: Check if fence_fd is equal to or greater than 0Dongwon Kim1-4/+6
'fence_fd' needs to be validated always before being referenced And the passing condition should include '== 0' as 0 is a valid value for the file descriptor. Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-2-dongwon.kim@intel.com>
2023-11-21ui: use "vc" chardev for dbus, gtk & spice-appMarc-André Lureau1-0/+1
Those display have their own implementation of "vc" chardev, which doesn't use pixman. They also don't implement the width/height/cols/rows options, so qemu_display_get_vc() should return a compatible argument. This patch was meant to be with the pixman series, when the "vc" field was introduced. It fixes a regression where VC are created on the tty (or null) instead of the display own "vc" implementation. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Thomas Huth <thuth@redhat.com>
2023-11-07ui: Replacing pointer in functionSergey Mironov1-1/+1
At the end of the first if we see 'vc->gfx.surface = NULL;', further checking of it is pointless. In the second if, ectx is taken. Found by Linux Verification Center (linuxtesting.org) with SVACE. Co-developed-by: Linux Verification Center <sdl.qemu@linuxtesting.org> Signed-off-by: Sergey Mironov <mironov@fintech.ru> Message-ID: <20231012104448.1251039-1-mironov@fintech.ru> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-11-07ui/gtk: force realization of drawing areaMarc-André Lureau1-0/+10
Fixes the GL context creation from a widget that isn't yet realized (in a hidden tab for example). Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1727 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Antonio Caggiano <quic_acaggian@quicinc.com> Message-Id: <20231017111642.1155545-1-marcandre.lureau@redhat.com>
2023-10-03ui/gtk: fix UI info preconditionMarc-André Lureau1-0/+8
dpy_get_ui_info() shouldn't be called if the underlying GPU doesn't support it. Before the assert() was added and the regression introduced, GTK code used to get "zero" UI info, for ex with a simple VGA device. The assert was added to prevent from calling when there are no console too. The other display backend that calls dpy_get_ui_info() correctly checks that pre-condition. Calling dpy_set_ui_info() is "safe" in this case, it will simply return an error that can be generally ignored. Fixes: commit a92e7bb4c ("ui: add precondition for dpy_get_ui_info()") Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-10-03input: Allow to choose console with qemu_input_is_absoluteAkihiko Odaki1-6/+6
Although an input is routed depending on the console, qemu_input_is_absolute() had no mechanism to specify the console. Accept QemuConsole as an argument for qemu_input_is_absolute, and let the display know the absolute/relative state for a particular console. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230921082936.28100-1-akihiko.odaki@daynix.com>
2023-09-29ui: Clean up local variable shadowingMarkus Armbruster1-7/+7
Local variables shadowing other local variables or parameters make the code needlessly hard to understand. Tracked down with -Wshadow=local. Clean up: delete inner declarations when they are actually redundant, else rename variables. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20230921121312.1301864-4-armbru@redhat.com>
2023-09-12ui/console: remove redundant format fieldMarc-André Lureau1-1/+1
It's already part of PIXMAN image. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-12ui/vc: rename kbd_put to qemu_text_console functionsMarc-André Lureau1-3/+3
They are QemuTextConsole functions, let's make it clear. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-04ui/gtk: fix leaks found wtih fuzzingDmitry Frolov1-1/+2
It is true, that there is no problem during runtime from the first sight, because the memory is lost just before qemu exits. Nevertheless, this change is necessary, because AddressSanitizer is not able to recognize this situation and produces crash-report (which is false-positive in fact). Lots of False-Positive warnings are davaluing problems, found with fuzzing, and thus the whole methodology of dynamic analysis. This patch eliminates such False-Positive reports, and makes every problem, found with fuzzing, more valuable. Fixes: 060ab76356 ("gtk: don't exit early in case gtk init fails") Signed-off-by: Dmitry Frolov <frolov@swemel.ru> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Message-Id: <20230825115818.1091936-1-frolov@swemel.ru>
2023-09-04ui/vc: change the argument for QemuTextConsoleMarc-André Lureau1-1/+1
Those functions are specifc to text/vc console, make that explicit from the argument type. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-45-marcandre.lureau@redhat.com>
2023-09-04ui/vc: do not parse VC-specific options in Spice and GTKMarc-André Lureau1-1/+0
In commit 6f974c843c ("gtk: overwrite the console.c char driver"), I shared the VC console parse handler with GTK. And later on in commit d8aec9d9 ("display: add -display spice-app launching a Spice client"), I also used it to handle spice-app VC. This is not necessary, the VC console options (width/height/cols/rows) are specific, and unused by tty-level GTK/Spice VC. This is not a breaking change, as those options are still being parsed by QAPI ChardevVC. Adjust the documentation about it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-44-marcandre.lureau@redhat.com>
2023-06-27ui/gtk: making dmabuf NULL when it's released.Dongwon Kim1-0/+5
Set vc->gfx.guest_fb.dmabuf to NULL to prevent any further access to it after the dmabuf is released. v2: move declaration of vc inside ifdef Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20230627005316.5627-1-dongwon.kim@intel.com>
2023-06-27ui/touch: Move event handling to a common helperBilal Elmoussaoui1-56/+5
To share code between the GTK and DBus UI bakcends see the next commit for details Signed-off-by: Bilal Elmoussaoui <belmouss@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230619095337.9899-2-belmouss@redhat.com>
2023-05-28ui/gtk: enable backend to send multi-touch eventsSergio Lopez1-0/+92
GTK3 provides the infrastructure to receive and process multi-touch events through the "touch-event" signal and the GdkEventTouch type. Make use of it to transpose events from the host to the guest. This allows users of machines with hardware capable of receiving multi-touch events to run guests that can also receive those events and interpret them as gestures, when appropriate. An example of this in action can be seen here: https://fosstodon.org/@slp/109545849296546767 Signed-off-by: Sergio Lopez <slp@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230526112925.38794-7-slp@redhat.com>
2023-05-28gtk: add gl-area support on win32Marc-André Lureau1-0/+6
On Windows, we don't use the low-level GBM/EGL helpers (no dmabuf etc), we can turn on GL area support for the rest of rendering. (fwiw, GDK backend may be either WGL or EGL) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Bernhard Beschow <shentey@gmail.com> Message-Id: <20230515132527.1026064-1-marcandre.lureau@redhat.com>
2023-05-28ui/gtk: use widget size for cursor motion eventErico Nunes1-5/+3
The gd_motion_event size has some calculations for the cursor position, which also take into account things like different size of the framebuffer compared to the window size. The use of window size makes things more difficult though, as at least in the case of Wayland includes the size of ui elements like a menu bar at the top of the window. This leads to a wrong position calculation by a few pixels. Fix it by using the size of the widget, which already returns the size of the actual space to render the framebuffer. Signed-off-by: Erico Nunes <ernunes@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Message-Id: <20230320160856.364319-1-ernunes@redhat.com>
2023-03-21ui: fix crash on serial reset, during initMarc-André Lureau1-1/+3
For ex, when resetting the xlnx-zcu102 machine: (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x50) * frame #0: 0x10020a740 gd_vc_send_chars(vc=0x000000000) at gtk.c:1759:41 [opt] frame #1: 0x100636264 qemu_chr_fe_accept_input(be=<unavailable>) at char-fe.c:159:9 [opt] frame #2: 0x1000608e0 cadence_uart_reset_hold [inlined] uart_rx_reset(s=0x10810a960) at cadence_uart.c:158:5 [opt] frame #3: 0x1000608d4 cadence_uart_reset_hold(obj=0x10810a960) at cadence_uart.c:530:5 [opt] frame #4: 0x100580ab4 resettable_phase_hold(obj=0x10810a960, opaque=0x000000000, type=<unavailable>) at resettable.c:0 [opt] frame #5: 0x10057d1b0 bus_reset_child_foreach(obj=<unavailable>, cb=(resettable_phase_hold at resettable.c:162), opaque=0x000000000, type=RESET_TYPE_COLD) at bus.c:97:13 [opt] frame #6: 0x1005809f8 resettable_phase_hold [inlined] resettable_child_foreach(rc=0x000060000332d2c0, obj=0x0000600002c1c180, cb=<unavailable>, opaque=0x000000000, type=RESET_TYPE_COLD) at resettable.c:96:9 [opt] frame #7: 0x1005809d8 resettable_phase_hold(obj=0x0000600002c1c180, opaque=0x000000000, type=RESET_TYPE_COLD) at resettable.c:173:5 [opt] frame #8: 0x1005803a0 resettable_assert_reset(obj=0x0000600002c1c180, type=<unavailable>) at resettable.c:60:5 [opt] frame #9: 0x10058027c resettable_reset(obj=0x0000600002c1c180, type=RESET_TYPE_COLD) at resettable.c:45:5 [opt] While the chardev is created early, the VirtualConsole is associated after, during qemu_init_displays(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230220072251.3385878-1-marcandre.lureau@redhat.com>
2023-03-21ui/gtk: fix cursor moved to left cornerMarc-André Lureau1-1/+2
Do not attempt to move the pointer if the widget is not yet realized. The mouse cursor is placed to the corner of the screen, on X11 at least, as x_root and y_root are then miscalculated. (this is not reproducible on Wayland, because Gtk doesn't implement device warping there) This also fixes the following warning at start: qemu: Gdk: gdk_window_get_root_coords: assertion 'GDK_IS_WINDOW (window)' failed Fixes: 6effaa16ac98 ("ui: set cursor position upon listener registration") Reported-by: Bernhard Beschow <shentey@gmail.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Tested-by: Bernhard Beschow <shentey@gmail.com> Message-Id: <20230320132624.1612464-1-marcandre.lureau@redhat.com>
2023-02-14Do not include "qemu/error-report.h" in headers that do not need itThomas Huth1-0/+1
Include it in the .c files instead that use the error reporting functions. Message-Id: <20230210111931.1115489-1-thuth@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
2023-02-08Drop duplicate #includeMarkus Armbruster1-1/+0
Tracked down with the help of scripts/clean-includes. Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20230202133830.2152150-21-armbru@redhat.com>
2022-11-23gtk: disable GTK Clipboard with a new meson optionClaudio Fontana1-0/+2
The GTK Clipboard implementation may cause guest hangs. Therefore implement new configure switch: --enable-gtk-clipboard, as a meson option disabled by default, which warns in the help text about the experimental nature of the feature. Regenerate the meson build options to include it. The initialization of the clipboard is gtk.c, as well as the compilation of gtk-clipboard.c are now conditional on this new option to be set. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1150 Signed-off-by: Claudio Fontana <cfontana@suse.de> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jim Fehlig <jfehlig@suse.com> Message-Id: <20221121135538.14625-1-cfontana@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-10-24ui: remove useless typecastsVolker Rümelin1-1/+1
Commit 8f9abdf586 ("chardev: src buffer const for write functions") changed the type of the second parameter of qemu_chr_be_write() from uint8_t * to const uint8_t *. Remove the now useless type casts from qemu_chr_be_write() function calls in ui/console.c and ui/gtk.c. Cc: qemu-trivial@nongnu.org Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Claudio Fontana <cfontana@suse.de> Message-Id: <20221022141204.29358-1-vr_qemu@t-online.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2022-10-12gtk: Add show_menubar=on|off command line option.Bryce Mills1-5/+10
The patch adds "show_menubar" command line option for GTK UI similar to "show_tabs". This option allows to hide menu bar initially, it still can be toggled by shortcut and other shortcuts still work. Signed-off-by: Bryce Mills <brycemills@proton.me> Acked-by: Markus Armbruster <armbru@redhat.com> Message-Id: <NWO_zx1CT5Aj9vAXsRlqBppXd63gcKwL9V1qM1Meh36M_9tCw-EsCnfpvONXhHjmtKIUoSuCy9OO6cHS7M8b0oHBOCZG6f1jZ4Q2tqgI2Qo=@proton.me> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-10-12ui/gtk: Fix the implicit mouse ungrabbing logicAkihiko Odaki1-3/+7
Although the grab menu item represents the tabbed displays, the old implicit mouse ungrabbing logic changes the grab menu item even for an untabbed display. Leave the grab menu item when implicitly ungrabbing mouse for an untabbed display. The new ungrabbing logic introduced in gd_mouse_mode_change() strictly follows the corresponding grabbing logic found in gd_button_event(). Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-Id: <20221008140116.11473-1-akihiko.odaki@daynix.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-07-19gtk: Add show_tabs=on|off command line option.Felix xq Queißner1-0/+4
The patch adds "show_tabs" command line option for GTK ui similar to "grab_on_hover". This option allows tabbed view mode to not have to be enabled by hand at each start of the VM. Signed-off-by: Felix "xq" Queißner <xq@random-projects.net> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220712133753.18937-1-xq@random-projects.net> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-06-14ui: Deliver refresh rate via QemuUIInfoAkihiko Odaki1-19/+26
This change adds a new member, refresh_rate to QemuUIInfo in include/ui/console.h. It represents the refresh rate of the physical display backend, and it is more appropriate than GUI update interval as the refresh rate which the emulated device reports: - sdl may set GUI update interval shorter than the refresh rate of the physical display to respond to user-generated events. - sdl and vnc aggressively changes GUI update interval, but a guests is typically not designed to respond to frequent refresh rate changes, or frequent "display mode" changes in general. The frequency of refresh rate changes of the physical display backend matches better to the guest's expectation. QemuUIInfo also has other members representing "display mode", which makes it suitable for refresh rate representation. It has a throttling of update notifications, and prevents frequent changes of the display mode. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20220226115516.59830-3-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-03-18ui/gtk: Ignore 2- and 3-button press eventsK. Lange1-0/+4
GTK already produces corresponding GDK_BUTTON_PRESS events alongside 2BUTTON and 3BUTTON_PRESS events. The 2BUTTON and 3BUTTON_PRESS events were incorrectly being interpreted and passed to guests as button release events. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/558 Signed-off-by: K. Lange <klange@toaruos.org> Message-Id: <20220305104521.3583703-1-klange@toaruos.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-03-14ui/console: move dcl compatiblity check to a callbackMarc-André Lureau1-2/+16
As expected from the "compatible_dcl" comment, a simple comparison of ops isn't enough. The following patch will fix a regression introduced by this limited check by extending the compatibility callback for egl-headless. For now, this patch simply replaces the the "compatible_dcl" ops pointer with a "dpy_gl_ctx_is_compatible_ctx" callback. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2022-01-13ui/gtk: pass horizontal scroll information to the device codeDmitry Petrov1-12/+42
Signed-off-by: Dmitry Petrov <dpetroff@gmail.com> Message-Id: <20220108153947.171861-4-dpetroff@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-12-21ui: split the GL context in a different objectMarc-André Lureau1-8/+16
This will allow to have one GL context but a variable number of listeners. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2021-12-21ui: simplify gl unblock & flushMarc-André Lureau1-1/+0
GraphicHw.gl_flushed was introduced to notify the device (vhost-user-gpu) that the GL resources (the display scanout) are no longer needed. It was decoupled from QEMU own gl-blocking mechanism, but that difference isn't helping. Instead, we can reuse QEMU gl-blocking and notify virtio_gpu_gl_flushed() when unblocking (to unlock vhost-user-gpu). An extra block/unblock is added arount dpy_gl_update() so existing backends that don't block will have the flush event handled. It will also help when there are no backends associated. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2021-12-21ui: associate GL context outside of display listener registrationMarc-André Lureau1-0/+3
Consoles can have an associated GL context, without listeners (they may be added or removed later on). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2021-12-21ui: do not delay further remote resizeMarc-André Lureau1-1/+1
A remote client, such as Spice, will already avoid flooding the stream by delaying the resize requests. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2021-11-22ui/gtk: graphic_hw_gl_flushed after closing dmabuf->fence_fdDongwon Kim1-2/+2
The dmabuf often becomes invalid right after unblocking pipeline and graphic_hw_gl_flushed in case a new scanout blob is submitted because the dmabuf associated with the current guest scanout is freed after swapping. So both graphic_hw_gl_block and graphic_hw_gl_flushed should be executed after closing fence_fd for the current dmabuf. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20211121172237.14937-1-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-11-22ui: fix incorrect pointer position on highdpi with gtkAlexander Orzechowski1-5/+8
Signed-off-by: Alexander Orzechowski <orzechowski.alexander@gmail.com> Message-Id: <20211121065504.29101-3-orzechowski.alexander@gmail.com> [ kraxel: codestyle fix ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-11-05ui/gtk: gd_draw_event returns FALSE when no cairo surface is boundDongwon Kim1-0/+3
gd_draw_event shouldn't try to repaint if surface does not exist for the VC. Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20211104065153.28897-4-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-11-05ui/gtk-egl: un-tab and re-tab should destroy egl surface and contextDongwon Kim1-0/+20
An old esurface should be destroyed and set to be NULL when doing un-tab and re-tab so that a new esurface an context can be created for the window widget that those will be bound to. v2: enabling opengl specific routines only when CONFIG_OPENGL is set Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Signed-off-by: Khairul Anuar Romli <khairul.anuar.romli@intel.com> Message-Id: <20211104065153.28897-1-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-09-15ui/gtk-egl: Wait for the draw signal for dmabuf blobsVivek Kasireddy1-1/+1
Instead of immediately drawing and submitting, queue and wait for the draw signal if the dmabuf submitted is a blob. Cc: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Message-Id: <20210914211837.3229977-5-vivek.kasireddy@intel.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-09-15ui: Create sync objects and fences only for blobsVivek Kasireddy1-0/+13
Create sync objects and fences only for dmabufs that are blobs. Once a fence is created (after glFlush) and is signalled, graphic_hw_gl_flushed() will be called and virtio-gpu cmd processing will be resumed. Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Message-Id: <20210914211837.3229977-4-vivek.kasireddy@intel.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-09-15ui/gtk: Create a common release_dmabuf helperVivek Kasireddy1-1/+10
Since the texture release mechanism is same for both gtk-egl and gtk-glarea, move the helper from gtk-egl to common gtk code so that it can be shared by both gtk backends. Cc: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Message-Id: <20210914211837.3229977-2-vivek.kasireddy@intel.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-08-10ui/gtk: retry sending VTE console inputVolker Rümelin1-6/+4
Commit 584af1f1d9 ("ui/gtk: add a keyboard fifo to the VTE consoles") changed the VTE chardev backend code to rely on the chr_accept_input() callback function. The code expects a chr_accept_input() call whenever qemu_chr_be_can_write() bytes were written. It turns out this is wrong. Some chardev frontends only call this callback after can_write was 0. Change the code to send data until the keyboard fifo is empty or qemu_chr_be_can_write() returns 0. Fixes: 584af1f1d9 ("ui/gtk: add a keyboard fifo to the VTE consoles") Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210810063257.17411-1-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-07-26ui/gtk: add a keyboard fifo to the VTE consolesVolker Rümelin1-9/+33
Since commit 8eb13bbbac ("ui/gtk: vte: fix sending multiple characeters") it's very easy to lock up QEMU with the GTK ui. If you configure a guest with a serial device and the guest doesn't listen on this device, QEMU will lock up after entering two characters in the serial console. That's because current code uses a busy loop for the chardev write retries and the busy loop doesn't terminate in this case. To fix this problem add a fifo to the VTE consoles and use the chr_accept_input() callback function to write the remaining characters in the queue to the chardev. The fifo has a size of 4096 bytes, so one can copy and paste a fairly large URL or file path. Fixes: 8eb13bbbac ("ui/gtk: vte: fix sending multiple characeters") Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20210725165039.5242-1-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>