Commit graph

10182 commits

Author SHA1 Message Date
Leandro Ribeiro
ed7ceef37e gl-renderer: do not set compositor capabilities on failure
When gl_renderer_display_create() fails, do not change the compositor
capabilities.

The compositor may not abort when that happens, it may simply decide to
fallback to another renderer. So setting anything on failure is wrong.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Leandro Ribeiro
c10857df5d gl-renderer: add function to query supported rendering formats
This goes through all formats available in the EGLConfig's that we
get from EGLDisplay and expose them in a struct weston_drm_format.

Currently backends choose a format for their outputs and hope that
GL-renderer is able to find a compatible EGLConfig. This should help
backends to avoid guessing.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Leandro Ribeiro
dd5e1f5047 libweston: rename get_supported_formats to get_supported_dmabuf_formats
Let's be more more specific and rename the renderer interface function
that returns the supported dma-buf formats. I.e. if we pass a dma-buf
with one of these formats for the renderer, it should be able to import
it.

Next we'll introduce a function to query the rendering formats from
the renderer, so this distinction is important.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Leandro Ribeiro
fba356e44d gl-renderer: log EGLConfig component type
Now that we also support EGLConfig with floating-point, let's log this
information.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Leandro Ribeiro
b5ed927960 gl-renderer: properly log EGLConfig vis id
To log vis id, we call:

eglGetConfigAttrib(egldpy, eglconfig, EGL_NATIVE_VISUAL_ID, &value)
p = pixel_format_get_info(value)

The problem is, EGL_NATIVE_VISUAL_ID represents a DRM format only on
GBM platform. So for other platforms we are calling
pixel_format_get_info() with values that are not DRM formats.

Avoid calling pixel_format_get_info() when the platform is different
from GBM, and log only the hex value in such case.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Leandro Ribeiro
0c986257f9 gl-renderer: change params of a few functions
No behavior change, just to make things easier for next commits. They
will need struct gl_renderer *gr in print_egl_config_info().

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Leandro Ribeiro
ec646f34d6 gl-renderer: add support to query EGL configs with float-point formats
Currently when we have a blend-to-output color transformation, we have a
16FP shadow buffer representing the blending space. Then we blit from
that to the primary plane fb, which is a regular buffer (fixed-point,
not 16bpc).

The shadow buffer needs to be 16FP because the blending space is linear
with relation to light. So it needs more bits for encoding.

In the next patches we enable the option to offload the blend-to-output
color transformation to KMS, so we'll need the primary plane fb to be
of a 16FP format. In order to do that, we need to be able to find EGL
configs with float-point formats. In this patch we enable that.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Leandro Ribeiro
3cad1c7716 libweston: remove set_gamma()
The plugins cms-static and cms-colord have been deprecated and removed
from our code. They were the only thing holding set_gamma() from being
removed. So remove set_gamma() from the code.

Users can have the same results tweaking the output color profile that
they use.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Derek Foreman
6b1b3d167d xwm: Add command line option to disable window decor
Our window decor uses cairo-xcb. cairo-xcb stores xcb_connection_t
internally and uses them as kind of a hash key for internal bookkeeping.
This needs to be torn down with a cairo_device_finish, when the last
cairo surface is destroyed, and we are not properly handling that.

Because of this weston bug, if the Xwayland server dies, is restarted,
and the weston X window manager gets the same xcb_connection_t pointer
value for a new connection that it had for a previous connection,
cairo-xcb will use stale state and crash.

Weston is used in some places (like Mesa CI) where Xwayland crashes are
more common than one might usually expect, and weston needs to be robust
against these failures. It's ok to have no window frames in xwl in these
cases, because nobody is interacting with the windows.

The '--no-xwm-decorations' command line option will now remove
cairo-xcb from use entirely, so this crash can no longer happen.

We should still fix the bugs in our cairo usage, but I think long term
it's still ok to have a way to disable this and reduce complexity.

Ref #1042

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-08-28 14:35:30 -05:00
Pablo Saavedra
98d4438265 screen-share: Guard pixman_image_unref call on shared_output_destroy
Prevent crashes during shared_output_destroy when cache_image is not
initialized.

Signed-off-by: Pablo Saavedra <psaavedra@igalia.com>
2025-08-28 11:17:33 +02:00
Robert Mader
092fe3f7ec tests/client-buffer: Sync dmabufs with DMA_BUF_IOCTL_SYNC
As required by the spec when accessing dmabufs from the CPU, see
https://docs.kernel.org/driver-api/dma-buf.html

While effectively a no-op on amd64, this fixes test failures on various
aarch64 devices, including:
 - rk3588 (Panfrost, Rock5)
 - rk3399 (Panfrost, PineBook Pro)
 - Broadcom BCM2712 (V3D, RPi5)
 - Qualcomm SDM845 (freedreno, OnePlus6)

Fixes: 303d88448 (tests: client-buffer: Add dmabuf support)
Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-08-25 12:10:10 +02:00
Jaeyoon Jung
e91252a943 desktop-shell: Add scale-fit background type
It is similar to scale-crop but fits to the output so that the image
does not get cropped.

Signed-off-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
2025-08-18 16:42:26 +09:00
Philipp Zabel
683eabb61e build: Allow libdisplay-info 0.3.0
There are no breaking changes for the high-level API that Weston uses.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2025-08-13 15:36:51 +02:00
Pekka Paalanen
ead6c5b319 frontend: use weston_enum_map for scroll method
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
72d2b14e6a frontend: use weston_enum_map for colorimetry modes
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
28808401b2 frontend: use weston_enum_map for EOTF modes
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
1c14c4ef70 frontend: use weston_enum_map for transforms
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
6d2ca22a6c frontend: remove trailing whitespace
My editor always does this, and then I had to manually discard that
change.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
868c25b591 frontend: use weston_enum_map for requires_outputs_modes
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
8694665f4f frontend: use weston_enum_map for renderers
Entrench the use of weston_enum_map more, even though in this case it
doesn't buy much.

Make the array 'static const' which it should have been already.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
0787422248 frontend: convert vrr_mode to enum map
Less open-coding is better?

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
03e7cdb43d shared: helpers for a generic enum map
Mapping between strings and enum values is open-coded in several places.
Introduce helpers here, and use them in the next patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Michael Olbrich
66cdb7d9bc backend-rdp: implement set_dpms
set_dpms() is used for sleep/wakeup. output_repaint_timer_handler() resets the
repaint_status if called while Weston is sleeping. If the timer is still active,
it will trigger a call to weston_output_finish_frame() which then triggers an
assertion, because the repaint_status is not REPAINT_AWAITING_COMPLETION.
Stop the timer and reset the repaint_status in this case to avoid this.

Schedule a repaint for WESTON_DPMS_ON to ensure that the current state is
rendered.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2025-08-04 14:56:26 +00:00
Michael Olbrich
2a7b4f52e7 backend-x11: implement set_dpms
set_dpms() is used for sleep/wakeup. output_repaint_timer_handler() resets the
repaint_status if called while Weston is sleeping. If the timer is still active,
it will trigger a call to weston_output_finish_frame() which then triggers an
assertion, because the repaint_status is not REPAINT_AWAITING_COMPLETION.
Stop the timer and reset the repaint_status in this case to avoid this.

Schedule a repaint for WESTON_DPMS_ON to ensure that the current state is
rendered.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2025-08-04 14:56:26 +00:00
Michael Olbrich
afc19c2e94 backend-vnc: implement set_dpms
set_dpms() is used for sleep/wakeup. output_repaint_timer_handler() resets the
repaint_status if called while Weston is sleeping. If the timer is still active,
it will trigger a call to weston_output_finish_frame() which then triggers an
assertion, because the repaint_status is not REPAINT_AWAITING_COMPLETION.
Stop the timer and reset the repaint_status in this case to avoid this.

Schedule a repaint for WESTON_DPMS_ON to ensure that the current state is
rendered.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2025-08-04 14:56:26 +00:00
Michael Olbrich
d076f2c519 backend-pipewire: implement set_dpms
set_dpms() is used for sleep/wakeup. output_repaint_timer_handler() resets the
repaint_status if called while Weston is sleeping. If the timer is still active,
it will trigger a call to weston_output_finish_frame() which then triggers an
assertion, because the repaint_status is not REPAINT_AWAITING_COMPLETION.
Stop the timer and reset the repaint_status in this case to avoid this.

Schedule a repaint for WESTON_DPMS_ON to ensure that the current state is
rendered.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2025-08-04 14:56:26 +00:00
Michael Olbrich
b5843ed366 backend-headless: implement set_dpms
set_dpms() is used for sleep/wakeup. output_repaint_timer_handler() resets the
repaint_status if called while Weston is sleeping. If the timer is still active,
it will trigger a call to weston_output_finish_frame() which then triggers an
assertion, because the repaint_status is not REPAINT_AWAITING_COMPLETION.
Stop the timer and reset the repaint_status in this case to avoid this.

Schedule a repaint for WESTON_DPMS_ON to ensure that the current state is
rendered.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2025-08-04 14:56:26 +00:00
Derek Foreman
5b37b09c8a xwm: Clean up windows so we don't crash when Xwayland crashes
If Xwayland crashes when we have windows lying around, we can get a
surface destroyed callback later that tries to log debug messages by
dereferencing a stale pointer to the defunct window manager to find the
log scope.

Let's finish this FIXME from 2012, and wipe out the windows.

Ref #1042

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-08-01 12:31:55 -05:00
Derek Foreman
f132462df7 compositor: Don't pass a time to weston_output_repaint()
Nothing does anything with this.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-08-01 15:08:00 +00:00
Septatrix
28bdcb46be frontend: Log when exiting due to insufficient active outputs
Signed-off-by: Septatrix <24257556+septatrix@users.noreply.github.com>
2025-08-01 14:58:19 +00:00
Leandro Ribeiro
3a1101be34 gitlab-ci: drop outdated comments related to virtme
Since "gitlab-ci: Use virtme-ng for running our tests" we no longer use
a hacky fork of virtme. Also, wee no longer use "--script-dir", as
virtme-ng properly supports "--script-sh".

So drop outdated comments.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-08-01 11:30:23 -03:00
Pekka Paalanen
72ed2c12d8 color-lcms: parametric to parametric transformations
This implements the basic color transformation from parametric to
parametric image description. The colorimetric rendering intents are
implemented. The perceptual and saturation rendering intents are
equivalent to media-relative + BPC rendering intent, subject to be
implemented better later.

Things missing:
- handling target color volumes
- perceptual dynamic range mapping

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 17:32:11 +03:00
Pekka Paalanen
8c2c429fd5 color-lcms: parametric blend-to-output
Implement blend-to-output transformation for parameteric output image
descriptions.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 13:14:34 +03:00
Pekka Paalanen
3737c9adb6 color-lcms: re-structure transformation creation
We will eventually have 6 different paths for creating color
transformations:
- input to blend, input to output
  - ICC to ICC
  - parametric to parametric
  - ICC to parametric
  - parametric to ICC
- blend to output
  - ICC
  - parametric

Set up their dispatching.

No changes to existing functionality.

xform_realize_chain() is now guaranteed to be called only with ICC
profiles.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 13:14:22 +03:00
Pekka Paalanen
3b3fa61c31 color: add Bradford matrix computation
This function is required for media-relative rendering intents.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 13:14:01 +03:00
Pekka Paalanen
b32f353003 color: add NPM computation
This function is required for producing color transformations from
parametric image descriptions.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 13:13:38 +03:00
Pekka Paalanen
37bee3050e color-lcms: override sRGB two-piece TF on input profile
https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/wayland_qa.md#q-should-srgb-content-be-decoded-with-the-piecewise-srgb-transfer-function

When anything claims to target a display with the sRGB two-piece
transfer function, override it with the power-2.2. That is how sRGB
displays actually work.

This patch includes a small refactoring in
cmlcms_color_transform_create().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 13:13:26 +03:00
Pekka Paalanen
3999d685bc color-lcms: call it a color transform recipe
I've been wanting a better name than search_param. In the future they
are not always search parameters when we have to replace the input
profile with another one for sRGB power-2.2 decoding purposes.

I think "recipe" describes this struct well: it's the list of
ingredients to cook a color transformation from.

This patch is purely renaming things.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 13:13:14 +03:00
Pekka Paalanen
67cfcaa0ac color-lcms: remove cmlcms_color_transform.status
This field is redundant, and therefore only confusing.

The success or not is returned from xform_realize_chain() directly. The
color processing steps vs. 3D LUT is recorded in
weston_color_transform.steps_valid.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 13:12:47 +03:00
Pekka Paalanen
15a9daad9a tests/color-icc-output: relax max error tolerances
Now that we are testing the more robust average error tolerance pretty
tightly, we can relax the tolerances on the maximum error which is more
flaky between GL drivers and hardware.

This makes sRGB->adobeRGB MAT test pass on radeonsi Polaris 11.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-24 11:30:07 +03:00
Pekka Paalanen
a5a2b3abb1 tests/color-icc-output: gate by average error as well
Maximum error is fragile: radeonsi on Polaris 11 has one error spike
that would force the the tolerances for everything to be much higher
than desired, and it masks changes to usual error levels.

Add a new condition to opaque_pixel_conversion: average two-norm error
statistic. The average is not as susceptible to outliers as maximum is.
We still keep the maximum error tolerance as well, to detect gross
outliers that might not sway the average enough to cause a test failure.

The new average error tolerances have been collected from the worst case
among the following + 0.01:
- GL renderer: Mesa Intel(R) HD Graphics 4600 (HSW GT2)
- GL renderer: AMD Radeon RX 550 Series (radeonsi, polaris11, ACO,
  DRM 3.61, 6.12.35+deb13-amd64)
- GL renderer: llvmpipe (LLVM 19.1.7, 256 bits)

(There is no need to separately print matrix vs. clut, it is already in
the fixture name.)

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-24 11:30:07 +03:00
Pekka Paalanen
b55a1d5bff tests/color-icc-output: remove outdated comment
Since around 9002667aa0 the power-law
curves have been implemented.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-24 11:30:07 +03:00
Pekka Paalanen
ef52b0adb4 tests/color-icc-output: re-layout my_setup_args
The concise table style was nice, but is getting more unwieldy as more
fields will be added. The new style won't fall apart.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-24 11:30:07 +03:00
Pekka Paalanen
d254ccdcc5 tests/color-icc-output: rename tolerance to max_tol
I will be adding yet another tolerance. This name disambiguates.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-24 11:30:07 +03:00
Derek Foreman
5a1e925759 wayland-backend: Remove unused cairo_device_t
The frame_device variable wasn't used in the commit that added it, and
later another commit that performed a bunch of clean-up bookkeeping added
cairo_device_destroy() for it. This was non-destructive because
cairo_device_destroy() handles NULL gracefully, but still Very Weird.

Remove it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-07-23 08:02:43 -05:00
Derek Foreman
a9958154a9 cairo-util: Remove dead code
Nothing calls this.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-07-23 07:59:36 -05:00
Erico Nunes
1939c732e8 gitlab-ci: Enable vulkan-renderer on debian lts jobs
With newer Vulkan-Headers built in the container, we may un-disable
vulkan-renderer in the debian lts jobs.
This also simplifies the CI script by removing a variant that existed
only for that purpose.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-07-21 12:09:54 +00:00
Erico Nunes
7bc103e5a1 gitlab-ci: Build Vulkan-Headers for CI
The version in Debian 11 (bullseye) is only slightly too old to build
vulkan-renderer.
We already build our own Mesa drivers to a newer version anyway, so it
should be possible to test vulkan-renderer in bullseye if it builds.
The actual Vulkan-Headers version here could actually be older and still
build, but was chosen to be same as in Debian 12 (bookworm) for now as
it is a tested version which has also been available for a while.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-07-21 12:09:54 +00:00
Leandro Ribeiro
3f81d2fd38 compositor: let backends handle output->disable_planes
On weston_output_repaint(), we have:

output_assign_planes(output);
...
output->repaint(output);

output_assign_planes() avoids calling output->assign_planes() when
output->disable_planes > 0. This brings a few complications to backends,
because they can't rely on the repaint loop starting from a certain
function: sometimes it starts from assign_planes(), others from
repaint().

Let's be more consistent: always call assign_planes() and let backends
handle output->disable_planes.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-07-18 17:58:45 +02:00
Leandro Ribeiro
3eed20254c backend-drm: add missing FAILURE_REASONS_FORCE_RENDERER
If we call drm_output_find_plane_for_view() with
DRM_OUTPUT_PROPOSE_STATE_RENDERER_AND_CURSOR for a view that is not a
cursor view, it should fail to get a plane.

In such case, set the failure reason to FAILURE_REASONS_FORCE_RENDERER.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-07-18 17:58:45 +02:00