aboutsummaryrefslogtreecommitdiff
path: root/ui
AgeCommit message (Collapse)AuthorFilesLines
2023-09-04ui/console: simplify getting active_console sizeMarc-André Lureau1-4/+2
We can get the active console dimension regardless of its kind, by simply giving NULL as argument. It will fallback with the given value when the dimensions aren't known. This will also allow to move the code in a separate unit more easily. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-33-marcandre.lureau@redhat.com>
2023-09-04ui/vc: move some text console initialization to qom handlersMarc-André Lureau1-11/+11
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-32-marcandre.lureau@redhat.com>
2023-09-04ui/vc: fold text_console_do_init() in vc_chr_open()Marc-André Lureau1-49/+31
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230830093843.3531473-31-marcandre.lureau@redhat.com>
2023-09-04ui/console: move graphic fields to QemuGraphicConsoleMarc-André Lureau1-46/+64
Move fields specific to graphic console to the console subclass. qemu_console_get_head() is adapated to accomodate QemuTextConsole, and always returns 0. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-30-marcandre.lureau@redhat.com>
2023-09-04ui/vc: move text fields to QemuTextConsoleMarc-André Lureau1-86/+91
Now we can instantiate the specific console with its own fields. Pass the most appropriate type to the various functions, and cast up to QEMU_CONSOLE as necessary. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-29-marcandre.lureau@redhat.com>
2023-09-04ui/console: free more QemuConsole resourcesMarc-André Lureau1-1/+4
This code path is probably not executed at this point, since console aren't being released. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-28-marcandre.lureau@redhat.com>
2023-09-04ui/vc: move cursor_timer initialization to QemuTextConsole classMarc-André Lureau1-2/+4
The timer is only relevant when a text console exists. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-27-marcandre.lureau@redhat.com>
2023-09-04ui/console: allocate ui_timer in QemuConsoleMarc-André Lureau1-2/+6
Although at this point only QemuGraphicConsole have hw_ops that implements ui_info() callback, it makes sense to keep the code in the base QemuConsole, to simplify conditions for the caller. As of now, the code didn't reach a NULL timer because dpy_set_ui_info() checks if dpy_ui_info_supported() (hw_ops->ui_info != NULL), which is false for text_console_ops. This is a bit fragile, let simply allocate and free the timer in the base class. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-26-marcandre.lureau@redhat.com>
2023-09-04ui/console: update the head from unused QemuConsoleMarc-André Lureau1-1/+1
When recycling unused QemuConsole, we should still set the associated head number for correct information and lookups. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-25-marcandre.lureau@redhat.com>
2023-09-04ui/console: specialize console_lookup_unused()Marc-André Lureau1-3/+4
graphics_console_init() is expected to return a graphic console. The function doesn't need to be exported. We are going to specialize further QemuGraphicConsole & QemuTextConsole. The two will not be interchangeable anymore. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-24-marcandre.lureau@redhat.com>
2023-09-04ui/console: remove new_console()Marc-André Lureau1-14/+5
The constructor helper isn't of much used now. "head" is only specified for graphic console (and default to 0), and we are going to move it to QemuGraphicConsole next. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-23-marcandre.lureau@redhat.com>
2023-09-04ui/console: register the console from qemu_console_init()Marc-André Lureau1-2/+1
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-22-marcandre.lureau@redhat.com>
2023-09-04ui/console: instantiate a specific console typeMarc-André Lureau1-28/+19
This will allow to move code/data to the specific console types. Replace console_type_t with object type check. QemuConsole can be abstract. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-21-marcandre.lureau@redhat.com>
2023-09-04ui/console: introduce different console objectsMarc-André Lureau1-0/+84
Boilerplate code to introduce different object types for the different console types. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-20-marcandre.lureau@redhat.com>
2023-09-04ui/console: change new_console() to use object initializationMarc-André Lureau1-36/+56
Object construction should be done in respective object instance and class handlers. Introduce qemu_console_register() to split out the registration logic. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-19-marcandre.lureau@redhat.com>
2023-09-04ui/console: use OBJECT_DEFINE_TYPE for QemuConsoleMarc-André Lureau1-14/+17
The following patch will move some object initialization to the corresponding handlers. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-18-marcandre.lureau@redhat.com>
2023-09-04ui/vc: move VCCharDev specific fields out of QemuConsoleMarc-André Lureau1-74/+73
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-17-marcandre.lureau@redhat.com>
2023-09-04ui/vc: pass VCCharDev to VC-specific functionsMarc-André Lureau1-31/+39
Even though they actually use more of QemuConsole at this point, it makes it clearer those functions are only used from the chardev implementation. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-16-marcandre.lureau@redhat.com>
2023-09-04ui/vc: fold text_update_xy()Marc-André Lureau1-9/+4
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-15-marcandre.lureau@redhat.com>
2023-09-04ui/vc: replace variable with static text attributes defaultMarc-André Lureau1-17/+13
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-14-marcandre.lureau@redhat.com>
2023-09-04ui/vc: move VCChardev declaration at the topMarc-André Lureau1-6/+6
To allow easier refactoring in following patches. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-13-marcandre.lureau@redhat.com>
2023-09-04ui/vc: VC always has a DisplayState nowMarc-André Lureau1-4/+0
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-12-marcandre.lureau@redhat.com>
2023-09-04ui/console: new_console() cannot failMarc-André Lureau1-5/+0
There is no code path that could allow a NULL return there. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-11-marcandre.lureau@redhat.com>
2023-09-04ui/console: get the DisplayState from new_console()Marc-André Lureau1-19/+8
There is no obvious reason to defer text console initialization. We can simply take the global display state in new_console(). This simplify somewhat the code to allow moving the VC to a separate unit. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-10-marcandre.lureau@redhat.com>
2023-09-01ui/console: drop have_gfxMarc-André Lureau1-7/+0
All usages have been removed. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-9-marcandre.lureau@redhat.com>
2023-09-01ui/console: call dpy_gfx_update() regardless of have_gfxMarc-André Lureau1-1/+1
The function will handle the case when no listeners are gfx, without extra meaningful cost. This allows to get rid of DisplayState dependency in VC implementation. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-8-marcandre.lureau@redhat.com>
2023-09-01ui/console: console_select() regardless of have_gfxMarc-André Lureau1-6/+4
Even if we don't have a gfx listener, we should call displaychangelistener_display_console() which handle that case correctly. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-7-marcandre.lureau@redhat.com>
2023-09-01ui/vc: drop have_textMarc-André Lureau1-29/+13
If there are no "text" listener, the callback will simply be ignored. The rest of text handling can be done cheaply. This allows to remove some dependency on DisplayState from VC implementation. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-6-marcandre.lureau@redhat.com>
2023-09-01ui/vc: replace vc_chr_write() with generic qemu_chr_write()Marc-André Lureau1-3/+3
We shouldn't call the callback directly, but use the chardev API, unless there is a clear reason. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230830093843.3531473-5-marcandre.lureau@redhat.com>
2023-09-01ui/qmp: move screendump to ui-qmp-cmds.cMarc-André Lureau2-195/+204
console.c unit is over-crowded. This code is specific to the handling of the QMP screendump command, so move it in ui-qmp-cmds. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-4-marcandre.lureau@redhat.com>
2023-09-01ui: remove qemu_pixman_linebuf_copy()Marc-André Lureau1-8/+0
Since commit 43c7d8bd449 ("console: add qemu_pixman_linebuf_copy"), it seems it was never used. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-3-marcandre.lureau@redhat.com>
2023-09-01ui: remove qemu_pixman_color() helperMarc-André Lureau1-11/+0
Usage removed in commit e27bd65a72d ("console: switch color_table_rgb to pixman_color_t") Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230830093843.3531473-2-marcandre.lureau@redhat.com>
2023-08-31ui: spelling fixesMichael Tokarev6-7/+7
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20230823065335.1919380-2-mjt@tls.msk.ru> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2023-08-07ui/gtk: set scanout mode in gd_egl/gd_gl_area_scanout_textureDongwon Kim2-0/+2
Fixing a regression (black screen) caused by a commit 92b58156e7 ("ui/gtk: set scanout-mode right before scheduling draw"). The commit 92b58156e7 was made with an assumption that the scanout mode needs to be set only if the guest scanout is a dmabuf but there are cases (e.g. virtio-gpu-virgl) where the scanout is still processed in a form of a texture but is not backed by dmabuf. So it is needed to put back the line that sets scanout mode in gd_egl_scanout_texture and gd_gl_area_scanout_texture. Fixes: 92b58156e7 ("ui/gtk: set scanout-mode right before scheduling draw) Reported-by: Volker Rümelin <vr_qemu@t-online.de> 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: <20230725001131.24017-1-dongwon.kim@intel.com>
2023-08-01misc: Fix some typos in documentation and commentsStefan Weil1-1/+1
Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230730180329.851576-1-sw@weilnetz.de> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2023-08-01ui/dbus: fix clang compilation issueMarc-André Lureau1-1/+2
../ui/dbus-listener.c:236:9: error: expected expression Error *err = NULL; See: https://gitlab.com/qemu-project/qemu/-/issues/1782#note_1488517427 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20230726151221.515761-1-marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2023-08-01ui/dbus: fix win32 compilation when !openglMarc-Andre Lureau1-1/+3
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1782 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230725112540.53284-1-marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2023-07-25For curses display, recognize a few more control keysSean Estabrooks1-0/+6
The curses display handles most control-X keys, and translates them into their corresponding keycode. Here we recognize a few that are missing, Ctrl-@ (null), Ctrl-\ (backslash), Ctrl-] (right bracket), Ctrl-^ (caret), Ctrl-_ (underscore). Signed-off-by: Sean Estabrooks <sean.estabrooks@gmail.com> Message-id: CAHyVn3Bh9CRgDuOmf7G7Ngwamu8d4cVozAcB2i4ymnnggBXNmg@mail.gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-07-17ui/gtk: skip refresh if new dmabuf has been submittedDongwon Kim2-0/+8
Skip refresh if a new dmabuf (guest scanout frame) has already been submitted and ready to be drawn because the scanout will be updated with new frame anyway. 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> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20230706183355.29361-2-dongwon.kim@intel.com>
2023-07-17ui/gtk: set scanout-mode right before scheduling drawDongwon Kim2-2/+2
Setting scanout mode is better to be done very last minute right because the mode can be reset anytime after it is set in dpy_gl_scanout_texture by any asynchronouse dpy_refresh call, which eventually cancels drawing of the guest scanout texture. 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> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20230706183355.29361-1-dongwon.kim@intel.com>
2023-07-17virtio-gpu-udmabuf: correct naming of QemuDmaBuf size propertiesDongwon Kim4-15/+18
Replace 'width' and 'height' in QemuDmaBuf with 'backing_widht' and 'backing_height' as these commonly indicate the size of the whole surface (e.g. guest's Xorg extended display). Then use 'width' and 'height' for sub region in there (e.g. guest's scanouts). 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: <20230713040444.32267-1-dongwon.kim@intel.com>
2023-07-17virtio-gpu: replace the surface with null surface when resettingDongwon Kim1-5/+6
The primary guest scanout shows the booting screen right after reboot but additional guest displays (i.e. max_ouptuts > 1) will keep displaying the old frames until the guest virtio gpu driver gets initialized, which could cause some confusion. A better way is to to replace the surface with a place holder that tells the display is not active during the reset of virtio-gpu device. And to immediately update the surface with the place holder image after the switch, displaychangelistener_gfx_switch needs to be called with 'update == TRUE' in dpy_gfx_replace_surface when the new surface is NULL. 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> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20230627224451.11739-1-dongwon.kim@intel.com>
2023-07-17ui/gtk: Make sure the right EGL context is currently boundDongwon Kim2-0/+6
Observed a wrong context is bound when changing the scanout mode. To prevent problem, it is needed to make sure to bind the right context in gtk_egl_set_scanout_mode/gtk_gl_area_set_scanout_mode as well as unbind one in the end of gd_egl_update/gd_gl_area_update. 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: <20230628191504.17185-1-dongwon.kim@intel.com>
2023-07-17ui/vnc-clipboard: fix infinite loop in inflate_buffer (CVE-2023-3255)Mauro Matteo Cascella1-6/+4
A wrong exit condition may lead to an infinite loop when inflating a valid zlib buffer containing some extra bytes in the `inflate_buffer` function. The bug only occurs post-authentication. Return the buffer immediately if the end of the compressed data has been reached (Z_STREAM_END). Fixes: CVE-2023-3255 Fixes: 0bf41cab ("ui/vnc: clipboard support") Reported-by: Kevin Denis <kevin.denis@synacktiv.com> Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20230704084210.101822-1-mcascell@redhat.com>
2023-06-30ui/dbus: fix build errors in dbus_update_gl_cb and dbus_call_update_glRichard Henderson1-0/+4
Add some ifdefs to avoid an unused function and unused variable. Fixes: de1f8ce0abb8 ("ui/dbus: use shared D3D11 Texture2D when possible") Co-developed-by: BALATON Zoltan <balaton@eik.bme.hu> Message-Id: <336f7697-bcfa-1f5f-e411-6859815aa26c@eik.bme.hu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2023-06-27ui/dbus: use shared D3D11 Texture2D when possibleMarc-André Lureau2-31/+324
When the client implements "org.qemu.Display1.Listener.Win32.D3d11" and we are running on ANGLE/win32, share the scanout texture with the peer process, and draw with ScanoutTexture2d/UpdateTexture2d methods. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230606115658.677673-22-marcandre.lureau@redhat.com>
2023-06-27ui: add optional d3d texture pointer to scanout textureMarc-André Lureau8-15/+25
The following patch will get the underlying D3D11 Texture2D from the virgl renderer scanout. Pass it along to the texture scanout callbacks as a priliminary step, to simplify review. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230606115658.677673-20-marcandre.lureau@redhat.com>
2023-06-27ui/egl: query ANGLE d3d deviceMarc-André Lureau2-1/+34
Check if ANGLE is being used with D3D backend. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230606115658.677673-19-marcandre.lureau@redhat.com>
2023-06-27ui/dbus: add some GL tracesMarc-André Lureau2-0/+9
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230606115658.677673-17-marcandre.lureau@redhat.com>
2023-06-27ui/dbus: add GL support on win32Marc-André Lureau2-34/+68
Enable usage of dbus,gl= on win32. At this point, the scanout texture is read on the DisplaySurface memory, and the client is then updated with the "2D" API (with shared memory if possible). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230606115658.677673-16-marcandre.lureau@redhat.com>