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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>