a92e7bb4ca
ui: add precondition for dpy_get_ui_info()
...
Ensure that it only get called when dpy_ui_info_supported(). The
function should always return a result. There should be a non-null
console or active_console.
Modify the argument to be const as well.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Albert Esteve <aesteve@redhat.com >
2023-09-12 11:14:09 +04:00
48a35e12fa
ui: fix crash when there are no active_console
...
Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
812 return con->hw_ops->ui_info != NULL;
(gdb) bt
#0 0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
#1 0x00005555558a44b1 in protocol_client_msg (vs=0x5555578c76c0, data=0x5555581e93f0 <incomplete sequence \373>, len=24) at ../ui/vnc.c:2585
#2 0x00005555558a19ac in vnc_client_read (vs=0x5555578c76c0) at ../ui/vnc.c:1607
#3 0x00005555558a1ac2 in vnc_client_io (ioc=0x5555581eb0e0, condition=G_IO_IN, opaque=0x5555578c76c0) at ../ui/vnc.c:1635
Fixes:
https://issues.redhat.com/browse/RHEL-2600
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Albert Esteve <aesteve@redhat.com >
2023-09-12 11:13:52 +04:00
6f11081991
ui/vc: split off the VC part from console.c
...
Move common declarations to console-priv.h, and add a new unit
console-vc.c which will handle VC/chardev rendering, when pixman is
available.
(if necessary, the move could be done chunk by chunks)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
2023-09-12 10:37:02 +04:00
f7ce755df8
ui/vc: preliminary QemuTextConsole changes before split
...
Those changes will help to split console.c unit in the following commit.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
2023-09-12 10:37:02 +04:00
ff174c67db
ui/console: remove redundant format field
...
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-12 10:37:02 +04:00
cc6ba2c6f5
ui/vc: rename kbd_put to qemu_text_console functions
...
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-12 10:37:02 +04:00
f5360a0d28
ui/vc: remove kbd_put_keysym() and update function calls
...
The function calls to `kbd_put_keysym` have been updated to now call
`kbd_put_keysym_console` with a NULL console parameter.
Like most console functions, NULL argument is now for the active console.
This will allow to rename the text console functions in a consistent manner.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com >
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com >
2023-09-12 10:37:02 +04:00
9db018ac56
ui/vc: change the argument for QemuTextConsole
...
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-04 14:57:44 +04:00
32aa1f8dee
ui/vc: do not parse VC-specific options in Spice and GTK
...
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-09-04 14:57:37 +04:00
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
0d0be87659
virtio-gpu: replace the surface with null surface when resetting
...
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-17 15:20:56 +04:00