Commit graph

51 commits

Author SHA1 Message Date
Philipp Zabel 04c29e6aae backend-vnc: use weston_output_set_single_mode()
Use the shared helper extracted from the RDP backend to avoid leaking
modes into the output mode list on every resize.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-07-11 15:43:29 +00:00
Derek Foreman ee7971e2cd libweston: have one primary_plane per output
The primary_plane is currently shared amongst all outputs, and is the last
barrier to having overlapping outputs.

Split it up and make it per output instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-11 07:26:43 -05:00
Derek Foreman fe2b5db01e libweston: Track plane in paint node instead of view
Tracking the view's plane in the paint node in this way is a step towards
inflicting plane damage from paint node update during the output repaint,
instead of manually doing weston_view_damage_below().

We remove view->plane entirely and do all access through pnodes.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-11 07:26:43 -05:00
Derek Foreman f07af89f9c libweston: Move output damage subtraction out of backends
Right now every backend clears output damage from the primary plane when
it repaints. Instead of having this same operation spread across all
the backends, just do it in the core instead.

In the future, we want to remove damage tracking from the primary plane
entirely, and this is a small step in that direction.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-11 07:26:43 -05:00
Derek Foreman a9986ef984 libweston,backends: assert if z_order_list contains pnodes for wrong output
We've just made this impossible, so we can now clean up all the TODO
locations.

I've only turned some of them into assert()s, because they're all mostly
in the same place.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-11 07:26:23 -05:00
Philipp Zabel 90c11cf40e libweston: move weston_compositor_shutdown call out of backends
If we want to support multiple backends, the compositor must take care
to call this once, at the appropriate moment, so stop letting the
backends handle compositor shutdown themselves.

Move the weston_compositor_shutdown() calls from the backend::destroy
callbacks into weston_compositor_destroy() and the calls in the backend
creation error paths into weston_compositor_load_backend().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-27 12:09:47 +01:00
Philipp Zabel 6d699c3f54 libweston: add weston_backend::shutdown callback
Add a weston_backend::shutdown callback to split out the part of
weston_backend::destroy that needs to be done before compositor
shutdown.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-27 12:09:45 +01:00
Philipp Zabel 72e2da24f9 backend-vnc: render bypass support
If there is an opaque full-screen view with a compatible SHM client
buffer left after peeling off the client-side cursor view, bypass the
renderer and let Neat VNC read from the client buffer directly.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-20 09:21:14 +02:00
Philipp Zabel 8f18958cc5 backend-vnc: use weston_region_global_to_output
Instead of directly converting damage from pixman_region32_t in
global coordinates to pixman_region16_t in local coordinates,
use weston_region_global_to_output() to convert to pixman_region32_t
in local coordinates and then convert again to pixman_region16_t
in the same coordinate system, using vnc_region32_to_region16().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-19 21:36:17 +00:00
Derek Foreman e8208d21d7 libweston: Use weston_coord in struct weston_output
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:22 -05:00
Philipp Zabel 0d64d0ac5c backend-vnc: GL renderer support
Let the GL renderer render to FBOs and read the pixels into the Neat VNC
frame buffers. This allows to run the VNC backend with the GL renderer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 15:40:05 +00:00
Philipp Zabel f154fbba97 libweston: consolidate 'Using GL/Pixman renderer' log message
Consolidates the 'Using GL/Pixman renderer' message emitted by the
PipeWire, RDP, VNC, and X11 backends by moving the weston_log() into
weston_compositor_init_renderer(). Only print the message after
initializing the renderer has succeeded.

This effectively adds the message to the DRM, headless, and Wayland
backends.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-05-04 14:47:49 +02:00
Philipp Zabel 78818c6d24 backend-vnc: pass vnc_backend to vnc_head_create()
Pass the VNC backend to vnc_head_create().

That way the already known backend will not have to be found from the
compositor. This is trivial now, but in the multi-backend case would
entail iterating over all backends to find the correct one.

Also remove the now unused to_vnc_backend() helper.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-04-17 09:40:52 +02:00
Philipp Zabel 5dd796e447 backend-vnc: remove output move listener leftovers
The output move listener removal was incomplete. Remove the remaining
bits to fix a segfault on shutdown.

Fixes: 40f5eaf401 ("backend-vnc: use output power_state to disable repainting while disconnected")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-04-15 09:13:21 +02:00
Philipp Zabel 40f5eaf401 backend-vnc: use output power_state to disable repainting while disconnected
With weston_output_power_on/off() we can use power_state to disable
repainting completely while no VNC client is connected. This allows
to remove the initial repaint and per-output damage tracking.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-04-12 14:44:13 +03:00
Philipp Zabel 53ce09ecf8 backend-vnc: client side cursor support
Allow VNC clients that support the cursor pseudo encoding to render
the cursor themselves. This reduces observable latency of cursor
movement.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-03-22 11:58:34 +00:00
Philipp Zabel 12a7e4e163 backend-vnc: rename vnc_convert_damage to vnc_region_global_to_output
Align the function name and arguments of vnc_convert_damage() with
weston_region_global_to_output(). It does not support rotation and
stores the result in a pixman_region16_t, but otherwise it serves the
same purpose.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-28 08:45:48 +02:00
Philipp Zabel d245bbdd13 backend-vnc: fix initial repaint
weston_renderer::repaint_output must be called from the weston_output::repaint
callback. When called from the weston_output::enable callback, a black frame
is produced. Instead of painting an invalid buffer and then working around it
by setting output damage, just don't skip the first real repaint even though
no VNC client is connected yet.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Philipp Zabel b399d48dd4 backend-vnc: add debug scope to log damage regions
Add a debug scope "vnc-backend" and use it to log per-renderbuffer
accumulated damage and new repaint damage before repainting.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-24 13:52:40 +00:00
Philipp Zabel d18954ba10 backend-vnc: stop using pixman shadow buffer
Since neatvnc frame buffers are in system memory, using a shadow
buffer just causes an unnecessary copy in the pixman renderer.
Stop using the shadow buffer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Philipp Zabel e5445d836b backend-vnc: track damage on renderbuffers
Replace the custom damage tracking with tracking damage on the
renderbuffers.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Philipp Zabel ca8e0c9d16 backend-vnc: stop over-damaging nvnc_display
It is enough to report new repaint damage instead of accumulated
per-renderbuffer damage to nvnc_display_feed_buffer().

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-24 13:52:40 +00:00
Philipp Zabel fc8ce13747 backend-vnc: track damage on output while not repainting
While not repainting, all buffers are damaged exactly the same.
Avoid unnecessary work by tracking this damage separately on struct
vnc_output.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Derek Foreman 8031b9d57f backend: Make input notification functions use weston_coord
Push weston_coord into the notification functions instead of passing
two doubles.

The touch handlers are passed a pointer to a weston_coord, which is
unusual. This is done so we can pass a NULL pointer instead of a
fabricated invalid coordinate when the touch type is TOUCH_UP.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 4d0ce16669 libweston: replace weston_output_transform_coordinate
This creates a global coordinate from a device coordinate.

Replace it with weston_coord_global_from_output_point() which
does the same thing and returns a weston_coord_global.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Philipp Zabel 51ef88a7f4 backend-vnc: destroy renderbuffer before renderer output state
Reorder pixman renderer output state and renderbuffer removal to make
sure the pixman renderbuffer list is empty when the output state is
destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-02 10:58:14 +02:00
Stefan Agner 64dea007c6 backend-vnc: add meson subprojects support
Make use of meson subprojects support. Allow to optionally build the
libraries required for the VNC backend as subproject of Weston.

Signed-off-by: Stefan Agner <stefan@agner.ch>
[philipp.zabel@gmail.com: update neatvnc and aml versions]
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-31 09:43:41 +02:00
Philipp Zabel c67773bc5c pixman-renderer: use pixel_format_info instead of pixman_format_code_t
Use struct pixel_format_info pointers instead of pixman_format_code_t
values at the API surface for output and image creation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-28 12:59:16 +00:00
Philipp Zabel 14533cdd25 libweston: make weston_renderbuffer refcounted
Add weston_renderbuffer_ref/unref() functions and use them to
eventually destroy the weston_renderbuffer. Drop the explicit
renderbuffer_destroy vfunc from the pixman renderer interface.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-27 16:52:14 +01:00
Philipp Zabel 5a41911ff0 ci, backend-vnc: update to Neat VNC 0.6.0, aml 0.3.0
Neat VNC 0.6.0 supports querying client side cursor support.
It requires aml 0.3.0.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-23 22:12:38 +01:00
Philipp Zabel eb9a740c20 libweston: move pixman_renderer_init() into weston_compositor_init_renderer()
Stop calling pixman_renderer_init() from backends directly.
Call it via weston_compositor_init_renderer() instead.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-23 20:05:21 +00:00
Philipp Zabel 6757bae0f3 pixman-renderer: set renderbuffer via new repaint_output parameter
Add a struct weston_renderbuffer parameter to repaint_output and make
backends set the pixman image renderbuffer through this parameter
instead of using pixman_renderer_output_set_buffer()

Turn pixman_renderer_output_set_buffer() static.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-23 20:05:21 +00:00
Philipp Zabel 89e1831cd7 pixman-renderer: add weston_renderbuffer and create/destroy interface
Add a create_image_from_ptr vfunc to struct pixman_renderer_interface,
which wraps weston_renderbuffer creation for the pixman renderer via
pixman_image_create_bits(), as well as a renderbuffer_destroy vfunc
to dispose of the pixman image renderbuffer.
Also add create_image_no_clear using pixman_image_create_bits_no_clear()
instead.

Make the backends create and destroy their pixman image renderbuffers
through this interface.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-23 20:05:21 +00:00
Philipp Zabel 32c7629516 pixman-renderer: add pixman_renderer_interface
Add a struct pixman_renderer_interface with output_create and
output_destroy vfuncs and store a pointer to it in struct
weston_renderer.

Make all backends access the pixman_renderer_output_create/destroy
functions through this interface and turn them static.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-23 20:05:21 +00:00
Philipp Zabel c2d2525aaa backend-vnc: store backend on struct vnc_output
To avoid retrieving the backend from the compositor all the time, store
a pointer to the vnc backend on its vnc_output structures.

This will be useful once the compositor contains more than one backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-16 17:11:08 +01:00
Philipp Zabel 6f977640e6 libweston, backends: pass backend parameter to weston_backend functions
Passing the backend as a parameter to the weston_backend function
pointers seems more natural and will be very useful once there can be
more than one backend.

Since all backends already store a pointer to the compositor instance,
replace the compositor parameter with the backend in all functions.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-13 18:55:59 +01:00
Philipp Zabel 102acac6a9 backend-vnc: fix vnc_switch_mode
Fix the incorrect fb_pool stride set in vnc_switch_mode.
Also replace nvnc_fb_pool_unref/new with nvnc_fb_pool_resize.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-11 17:58:06 +01:00
Daniel Stone 54356be853 backend-vnc: Add renderer parameter to backend config
Add an explicit request to the backend config to choose the renderer.
Currently, only Pixman remains supported, with auto defaulting to that.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Philipp Zabel ce4cf2d060 backend-vnc: move accumulated damage with output
When the output is moved, move its per-framebuffer accumulated damage
with it. The alternative would be to track accumulated damage in the
local output coordinate system, but that would require translating back
into global coordinates for repaint_output.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-16 15:51:27 +02:00
Philipp Zabel 746a03068e libweston, backends: store backend pointer in struct weston_head
Compositor code can use opaque pointer comparison to determine whether
a head belongs to a given backend. Store a backend pointer in struct
weston_head to enable the compositor to select the correct backend
specific output configuration code.

This also allows to use the backend pointer instead of the opaque
backend_id pointer to check whether a head belongs to a backend, so
replace the checks in all to_xyz_head() functions and drop backend_id.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-12 15:21:16 +01:00
Philipp Zabel 1e901fa2b7 backend-vnc: drop unnecessary output release
No output is created at this point. Even if an output existed,
it should be relased when the head ist destroyed.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-12 13:55:20 +01:00
Philipp Zabel 635aa225c6 backend-vnc: set flags of current mode instead of template
vnc_ensure_matching_mode() does not transfer flags from init_mode.
Set flags on the returned mode instead.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-12 13:55:20 +01:00
Philipp Zabel 853eb7327f backend-vnc: set head properties in vnc_head_create
Set static monitor strings and physical size once, on head creation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-12 13:55:20 +01:00
Philipp Zabel 233e056b50 backend-vnc: allocate mode with xzalloc
Let xzalloc warn and abort when running out of memory.
With this, vnc_insert_new_mode() and vnc_ensure_matching_mode() can not
return NULL anymore. Remove the now unnecessary error handling.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-12 13:55:20 +01:00
Philipp Zabel 1e6e885e36 backend-vnc: allocate head with xzalloc
Let xzalloc warn and abort when running out of memory.
With this, vnc_head_create() doesn't need an error return value anymore.
Remove the now unnecessary error handling.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-12 13:55:20 +01:00
Philipp Zabel 2b3f5f7821 backend-vnc: allocate seat with xzalloc
Let xzalloc warn and abort when running out of memory and remove the
now unnecessary error handling.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-12 13:55:09 +01:00
Philipp Zabel 133417b016 backend-vnc: Add user authentication
Let VNC clients authenticate using the local username and password of
the user weston is running as. To avoid transmitting the password in
cleartext, make TLS security mandatory.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2022-11-23 16:58:48 +01:00
Philipp Zabel 1a027e63cb backend-vnc: enable TLS support
Add TLS key and certificate parameters to enable encryption support.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-11-23 11:04:19 +01:00
Philipp Zabel 2f0be4b4d0 backend-vnc: use configured keymap
Use the keymap rules/model/layout configured in the weston.ini [keyboard]
section.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-10-18 16:06:13 +02:00
Philipp Zabel 5cd87ff801 backend-vnc: implement direct key code handling
Allow clients that support the QEMU Extended Key Event Message to send
keycodes directly.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-10-18 16:06:13 +02:00