Commit Graph

9672 Commits

Author SHA1 Message Date
Benjamin Herrenschmidt 89f3a8a71e Add support for FreeRDP 3.x
With this, Weston can build against either FreeRDP 3.x or 2.x depending
on what has been detected by meson (3.x takes priority).

The main source of changes is the settings are now opaque and require the
use of accessors. That was pretty mechanical and seems to work on 2.x as
well.

There are a few changes around constants getting a WINPR_ prefix, the UTF
conversion functions we used are obsolete, so use the proper "new" ones,
and other fairly minor things.

The key & cert management changed rather completely, libfreerdp won't load
files for us, we have to use the helpers to do so, and I *think* the RDP RSA
key and SSL key use the same setting location. Seems to work with SSL at
least.

There was also a minor glitch with keyboard input, KBD_FLAGS_DOWN is basically
never set. It appears to be an upstream FreeRDP change in 3.x, it was being
set incorrectly (always on any key down) while it should only be set on
repeats. However the fastpath input code has no way to set it from what I
can tell, so it's just loss. We instead ignore it.

Note that the screen size is odd (and different between freerdp client and
remmina), it also won't adjust dynamically when the window is resized. I
don't think this relates to my port though, I observe the same behaviour
with the packaged FreeRDP 2 based Weston, but I can try to look into it
later

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2024-08-14 12:29:28 +10:00
Marius Vlad e7ed5d201a weston.ini: Document the 'mirror-of' key
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad 75280d2e40 frontend: Disable client resize for RDP remote outputs
Similar to the VNC backend do the same for the RDP backed, as this would
allow to get a matching output, in dimensions, to the one we are
mirroring.

This also re-works a bit the no-clients-resize to be more inline with
VNC one.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad f43342cf78 frontend: Disable client resize for VNC remote outputs
As we're mirroring other outputs we shouldn't allow clients to resize
the output.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad 197c5e0084 frontend: Add support for tracking parent/mirror changes
If the DRM native output is changed propagate the changes
to the mirror as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad bd39f7edc1 frontend: Teach remote backends to use the scale from config
PipeWire/RDP/VNC were using by default scale 1, so allow
configuration using the ini config file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad d553333da8 frontend: Share a native output using 'mirror-of' keyword
This would allow to screen-share a particular output like the
following:

[output]
name=vnc
same-as=DP-5

[output]
name=rdp-0
same-as=DP-4

[output]
name=pipewire
same-as=eDP-1

Both 'vnc', 'pipewire' 'rdp-0' remote outputs would then be a
screen-share 'DP-5', respectively, 'e-DP1', or the 'DP-4' DRM output.

Currently, this is intended only for VNC, RDP and PipeWire remote outputs.

This patch exports weston_output_set_position(), and uses that for
overlapping a remote output with a native DRM one, rather than using
weston_output_move() as that has a side-effect when reflowing outputs
from shells.

Further more creating this remote output is driven entirely by compositor
signal events such that enabling an DRM native output would enable the
remote output, while disabling the native would have the same outcome
for the remote one.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad c4eb15d453 libweston: Keep a local copy of native_mode
This avoids dereferencing a possible stale pointer, and allows
retrieving the modeline/refresh later on when one needs to retrieve
those values. This is a temporary band-aid.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad 3842c1c737 frontend: Expand simple head function
In order to allow passing additional pre/post callbacks. This allows
further re-use of the simple_head_enable() function instead of
creating a similar dedicated function. We can then re-use the same
function for enabling remote outputs.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad 14cfb97949 libweston: Add a helper for retrieving backend type
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad d88782bf41 frontend/man: Use 'clone-of' instead of 'same-as'
Rather than using the same key entry for the DRM backend to cloned
outputs, rename to 'clone-of'. This means that ini configuration files
will break after this change, but this should be documented with the
next Weston release.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Loïc Molinari bb6abf3c33 gl-renderer: Clean up comments
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-08-12 10:44:55 +00:00
Loïc Molinari 0078a20f17 gl-renderer: Fix debug clear on shadow buffers
The shadow buffer must be blitted entirely when debug clear is on.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-08-12 10:44:55 +00:00
Loïc Molinari c65284bf9d gl-renderer: Fix debug clear region
The debug clear region must be generated out of the current render
buffer's damage region, not out of the current damage region, unless
shadow 16F is enabled.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-08-12 10:44:55 +00:00
Loïc Molinari 215d552ce1 gl-renderer: Don't use eglSetDamageRegion() on surfaceless outputs
eglSetDamageRegion() requires a postable surface and shouldn't be
called with EGL_NO_SURFACE.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-08-12 10:44:55 +00:00
Derek Foreman 003e529d46 compositor: Unmap views moved to layers outside of the scene graph
commit 5fe02dc68e partially resolved the issue in #937 by bringing back
the old band-aid solution for layer moves. However, since the events of
commit bf228370ff and following commits we have a problem with
subsurfaces leaving garbage behind when minimized - see #366 which was
probably fixed for a while then became broken again.

When we minimize a view that has subsurfaces, by moving it to a layer
outside of the scene graph, we need to be sure to handle the subsurface
views - which follow their parent's layer instead of having
weston_view_move_to_layer() explicitly called.

Do this by assuming layers with an empty link are not part of the scene
graph and unmapping views when they're moved to these layers. This will
recursively unmap the subsurface views.

We can now remove the band-aid paint node destroy, as the unmap process
will destroy paint nodes as appropriate.

Fixes 5fe02dc68e

Fixes #937

Fixes #366

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-08 08:08:10 -05:00
Derek Foreman 30fd16dae7 desktop-shell: check view mappedness in desktop_surface_removed
A "mapped" surface need not have a primary output assigned, or
be in a state such that it needs a fade out animation. The view
being mapped is what we should be testing here.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-08 08:02:09 -05:00
Michael Olbrich a7e8bd4bea subsurface: don't forget to repaint after the first sub-surface commit
For the following sequence, weston will not trigger a repaint:

1. create the main surface
2. create another surface and attach it as a sub-surface to the main surface
3. set the sub-surface to desync
4. attach a buffer to the main surface and commit it
5. attach a buffer to the sub-surface and commit it

Step 5 should cause the sub-surface to become mapped. However, Weston fails to
schedule a repaint in that case, so the sub-surface will not appear until
something else causes a repaint on that output, e.g. the main window.

And sub-surfaces are special when it comes to mapping because
weston_surface_is_mapped() will not return true until the parent surface is
mapped as well. So right now, weston_surface_map() may be called multiple times
and it will send the map_signal each time.

So to fix all this and make it clearer:

1. define a separate weston_surface_start_mapping() function to make it clearer
   that the (sub-)surface may not be fully mapped at the end
2. check surface->is_mapped explicitly to ensure that the sub-surface is only
   mapped once.
3. call weston_view_update_transform() for all views of the sub-surface when the
   parent surface is already mapped to ensure that a repaint for all relevant
   outputs is triggered.

The new test checks this by waiting for a frame event for the first subsurface
commit. Without these changes, the test will block until it is killed by the
timeout.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-08-07 15:10:49 +00:00
Joan Torres 1b793b7acd color: update color-management protocol to xx-v4
The main differences is the split of cm_surface functionality with
cm_surface and cm_feedback_surface.

There can only be one cm_surface to set, unset image descriptions. When
cm_surface is destroyed, the image description is automatically unset.

There can be multiple feedback_surfaces for one surface though.
Now the "preferred_changed" signal can be an initial event.

Creator params now have a new request: set_luminances.

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-08-07 13:36:49 +00:00
Derek Foreman 5fe02dc68e compositor: Destroy paint nodes in weston_view_move_to_layer()
Commit f2486c8b96 removed some helper functions for layer changes, but
the loop to delete stale paint nodes was elided.

We need to delete paint nodes on a layer change to ensure damage is tracked
properly.

Fixes f2486c8b96

Fixes #937

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-06 07:41:26 -05:00
Philipp Zabel 4b4cedfc66 backend-pipewire: add fence to synchronize on finish of render
If the PipeWire-backend renders to a DmaBuf, try to use a fence to synchronize
the submit of the next PipeWire buffer to the completion of the current render
process.

This ensures that the GPU rendering is finished before the buffer is passed to
PipeWire.

If fences are not available, the buffer is submitted without explicit
synchronization as before.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-08-05 09:09:51 +00:00
Leandro Ribeiro f271dd34b6 compositor: delete cms-static and cms-colord plugins
Plugins cms-static and cms-colord were deprecated with "compositor:
deprecate cms-static and cms-colord plugins", and the promise was that
we'd delete them if no one complained.

They were deprecated 2 years ago, and no one bothered. So it's about
time to delete them.

See https://gitlab.freedesktop.org/wayland/weston/-/issues/634.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-08-05 11:47:30 +03:00
Marius Vlad 6449ee9dae gitlab-ci: Use virtme-ng for running our tests
virtme-ng is the an update version of virtme, and this patch uses
that instead of the one we had partially modified.

Besides that this partially reverts ad039cdfd2, 'backend-drm: Enable
atomic async flip support' and makes our CI happier. Specifically
ad039cdfd2 updated our kernel version from 6.3 to 6.9 but did not do
a FDO bum,p and with that, no container images were rebuilt. Effectively
we were still using 6.3.

Now, with the FDO bump, in this patch, we noticed that the drm-writeback
test is failing with linux kernel version 6.9.

So far, only 6.3 and 6.4 kernel versions seems to be working, that is,
without that drm writeback test timing out. The safest bet for the
time being, would be to keep our CI just use 6.3 kernel, until we
have proper version to update to.

Signed-off-by: Daniel Stone <daniel.stone@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-02 20:06:25 +03:00
Marius Vlad e667a16752 tests/drm-*: Log drm-backend by default
This could be useful in investigating drm-* test hang-ups.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-02 20:03:41 +03:00
Loïc Molinari 2d8c1af8b7 gl-renderer: Add pixel storage modes section to best practices
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari fb4cccc290 gl-renderer: Assume default GL texture unit
Revert active unit to default value right after use so that other
functions can assume the default state. A best practices section is
added to the internal header for reference.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari b755345a46 gl-renderer: Assume fixed wireframe tex unit
The wireframe unit can only be used by the wireframe texture so
there's no need to bind it anymore before use.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari 69d4f66fab gl-renderer: Use fixed tex units
Provide a fixed allocation to each texture unit in order to prevent
conflicts. This fixes a conflict between colour transforms and the
wireframe debug mode.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari 16390dbae1 gl-renderer: Avoid GL_ as a prefix for constants
Avoid prefixing constants with GL_ as it could be confused with OpenGL
constants.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari 8a9fba9827 gl-renderer: Merge duplicated functions
Merge duplicated gl_renderer_attach_dmabuf() and
gl_renderer_attach_egl() functions into a single
gl_renderer_attach_buffer() one.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Robert Mader 9a754434f1 gl-renderer: Fix limited range quantization
The highest possible value is 255, not 256, like in previous part of the
calculation. While on it, use the values directly, making the code more
readable.

Fix suggested by Pekka Paalanen and Loïc Molinari.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2024-07-25 19:03:01 +02:00
Pekka Paalanen fa587e3fc0 backend-drm: get colorimetry mask from EDID
This is the mask that the sink claims to support. Default is always
supported.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-25 13:20:52 +00:00
Pekka Paalanen 77f72ce8f1 backend-drm: expose display_info
Update the field returned by weston_head_get_display_info(). This makes
EDID di_info available to frontends.

Since EDID data has changed, then head device_changed must be true as
well, because di_info may expose all EDID information and not just what
we track in the backend.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-25 13:20:52 +00:00
Pekka Paalanen 39b577e3a6 libweston: add weston_head_get_display_info()
This new public API is intended to deliver EDID etc. information to the
frontend. The use case here is display colorimetry, to help the frontend
craft output image descriptions (color profiles).

The frontend will need to link to and use libdisplay-info to make use of
this. This avoids having to replicate in libweston the high-level API
that libdisplay-info already has. The libdisplay-info API is also likely
to be extended, and it is not nice to play catch-up with it.

As a di_info can only be destroyed by calling into libdisplay-info,
libweston core can only ensure it has already been freed. There is not
enough reason to make libweston core depend on libdisplay-info, only the
DRM-backend is.

It will be up to DRM-backend to ensure display_info is updated and
device_changed is set only when necessary.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-25 13:20:52 +00:00
Pekka Paalanen 85593d2e4a backend-drm: get_eotf_mask() from di_info
Use libdisplay-info to parse the supported EOTF modes for the
sink/monitor. No more guessing.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-25 13:20:52 +00:00
Leandro Ribeiro f23e511ec7 backend-drm: init dhi in drm_head_info_from_edid()
Instead of initializing dhi in update_head_from_connector(), let
drm_head_info_from_edid() always init that, even when it fails to parse
EDID data.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-07-25 13:20:52 +00:00
Loïc Molinari 95c3f96870 gl-renderer: Assume default GL_UNPACK_* states
Revert pixel store's GL_UNPACK_* changes to default values right after
use so that other part of the code can assume the default state.

Fixes: #928

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 09:00:38 +00:00
Loïc Molinari 84d83f5bf8 gl-renderer: Assume default GL_PACK_ALIGNMENT state
Revert pixel store's GL_PACK_REVERSE_ROW_ORDER_ANGLE changes to default
value right after use so that other part of the code can assume the
default state.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 09:00:38 +00:00
Loïc Molinari 1a0e450da5 gl-renderer: Assume default GL_PACK_REVERSE_ROW_ORDER_ANGLE state
Revert pixel store's GL_PACK_REVERSE_ROW_ORDER_ANGLE changes to
default value right after use so that other part of the code can
assume the default state.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 09:00:38 +00:00
Loïc Molinari 4fab505b96 gl-renderer: Prepare for reset to default pixel storage states
Prepare gl_renderer_do_read_pixels() so that the default pixel storage
states can be more easily reverted to default before return.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 09:00:38 +00:00
Loïc Molinari db66a64aab rdp: Fix invalid free and memory leak on error
Peer context creation's error handling labels must be swapped to avoid
an invalid free when nsc context creation fails and a leak of the rfx
context when encode stream creation fails.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 08:54:45 +00:00
Ray Smith ee5b6bcc30 backend-drm: rename "virtual" to work with C++ compilers
"virtual" is a keyword in C++ so any C++ code including drm-internal.h
fails to compile.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2024-07-24 08:48:25 +00:00
Ray Smith 7b1520c4d9 helpers: don't override C++11's built-in static_assert
The #ifndef doesn't work with the built-in static_assert from C++11, so
it ends up getting redefined. It seems that there are other versions of
static_assert internally in some C++ standard library implementations
that have additional arguments, and these also get overwritten by the
two-argument version here.

Detect if we're using a suitably-recent version of C++ and avoid the
redefintion in that case.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2024-07-24 08:48:25 +00:00
Derek Foreman 302a1b143f rdp: Align nsc_compose_message content
This function in FreeRDP expects to be able to read groups of bytes, so
move the left edge of our damage region so the wide reads never read
outside of our framebuffer.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-24 08:41:36 +00:00
Derek Foreman 1fd99807ec renderers: Remove internal flush and attach
These were only necessary to allow surface_copy_content to return contents
that included recently attached (but not yet rendered) buffers.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-19 16:41:05 +00:00
Derek Foreman 0f8bd8dbc5 libweston: Don't change surface state in weston_surface_copy_content
Instead of attaching and flushing damage when performing
weston_surface_copy_content, just return the contents as the renderer
currently knows them.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-19 16:41:05 +00:00
Michael Tretter ae53d196db backend-pipewire: add DmaBuf allocation and import
The GL renderer allows the PipeWire backend to allocate DMABUFs that can be used
as renderbuffers and passed to PipeWire. This allows to avoid a copy of the
rendered output when using PipeWire.

PipeWire negotiates DmaBuf buffers using the SPA_FORMAT_VIDEO_modifier property.
Currently, the PipeWire-backend only announces and handles
DRM_FORMAT_MOD_LINEAR, which allows to share DmaBufs with consumers that have
modifier support for linear buffers. Consumers which could consume DmaBufs but
don't support modifiers (DRM_FORMAT_MOD_INVALID) are not supported. Moreover,
consumers that would benefit from other formats with modifiers, for example
tiled or compressed, aren't not supported, too.

Modifier negotiation can be added by extending the list of announced modifiers
and selecting and checking the proposed modifiers in param_changed.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter fa2f05219e backend-pipewire: add MemFd allocator
Instead of letting PipeWire allocate the buffers, allocate them in the PipeWire
backend. This allows the PipeWire backend to define the type of the allocated
buffers, which will ultimately allow to allocate buffers that can be rendered
to.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter 4304468a7e backend-pipewire: add helper function for building format params
Add a helper function for building the pod for the format.

This simplifies the creation of the EnumFormat params and to provide multiple
EnumFormats. Furthermore, it allows to optionally set add a Modifier to enable
DmaBuf negotiation.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter 073a97a9f5 backend-pipewire: skip rendering and free if there is no renderbuffer
The PipeWire backend is only able to render into renderbuffers and passing NULL
to the renderer is not valid. Don't try to use the renderbuffer if a buffer
without renderbuffer is dequeued from PipeWire.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00