322dae4bc8
ui/vc: move text console invalidate in helper
...
This will allow to split the VC 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-43-marcandre.lureau@redhat.com >
2023-09-04 14:38:15 +04:00
893fe23e7d
ui/console: minor stylistic changes
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Message-Id: <20230830093843.3531473-42-marcandre.lureau@redhat.com >
2023-09-04 14:24:36 +04:00
9cb737b77d
ui/vc: skip text console resize when possible
...
This function is called on invalidate, on each cursor blink.
Avoid the extra copy when the console size didn't change.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Message-Id: <20230830093843.3531473-41-marcandre.lureau@redhat.com >
2023-09-04 14:24:08 +04:00
3f9c21325c
ui/console: fold text_console_update_cursor_timer
...
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-40-marcandre.lureau@redhat.com >
2023-09-04 14:03:08 +04:00
0a1642e7cc
ui/console: assert(surface) where appropriate
...
The QemuTextConsole code paths assume a surface is being used as
scanout, let's make this more explicit.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Message-Id: <20230830093843.3531473-39-marcandre.lureau@redhat.com >
2023-09-04 14:01:52 +04:00
b704a8ce0c
ui/console: rename vga_ functions with qemu_console_
...
They are not specific to VGA. Let's use the object type name as prefix
instead, to avoid confusion.
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-38-marcandre.lureau@redhat.com >
2023-09-04 14:01:22 +04:00
1ece6777fe
ui/console: use QEMU_PIXMAN_COLOR helpers
...
QEMU_RGB macro is actually defining a pixman color. Make this explicit
in the macro name. Move it to qemu-pixman.h so it can be used elsewhere,
as done in the following patch. Finally, define
QEMU_PIXMAN_COLOR_{BLACK,GRAY}, to avoid need to look up the VGA color
table from the QemuConsole placeholder surface rendering.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20230830093843.3531473-37-marcandre.lureau@redhat.com >
2023-09-04 14:00:56 +04:00
8c6381d846
ui/console: declare console types in console.h
...
We are going to split the console.c unit next, and implement
separately. But we need to check the underlying type in various places.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Message-Id: <20230830093843.3531473-36-marcandre.lureau@redhat.com >
2023-09-04 14:00:46 +04:00
742a6896ea
ui/vc: use common text console surface creation
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Message-Id: <20230830093843.3531473-35-marcandre.lureau@redhat.com >
2023-09-04 14:00:38 +04:00
6ce7b1fa88
ui/console: remove need for g_width/g_height
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Message-Id: <20230830093843.3531473-34-marcandre.lureau@redhat.com >
2023-09-04 14:00:31 +04:00
5e5a30b7d1
ui/console: simplify getting active_console size
...
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-04 14:00:21 +04:00
60cb14b4f9
ui/vc: move some text console initialization to qom handlers
...
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-04 14:00:07 +04:00
98ee9dab81
ui/vc: fold text_console_do_init() in vc_chr_open()
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Message-Id: <20230830093843.3531473-31-marcandre.lureau@redhat.com >
2023-09-04 13:56:24 +04:00
58d5870845
ui/console: move graphic fields to QemuGraphicConsole
...
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-04 13:55:59 +04:00
b2bb9cc43d
ui/vc: move text fields to QemuTextConsole
...
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-04 13:55:56 +04:00
463c6b19c7
ui/console: free more QemuConsole resources
...
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-04 13:55:36 +04:00
b97a76d035
ui/vc: move cursor_timer initialization to QemuTextConsole class
...
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-04 13:53:03 +04:00
cfde05d15b
ui/console: allocate ui_timer in QemuConsole
...
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-04 13:52:48 +04:00
7fa4b8041b
ui/console: update the head from unused QemuConsole
...
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-04 13:52:16 +04:00
f9411aaebd
ui/console: specialize console_lookup_unused()
...
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-04 13:48:31 +04:00
34b7751574
ui/console: remove new_console()
...
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-04 13:48:19 +04:00
ba0ec5c293
ui/console: register the console from qemu_console_init()
...
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-04 13:48:10 +04:00
c105d60f7f
ui/console: instantiate a specific console type
...
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-04 13:47:58 +04:00
b208f745a8
ui/console: introduce different console objects
...
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-04 13:47:39 +04:00
098d57e7c0
ui/console: change new_console() to use object initialization
...
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-04 13:47:36 +04:00
e265917c77
ui/console: use OBJECT_DEFINE_TYPE for QemuConsole
...
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-04 13:38:06 +04:00
6505fd8d23
ui/vc: move VCCharDev specific fields out of QemuConsole
...
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-04 13:37:48 +04:00
4c946b7f97
ui/vc: pass VCCharDev to VC-specific functions
...
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-04 13:37:11 +04:00
d7c634aadf
ui/vc: fold text_update_xy()
...
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-04 13:36:42 +04:00
3be82c6a3a
ui/vc: replace variable with static text attributes default
...
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-04 13:36:32 +04:00
8c63667b25
ui/vc: move VCChardev declaration at the top
...
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-04 12:38:20 +04:00
6657e41cde
ui/vc: VC always has a DisplayState now
...
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-04 12:37:59 +04:00
dc6984bdc3
ui/console: new_console() cannot fail
...
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-04 12:37:54 +04:00
2fd319cff0
ui/console: get the DisplayState from new_console()
...
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-04 12:37:45 +04:00
cbcf0fa8fd
ui/console: drop have_gfx
...
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-01 17:21:04 +00:00
bc9b8bc93c
ui/console: call dpy_gfx_update() regardless of have_gfx
...
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-01 17:21:04 +00:00
074b24094f
ui/console: console_select() regardless of have_gfx
...
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-01 17:21:04 +00:00
177422789b
ui/vc: drop have_text
...
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-01 17:21:04 +00:00
f1f7a1e2cf
ui/vc: replace vc_chr_write() with generic qemu_chr_write()
...
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-01 17:21:04 +00:00
4f2c765ba6
ui/qmp: move screendump to ui-qmp-cmds.c
...
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-01 17:21:04 +00:00
426749a7b7
ui: remove qemu_pixman_linebuf_copy()
...
Since commit 43c7d8bd44
("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-01 17:21:04 +00:00
90da7d552f
ui: remove qemu_pixman_color() helper
...
Usage removed in commit e27bd65a72
("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-09-01 17:21:04 +00:00
d4761b6554
ui: spelling fixes
...
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-31 19:47:43 +02:00
58ea90f803
ui/gtk: set scanout mode in gd_egl/gd_gl_area_scanout_texture
...
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-07 17:13:42 +04:00
313e162951
misc: Fix some typos in documentation and comments
...
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-01 23:52:23 +02:00
7b4a3f8145
ui/dbus: fix clang compilation issue
...
../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-01 23:52:23 +02:00
866b24e4c3
ui/dbus: fix win32 compilation when !opengl
...
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-08-01 23:52:23 +02:00
9b579543d7
For curses display, recognize a few more control keys
...
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-25 10:56:51 +01:00
1be878eb97
ui/gtk: skip refresh if new dmabuf has been submitted
...
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-17 15:22:56 +04:00
92b58156e7
ui/gtk: set scanout-mode right before scheduling draw
...
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-17 15:22:56 +04:00