Commit Graph

63 Commits

Author SHA1 Message Date
Lukasz Czechowski 05e5405651 vnc: Allow neatvnc in version 0.8.0
Neat VNC 0.8.0 does not introduce any changes that breaks API used
by VNC backend, so it is safe to extend compatibility.

Signed-off-by: Lukasz Czechowski <lukasz.czechowski@thaumatec.com>
2024-06-07 12:57:54 +00:00
Derek Foreman 2abe4efcf7 libweston/backends: Move damage flush into backends
Currently we flush damage for the "primary plane" every repaint, but this
is folly.

The drm backend may skip rendering entirely if using an all-planes
composition. This could leave the renderer plane in a messy state if a
surface on an overlay plane disappears.

Instead, let the backends flush the primary plane damage when they know
they need to render.

Fixes #864

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-01-10 14:13:09 -06:00
Derek Foreman bbaba601c8 vnc: Fix cursor updates
Now that overlapping outputs are a thing, we have a problem with vnc
cursors.

The surface->damage used to update the vnc cursor might actually be
flushed by a previous output's repaint cycle, leading to a missing cursor
update to the vnc client.

Instead we should use the damage accumulated on the cursor plane to choose
when to update the cursor. This damage is in output coordinates, so let's
be lazy and just use the presence of damage as an indicator that the
cursor needs an update.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-11-10 09:38:35 -06:00
Derek Foreman 8b7597d40f vnc: Remove scanout plane optimization
This is a revert of 72e2da24

The VNC backend will place a single fullscreen surface on a virtual
scanout plane, and send the entire contents of this plane every repaint.

This saves a renderer pass, but moving the mouse over the fullscreen
client results in full screen damage for every mouse motion, similarly
client surfact damage is ignored and every repaint pushes the entire
window content down into Neat VNC.

Due to the way this is implemented, by pushing the scanout plane content
from assign_planes(), the primary plane could post damage and corrupt
the display.

Ideally we could fix this optimization to respect plane damage and do the
scanout plane push from the repaint callback, but since a release is
coming soon let's just strip it out for now.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-11-09 11:23:22 -06:00
Philipp Zabel d1df848d94 compositor, backend-vnc: Allow to disable output resizing
In some use cases the VNC client should not be allowed to resize the VNC
output. Add a boolean option "resizeable" in the VNC [output] section to
control this.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-10-05 11:43:12 +02:00
Philipp Zabel 690beab475 backend-vnc: Implement output resizing
Let VNC clients resize the VNC output.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-10-05 11:00:21 +02:00
Philipp Zabel 8895b15f3d ci, backend-vnc: update to Neat VNC 0.7.0
Neat VNC 0.7.0 supports desktop resizing.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-10-05 11:00:12 +02:00
Philipp Zabel c857042b45 backend-vnc: enable multi-backend support
Insert the backend into the weston_compositor::backend_list instead
of setting weston_compositor::backend. The compositor uses this to
determine whether the backend is capable of being loaded simultaneously
with other backends.

To stay backwards compatible, the VNC backend can be loaded as primary
backend. It also supports being loaded as secondary backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel 98cd2e9f97 backend-vnc: Use weston_output_finish_frame_from_timer()
Replace the finish frame handler logic with a call to the
weston_output_finish_frame_from_timer() helper function that
does the same.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Philipp Zabel 6fb3443ff4 backend-vnc: Use weston_output_arm_frame_timer()
Replace the finish frame timer arming logic with a call to the
weston_output_arm_frame_timer() helper function that does the same.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-27 12:37:09 +03:00
Philipp Zabel 5a95339d7a backend-vnc: make sure to finish frames with timestamps in the past
Round up the ms delay to make sure that the finish_frame_timer always
expires after the next frame_time. That way, finish_frame_handler()
never passes a timestamp in the future to weston_output_finish_frame().
Setting frame_time into the future risks hitting an assert in
weston_output_finish_frame(), when it is called from start_repaint_loop
within the frame interval.

Use CLIP() to simplify limiting the ms delay to a reasonable range.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-15 09:48:37 +03:00
Philipp Zabel 1d59530e4b libweston: Set the presentation clock in the compositor
Let backends declare the presentation clocks they can use with a
new bitfield weston_backend::supported_presentation_clocks and set
presentation clock after loading the backend in the compositor.

Make weston_compositor_set_presentation_clock() internal and replace
weston_compositor_set_presentation_clock_software() with an exported
weston_compositor_backends_loaded(), which is called by the compositor
after the backend is loaded.

In the future, this can be extended to determine the subset of clocks
supported by all backends.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-08-02 11:51:56 +03:00
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