For systems where udmabuf is not available.
Fixes: 75d75ac6c (tests: Add color-representation tests for DRM and GL)
Signed-off-by: Robert Mader <robert.mader@collabora.com>
The new color-representation-drm test occasionally crashes Mesa. Update
to the latest point release in case it helps.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Test the various combinations of:
1. Renderer backends - currently GL only.
2. Renderer modes - plane-offloading/vkms, shaders in Mesa, internal
shaders.
3. Buffer-types - SHM and DMABuf.
4. Coefficient/range combinations.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Using values from the color representation protocol. Only supported for
YCbCr formats in KMS drivers for now.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
`EGL_YUV_COLOR_SPACE_HINT_EXT` and `EGL_SAMPLE_RANGE_HINT_EXT` have
to be set at image import, which again happens on wl_buffer creation.
This is problematic because in Wayland (and Vulkan) those values are
surface attributes and thus only known once the buffer gets attached
to a particular surface.
We solve that by first importing the dmabuf with default values and,
when attaching a buffer to a surface, creating additional EGLImages
as needed.
Note that we ignore `EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT` and
`EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT` for now, which are neither
required by the Wayland color-representation protocol nor supported by
Mesa shaders (as of 25.3).
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Unlike EGL image import, texture creation and binding is quite fast and
cheap. Thus, instead of doing it as early as possible in various places,
do it right before we actually need it in prepare_textured_draw().
This will follow-up changes easier and includes some preparations for
them.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Add matrix-coefficients and range tracking to more gl-renderer structures
and get the relevant values from the color-representation implementation
instead of hard-coding them in the shader.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
For now limited to coefficients and ranges that are typically
supported by KMS drivers. We notably leave out alpha modes and
chroma locations for now.
The protocol initialization is guarded by the WESTON_CAP_COLOR_REP
backend capability and thus not enabled anywhere yet.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Doesn't yet deal with work area (monitor area excluding panels etc), or
reconstraining while moving, but it's a start.
It's more or less based on the mutter implementation. While the mutter
implementation is GPL, it was authored by me, thus grant permission to
relicense to MIT.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Add a simple client that queues up a few future frames and logs how
accurately the requested presentation times were hit.
This used simple-shm as a skeleton, and those copyrights have been retained.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Introduce support for the commit-timing protocol to allow applications
to attach a presentation time to a content update.
We use the repaint timer to schedule content updates in advance of
the frame time when they should be displayed.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Currently this shouldn't result in any change, since the times we pass in
are real presentation times.
Later when commit-timing lets applications pass in arbitrary times, it
will be more interesting.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Validate repaint_msec so it's not longer than a refresh interval.
Negative repaint windows will cause problems for frame scheduling in the
future, so remove them.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When we add timed transactions, we'll want to feed them through the repaint
timer, so share it to allow this in the future.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Add a listener and a roundtrip so test clients using presentation have
access to the presentation clock id.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In the near future commit-timing + VRR combined will want to have better
than the 1ms precision we're allowed now.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
After moving the drm-backend's scene graph dump, it now always occurs when
repaint_status is REPAINT_AWAITING_COMPLETION, which loses useful timing
information we used to have.
Add timing information for the REPAINT_AWAITING_COMPLETION state, and also
add the expected presentation time.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When we need to use VRR, we'll miss a potential frame deadline, fail to
deliver a frame, then stop the repaint loop. When a late frame comes
in, we deliver it immediately at the start of a new repaint loop.
The only time we really need to deliver a frame immediately is at
the start of the loop, otherwise we can use the same repaint window
behaviour as any other time.
This still leaves some room for improvement, as we still don't try
to avoid Vactive.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Move some code around so we only derive the next repaint from the next
presentation time and the repaint window once at the end of the function.
In many cases we now subtract the repaint_msec value from "now", but that's
ok because any time earlier than "now" will still result in firing the timer
at the same time.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
These are used to determine if the previous frame was displayed with
tearing, which is useful in determining when the next frame time should
be.
Store these as a step towards breaking the frame time calculations out
of output_finish_frame into a separate function.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
For the upcoming commit-timing protocol, we're interested in when a
scheduled repaint will be displayed, so let's keep track of both the
repaint time and the anticipated presentation time.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
At first we always used this workaround, and then we stopped using it when
VRR was in use.
Turns out it also hurts presentation times when starting the repaint loop,
which makes the commit-timing protocol difficult to implement.
Completely avoid the workaround on any kernel newer than 4.12, based on a
capability check for DRM_CAP_CRTC_IN_VBLANK_EVENT, and log a warning at
startup.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This fixes a bug in version 1 where we should've been giving a 0 refresh
for VRR, and introduces version 2 where we're allowed to give a compositor
chosen rate for VRR.
We currently chose the mode's native refresh rate.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
GCC 14.2 with debugoptimized build complained:
In file included from ../../git/weston/tests/weston-test-assert.h:32,
from ../../git/weston/tests/string-test.c:36:
In function ‘strtof_conversions’,
inlined from ‘wrapstrtof_conversions’ at ../../git/weston/tests/string-test.c:92:1:
../../git/weston/shared/weston-assert.h:60:12: error: ‘val’ may be used uninitialized [-Werror=maybe-uninitialized]
60 | if (!cond) \
| ^
../../git/weston/tests/weston-test-assert.h:153:34: note: in expansion of macro ‘weston_assert_’
153 | #define test_assert_f32_eq(a, b) weston_assert_(NULL, a, b, float, "%.10g", ==)
| ^~~~~~~~~~~~~~
../../git/weston/tests/string-test.c:97:9: note: in expansion of macro ‘test_assert_f32_eq’
97 | test_assert_f32_eq(val, 0.0);
| ^~~~~~~~~~~~~~~~~~
../../git/weston/tests/string-test.c: In function ‘wrapstrtof_conversions’:
../../git/weston/tests/string-test.c:94:15: note: ‘val’ was declared here
94 | float val;
| ^~~
The debug build did not complain.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
GCC 14.2 with debugoptimized build complained:
../../git/weston/tests/paint-node-test.c: In function ‘get_paint_node_status’:
../../git/weston/tests/paint-node-test.c:105:16: error: ‘changes’ may be used uninitialized [-Werror=maybe-uninitialized]
105 | return changes;
| ^~~~~~~
../../git/weston/tests/paint-node-test.c:87:39: note: ‘changes’ was declared here
87 | enum weston_paint_node_status changes;
| ^~~~~~~
The debug build did not complain.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
GCC 14.2 with debugoptimized build complained:
../../git/weston/tests/fifo-test.c: In function ‘get_surface_width’:
../../git/weston/tests/fifo-test.c:493:16: error: ‘width’ may be used uninitialized [-Werror=maybe-uninitialized]
493 | return width;
| ^~~~~
../../git/weston/tests/fifo-test.c:477:13: note: ‘width’ was declared here
477 | int width;
| ^~~~~
The debug build did not complain.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
GCC 14.2 with debugoptimized build complained:
../../git/weston/tests/client-buffer-test.c: In function ‘y_u_v_create_buffer’:
../../git/weston/tests/client-buffer-test.c:1045:33: error: ‘u_row’ may be used uninitialized [-Werror=maybe-uninitialized]
1045 | x8r8g8b8_to_ycbcr8_bt709(argb, y_row + x,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1046 | u_row + x / pixel_format_hsub(buf->fmt, 1),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1047 | v_row + x / pixel_format_hsub(buf->fmt, 1));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../git/weston/tests/client-buffer-test.c:986:18: note: ‘u_row’ was declared here
986 | uint8_t *u_row;
| ^~~~~
../../git/weston/tests/client-buffer-test.c:1045:33: error: ‘v_row’ may be used uninitialized [-Werror=maybe-uninitialized]
1045 | x8r8g8b8_to_ycbcr8_bt709(argb, y_row + x,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1046 | u_row + x / pixel_format_hsub(buf->fmt, 1),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1047 | v_row + x / pixel_format_hsub(buf->fmt, 1));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../git/weston/tests/client-buffer-test.c:987:18: note: ‘v_row’ was declared here
987 | uint8_t *v_row;
| ^~~~~
The debug build did not complain.
Even though only u_row and v_row were reported, I don't understand why
there is no warning about u_base and v_base, as they are initialized
with a similar switch. So initialize them too, just in case.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
GCC 14.2 with debugoptimized build complained:
../../git/weston/libweston/input.c: In function ‘weston_pointer_set_focus’:
../../git/weston/libweston/input.c:1988:29: error: ‘sx’ may be used uninitialized [-Werror=maybe-uninitialized]
1988 | pointer->sx = sx;
| ~~~~~~~~~~~~^~~~
../../git/weston/libweston/input.c:1913:20: note: ‘sx’ was declared here
1913 | wl_fixed_t sx, sy;
| ^~
../../git/weston/libweston/input.c:1989:29: error: ‘sy’ may be used uninitialized [-Werror=maybe-uninitialized]
1989 | pointer->sy = sy;
| ~~~~~~~~~~~~^~~~
../../git/weston/libweston/input.c:1913:24: note: ‘sy’ was declared here
1913 | wl_fixed_t sx, sy;
| ^~
Initialize with an arbitrary value to avoid the warning. This value
should never make it outside of this function.
The debug build did not complain.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
../../git/weston/doc/sphinx/meson.build:97: WARNING:
Project targets '>= 0.63.0' but uses feature deprecated since '0.60.0':
install_subdir with empty directory. It worked by accident and is buggy.
Use install_emptydir instead.
I get the above warning on a clean build, because the directory in
question is empty at configure time. It gets populated at compile time.
Having to exclude one file from the build complicated fixing this.
custom_target() does not support install-excludes, and it looks like
Sphinx does not allow locating the buildfile elsewhere. One option would
be to use a meson.add_install_script() to delete the unwanted file after
it has been installed, but this seemed more complicated than the
solution I chose.
The intermediate build directory name needs to change from 'doc' to
'weston', so that I don't need to strip_directory which custom_target
does not support. The 'output' array in custom_target() also does not
allow outputs to be speficied in sub-directories.
The sh script is tidied up a little bit with set -e, otherwise it would
have become unreadable.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The initial step from gcov/lcov gives a few parsing errors like
'mismatched end line' or 'mismatched exception tag for'.
Been trying with llvm-cov, downgrading to gcc-13 and using different
gcov versions including one from oldoldstable -- I'm repeatably getting
these errors.
I turned instead of the idea to use our previous stable version, now the
oldstable/LTS as that was capable of doing code coverage. So possibly
either gcc-13 is the first version that causes these issues but we're
having gcc-14 in Trixie so it doesn't really matter. For now use this
work-around until we have something better.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This includes a few changes, but given that we still want to bisect
things when they break I'm pulling some of the changes into a bigger change.
Here's a list of most noticeable that I had to address in order to make
this switch:
- added a PACKAGES_SPECIFIC env variable to able to pass different
packages to each version. Some packages basically changed their names
and need to pass a different name
- added USE_DEBIAN_BACKPORTS and use it when adding -backport apt
sources for each Debian version
- llvm-19 now requires some additional packages for trixie
- add imghdr for sphinx for trixie
- had to keep use_tls=0 and modified the notes to point now to Trixie
instead of Bookworm
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
If we don't clamp the input before updating the pointer surface coords,
we'll trigger the "surface jumped beneath us" logic later when the clamp
really happens. That leads to spurious pointer leave/enter events.
Add clamping to weston_pointer_send_motion() to fix this.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Pull the clamping out and expose an internal pre-clamped function, which
will be used elsewhere in a later commit.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
when the hint_is_pending is true, it should assign the hint_pending to the hint and set the hint_is_pending to false, but the hint_is_pending set to true again after setting to false.
remove the redundant line to fix this.
Signed-off-by: Vorlune Zhang <Vorlune.Zhang@gmail.com>
While exiting, on the shutdown compositor path, for instance if we don't have
permission access to create a lock file we will end up reporting some memory
leaks/use-after-free.
This patch addresses of all them:
- api->listen returns NULL and we do not property free wet_xwayland
struct
- we don't remove the signal handler causing a use-after-free (signal
handler gets called by the main object has been freed)
- we don't remove/destroy the debug scope causing a mem-leak
- on the same path check for valid event source to avoid deref invalid
pointers.
Add a simple wrapper which we can call in other call sites.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
If we're in a steady state, doing nothing but flipping buffers, we can
try to avoid going through our full routine of brute-forcing an
acceptable plane state, by instead just reusing the old state and
changing only the FB it refers to.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Keeping track of what mode we prepared the state in will be useful
for printing debug information later, when we have a way to reuse
old state.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We're going to add a way to reuse state, but we don't currently have a way
to represent invalid state - such as before we've ever commit any state
at all.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
These have the same form, and we're about to add a few more with the same
form again, so make a helper function.
This sweeps up the one weird one that printed [view] while failing [state].
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This will be handy later when trying to determine when it's ok to reuse
output state, as changing this would invalidate previous state.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
On some aarch64 platforms with GCC13 we're seeing:
../../../weston-14-new/libweston/backend-drm/fb.c:152:15: warning: 'bo_fd' may be used uninitialized [-Wmaybe-uninitialized]
152 | ret = drmPrimeFDToHandle(fb->fd, bo_fd, &handle);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../weston-14-new/libweston/backend-drm/fb.c: In function 'drm_fb_addfb':
../../../weston-14-new/libweston/backend-drm/fb.c:117:13: note: 'bo_fd' was declared here
117 | int bo_fd;
Just initialize it to avoid trigger the warning.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Recent versions of libwayland support absolute paths in display names,
and in that case do not require XDG_RUNTIME_DIR to be set. It's
therefore overly strict for Weston to exit due to XDG_RUNTIME_DIR being
unset when it would work perfectly fine without it. The messages
displayed for incorrectly set XDG_RUNTIME_DIR are useful though, so keep
them around, but only display them if wl_display_add_socket() fails
i.e. the lack of XDG_RUNTIME_DIR has actually caused a problem.
Signed-off-by: Alyssa Ross <hi@alyssa.is>
It looks like FALSE is only used in a few files in Weston, whereas false is much
more commonly used. Presumably FALSE comes from some library not included in
the headless backend (at least in my case).
FAILED: [code=1] libweston/backend-headless/headless-backend.so.p/headless.c.o
gcc -Ilibweston/backend-headless/headless-backend.so.p -Ilibweston/backend-headless -I../../home/qyliss/src/weston/libweston/backend-headless -I. -I../../home/qyliss/src/weston -Iinclude -I../../home/qyliss/src/weston/include -Ilibweston -I../../home/qyliss/src/weston/libweston -Iprotocol -I/nix/store/mvhj7fm6bkmz6ismdp8vcmwn34w94b8n-libglvnd-1.7.0-dev/include -I/nix/store/v7jn3cy1wjaf9pm60ix9y6dfma0bj4a3-wayland-1.24.0-dev/include -I/nix/store/xi04j07bl6bbckky5n8a1k06spxxfg9i-pixman-0.46.4/include/pixman-1 -I/nix/store/xvzhnfwxvl480qpjxm83wwhd287b3lgm-libxkbcommon-1.11.0-dev/include -I/nix/store/22qgb8p593613861117ay4gzmf9b7rns-libdrm-2.4.125-dev/include -I/nix/store/22qgb8p593613861117ay4gzmf9b7rns-libdrm-2.4.125-dev/include/libdrm -I/nix/store/zl58kqaf677skihj840rf05svsmrhmmc-cairo-1.18.4-dev/include/cairo -I/nix/store/6sscd9xxffhjrci2xbw9yv8inc2rc0ry-freetype-2.13.3-dev/include/freetype2 -I/nix/store/6sscd9xxffhjrci2xbw9yv8inc2rc0ry-freetype-2.13.3-dev/include -I/nix/store/z88mxig65mxgyn1yxsz92m4w1rn51aci-libpng-apng-1.6.50-dev/include/libpng16 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -O0 -g -Wmissing-prototypes -Wno-unused-parameter -Wno-shift-negative-value -Wno-missing-field-initializers -Wno-pedantic -Wundef -fvisibility=hidden -Wmissing-prototypes -Wno-unused-parameter -Wno-shift-negative-value -Wno-missing-field-initializers -Wno-pedantic -Wundef -fvisibility=hidden -fPIC -MD -MQ libweston/backend-headless/headless-backend.so.p/headless.c.o -MF libweston/backend-headless/headless-backend.so.p/headless.c.o.d -o libweston/backend-headless/headless-backend.so.p/headless.c.o -c ../../home/qyliss/src/weston/libweston/backend-headless/headless.c
../../home/qyliss/src/weston/libweston/backend-headless/headless.c: In function ‘config_init_to_defaults’:
../../home/qyliss/src/weston/libweston/backend-headless/headless.c:788:29: error: ‘FALSE’ undeclared (first use in this function)
788 | config->fake_seat = FALSE;
| ^~~~~
../../home/qyliss/src/weston/libweston/backend-headless/headless.c:788:29: note: each undeclared identifier is reported only once for each function it appears in
Fixes: 0126a5b4 ("backend-headless: Add an option to enable a fake seat")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
The helpful error message with the hint to set -Dbackend-vnc=false was
unreachable, because libpam would either be found, or the default, less
helpful error message for a missing library would be shown.
Signed-off-by: Alyssa Ross <hi@alyssa.is>
When running headless, weston will not expose a wl_seat.
This was removed with commit a1046adc ("compositor-headless: do not
create a seat").
However, some applications, namely GTK3 based, will log a warning when
there is no wl_seat:
| gdk_seat_get_keyboard assertion GDK_IS_SEAT(seat) failed
While this is arguably a bug in GTK3 which should not complain with a
legit setup, that breaks the CI of those projects when using Weston,
while most of the other Wayland compositors will create a fake seat when
running headless, making weston the odd ball there.
This changes adds a new option "--fake-seat" that will instruct weston
to create a seat when running headless. The default remains not to
create a seat though, so backward compatibility is preserved.
This partially reverts commit a1046adc66.
See-also: https://gitlab.freedesktop.org/ofourdan/xwayland-run/-/issues/12
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Add support for the fifo protocol, which allows an application to submit
a content update that can only be applied after the previous content
update has been active for a display refresh.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that we have surface-state application streamlined, it's fairly easy to
add a framework for deferring content updates.
This will be used soon for fifo and commit timing. For now, the
weston_surface_state_ready() call that makes any of this do something
will always return true.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If a surface isn't visible, there's no point in performing a repaint when
its state changes. However, we don't know if a surface is visible until
we perform the scene graph updates at repaint.
Use our new visibility tracking API to check whether we need to perform
a repaint, or if we can just skip it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Keep track of whether a view has any unoccluded pixels on an output,
use this information to add a weston_surface_visibility_mask() function
that we'll use later.
Since the visibility information is calculated at repaint, and invalidated
by some (but not all) state updates, we'll keep track of when the previous
repaint's status is still valid by watching surface status bits.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Seems like it makes sense to have it there, and this cleans up a bunch of
paths where we return status bits so a caller can do this.
We can also drop the explicit setting of view_list_needs_rebuild, as it's
going to happen automatically when applying subsurface order.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In the future more than one test group will want to use presentation
feedback, so let's pull the basics into weston-test-client-helper
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We open code this in several tests. Move a single implementation to
weston-test-client-helper instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Latch is the moment when the compositor considers updates for an upcoming
redraw. Nothing that takes place after an output latches for repaint can
change what will be repainted.
This needs a more explicit treatment now that upcoming transactional
protocols require things to happen immediately after the latch (ie:
when it's too late to change the upcoming render).
Add an explicit latch point, a signal to tap for testing, and some asserts
to make sure nothing can violate the inevitability of the current render
state.
Note that currently latch is tied to repaint such that we only claim to
have latched when a repaint will happen. In a future commit this will lead
to forcing the repaint loop to fire without damage when the fifo protocol
needs something to happen after a latch. This could be an area for
future improvement.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We're going to be adding protocols (commit-timing, fifo, syncobj) that
allow deferred surface content updates.
It makes sense to start the perfetto flow ids from the surface state so
we can track a flow from creation (ie:commit) to presentation.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This was discussed in wayland-protocols MR 273, and clarified in wayland
MR 379 - presentation feedback applies to content updates, not buffers.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This ensures (an unlikely) cases where get_label might be called and the
callback itself would makes use committted_private to retrieve callback
data. Just make sure to set it prior.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Originally the test-asserts were abort()'ing. Then they were changed to
record the failure but not abort() anymore. These loops were missed,
accidentally turning them into endless loops on Wayland connection
failure, e.g. a protocol error.
When then loops become endless, they will repeatedly print the assertion
failure message. When run as part of the test suite via Meson, Meson
will collect all printouts in memory. Therefore the meson process will
use memory rapidly without bounds.
Break all these loops.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
With the future bump to Trixie we have a few more leaks outside of the
Weston test suite. Add them to leak suppresion file.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
To accommodate some future CI bump to Trixie (doxygen/breathe issue)
move out the anonymous enum out of weston_output object.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Implement media white point scaling according to ICC.1:2022 (profile
v4.4), section 6.3.2.2 "Translation between media-relative colorimetric
data and ICC-absolute colorimetric data".
This is a lot of code for something that, under the current
circumstances, is a no-change. However, realizing that chromatic
adaptation and media white point scaling are two separate adjustments
was a revelation to me. I want to document in code how they work, even
if the net result is no-op.
The PCS white point is taken from ICC, it does not matter what non-zero
point it is, the result will be the same.
I did skip a bit the media white point scaling. One should first scale
from in to PCS, and then from PCS to out. The code is mathematically
equivalent. If some new operation needs to be done in between, this step
than be split in two, just like I split the chromatic adaptation step in
two in this patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
According to ICC, chromatic adaptation applies also to ICC-absolute
colorimetric rendering intent.
ICC-absolute and media-relative colorimetric rendering intents are
indeed identical as long as medium white point equals adapted white
point.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is the correct name for what is implemented.
The term "white point adaptation" cannot be found in ICC.1:2022 (v4.4)
nor at https://cie.co.at/e-ilv .
Personally I am confused whether it would mean chromatic adaptation or
media white point scaling.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
With the addition of the weston_output_set_ready() call, the shell fade
animation is now started during the very first repaint. The first repaint
doesn't have an accurate frame_time for the previous repaint, as none has
occurred yet.
Since we set the time base for an animation based on the output's frame
time the second time the animation is run, we end up setting the shell fade
start time to 0, and the first real repaint advances the timer to the real
time, generating a warning and truncating the animation.
Instead of tracking the number of animation frames, let's just continue to
reset the time base until we finally get a non-zero time.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
A destroyed paint node must be rebuilt at great cost the next time the
view is displayed on an output.
Keep the paint node around and just remove it from the z order list instead
of destroying it outright.
fixes#1072
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
As weston_compositor_build_view_list() marks all the outputs needing a
paint node rebuild of the re-order list, embed the paint node status
update to ALL_DRITY into straight into weston_output_build_z_order_list().
This way we'll latch it on the view list rebuild.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This de-couples the compositor view build list from the paint node
ordered list to allow a more finer grain over what lists we need to
rebuild upon repaints.
As a consequence to that this avoids a trip over from the compositor
when paint nodes are destroyed and no longer re-created upon rebuilding
the view list.
Fixes: #1070
Fixes: abfe874a ("core: Don't rebuild view list on surface-local changes")
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
And implicitly remove the need to build autoconf and libx11. Removed wget
and xutils-dev as those are not needed anymore.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
The following config allows to mirror the LVDS output to VNC:
|[output]
|name=LVDS-1
|transform=rotate-270
|
|[output]
|name=vnc
|mirror-of=LVDS-1
However, the current code only takes the scale into account, not the
relative transformation. In case of rotate 90 or 270 the width and height
have to be swapped. Add it.
Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1076
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
This was brought up in issue 1063. The assertion in
weston_presentation_feedback_present_list() will trigger randomly during
repeated suspend/resume testing, presumably while a client is animating
and asking for presentation feedback.
drm_output_start_repaint_loop() has a path where drmWaitVBlank() is able
to pull a good timestamp for the last vblank. This results in a call to
weston_output_finish_frame() with a good timestamp and
WP_PRESENTATION_FEEDBACK_INVALID in the flags.
Previously it was assumed that in such case the presentation feedback
list cannot have any entries. This assumption is false. It is possible
that while the output is in idle state, a client will post an update to
a surface and ask for presentation feedback on it. This should trigger
drm_output_start_repaint_loop() with a non-empty feedback list.
It is unclear why this problem was not seen in the wild much more often.
Start-repaint-loop does not present anything by definition, it only acts
to synchronize the output repaint loop with the (hardware) scanout
cycle. Therefore no feedback must be sent there. As
WP_PRESENTATION_FEEDBACK_INVALID flag indicates no feedback must be
sent, use it to avoid calling
weston_presentation_feedback_present_list().
References: https://gitlab.freedesktop.org/wayland/weston/-/issues/1063
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This needs to extend the VkMemoryRequirements2 struct, not
VkImageMemoryRequirementsInfo2.
Fixes: ad0f4cf9 ("vulkan-renderer: make dmabuf import dedicated allocation optional")
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
If the Wayland connection died, this code path ended up in an endless
loop, because test-asserts do not abort. Break out to fix this. The
test-assert records the failure, so not need to do more.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Deprecate the screenshooter recording mode, with the intention of
removing it in libweston 16. Using the PipeWire backend (or similar) is
a far better and more flexible way of capturing output content.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The DRM backend has had a VA-API recorder for a while, which pushes the
frames from every redraw into libva for compositor-side recording.
Implementing this manually in the compositor, and configuring it, is
kind of pain. We now have the PipeWire backend which can do
screencasting in a much more flexible way without having to push
everything into the compositor itself, and without having to hardcode
support for one particular encoder framework.
Deprecate this module with the intention of removing it in the Weston 16
cycle, along with screenshare (for similar reasons).
Signed-off-by: Daniel Stone <daniels@collabora.com>
Add a debug binding and mode to highlight (green tint) what has
been rendered through vulkan-renderer composition. This is useful
to visually identify/debug clients which have been offloaded to
DRM planes, since those won't go through the renderer composition
process and therefore won't be highlighted the same way.
Since this is the first debug mode in vulkan-renderer, add some
initial infrastructure to handle debug bindings.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
The VkSpecializationMapEntry use was incorrect here, it requires the
struct offset to be in the second entry.
Fixes: 8f56d03d ("libweston: Vulkan renderer")
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
This is basically a revert of 6f94022e ("ivi-shell/layout: Create a
temporary background curtain") to remove the blank/blank
curtain in ivi-shell and use the weston_output_set_ready to notify the
compositor that it is start issueing repaints.
Introduces a new callback in ivi-layout which controllers can call on
their own.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This reverts commit 0ff5ac0f7b.
Now that we have a way to prevent repaints of empty scene graphs from
the shells, remove the curtains and just have our first paint be
proper content.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We've added a curtain to the shells so at startup we have something to
render, but this causes a flicker if someone is trying to have a seamless
transition from boot to weston.
Add a ready flag that allows the shell to indicate repaints are safe, so
we can remove the curtains and have no wasted frames at startup.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Similarly to simple-egl, teach simple-shm to also do that if pressing
F11. Allows testing stuff much easier -- without installing key-bindings
in the shell.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This already existed for surface, so it is trivial to add.
This will let the upcoming plane state reuse code notice a format change.
This is handy because a client might respond to dmabuf feedback by changing
formats, with the expectation that doing so would land content on a plane.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This was in the late update because attaching buffers is something only
the renderer cares about.
However, the upcoming drm plane state re-use patches need to know if the
buffer changed before assign_planes, so we need this in the early update.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The assert added in 78657c5ff3 will cause
problems when we try to reuse cached drm plane layouts in the future -
instead of asserting on an exact gbm fb, assert that the the fb type
corresponds has the cursor type instead.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Although Vulkan's renderbuffers are dmabufs, the difference between a
client dmabuf and a backend-allocated dmabuf is a very meaningful one.
Add a separate buffer type for BUFFER_DMABUF_BACKEND instead of
overloading BUFFER_DMABUF for this.
This tangentially allows the Vulkan renderer to do direct scanout of
client buffers in mixed mode.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The DRM documentation states:
> Unless explicitly specified (via CRTC property or otherwise), the active
> area of a CRTC will be black by default. This means portions of the active
> area which are not covered by a plane will be black, and alpha blending of
> any planes with the CRTC background will blend with black at the lowest zpos.
See https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#plane-abstraction
This means the view for the primary plane does not need to cover the
whole output and black areas of the scene-graph can be left out.
Doing so has various benefits - most importantly it:
1. allows us to use the plane-only path in more situations and with one
less plane, reducing memory bandwidth usage.
2. opens the path to offload arbitrary background colors in the future.
Iterate over the all visible paint nodes, remove solid-opaque-black
views so they are not considered for plane assignment and aggregate a
region that is later used to assign the primary plane.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
So far scene-graph building and plane assignment happened within a single
loop. In the future we want to be able to optimize the scene-graph
before assigning, thus split up the loop into two steps.
No behavioral changes intended.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
This changeset adds three variants of the U.S. Dvorak layout to the
table that is used to map a keyboard ID in the RDP backend to an Xkb
configuration. This makes it possible to have these variants
propagated seamlessly from an RDP client into the Wayland compositor.
As the backend-rdp module requires at least version 2.3.0 of the
FreeRDP library to build, the symbols for these variants is already
present in include/freerdp/locale/keyboard.h, included by rdp.h here,
and in libfreerdp/locale/xkb_layout_ids.c which translate the selected
layout in Xkb into the keyboard ID sent over the wire for the RDP
protocol.
Signed-off-by: Roland Kaufmann <rlndkfmn+freerdp@gmail.com>
We've been clobbering non-solid buffers with solid buffer attachment in
situations where we override the real buffer with a placeholder.
If the reason (punch hole, censor) that led to the placeholder is no
longer in effect, and new buffer is attached, we won't render what we should.
Instead, let's not attach anything for the paint node draw_solid case, and
allow gl_buffer_state be NULL when the real buffer is solid. gl_buffer_state
can then always be the correct state for the real buffer, even if we don't
use it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Currently it uses some values from the existing sconf, instead let's make
it calculate everything on its own
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Refactor textured draw setup into a separate function, preparing for a
future where we set up solid draws from init_for_paint_node as well.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Turns out gl_shader_config_set_input_textures is what adds the filter
parameters to the sconf, so we must set the filters before calling it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that we have a glClear() region optimization for opaque solid surfaces,
we should make sure we test transparent solid surfaces as well.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of doing duplicated calculations. Apart from being faster and
less code, it should help ensuring correctness of the given regions.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
is_fully_opaque notably applies to opaque single-pixel-buffer views
without opaque region. Using it should be purely an optimization.
The check for alpha in turn may fix bugs in certain conditions.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Let's just make them show up in the perfetto traces when they actually
happen, so it's a little easier to see how much benefit we derive from
trying to defer them.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Previously, inverse_evaluate_lut1d was called 3 * len^3 times. Now it is
called only 3 * len times with the help of pre-computed arrays for red
and green channels. Blue channel does not need an array, because there
were no redundant computations. This is a significant win.
Also, allocate a temporary array rgb_in, so cmsDoTransform() can be
called in batches of len triplets. This seemed to be not that big win. I
tried running cmsDoTransform() over len^2 triplets, but that did not
seem to improve performance.
The test I used creates two 3D LUTs, hence two times for a single run.
My representative timing test results per one 3D LUT:
- before: 16 ms and 19 ms
- after: 7 ms and 10 ms
The measurements were done with this patch:
static bool
xform_to_shaper_plus_3dlut(struct weston_color_transform *xform_base,
uint32_t len_shaper, float *shaper,
uint32_t len_lut3d, float *lut3d)
{
struct cmlcms_color_transform *xform = to_cmlcms_xform(xform_base);
struct weston_compositor *compositor = xform_base->cm->compositor;
bool ret;
+ struct timespec begin, end;
+ unsigned i;
- ret = build_shaper(xform->lcms_ctx, xform->cmap_3dlut,
+ clock_gettime(CLOCK_MONOTONIC, &begin);
+ for (i = 0; i < 100; i++)
+ ret = build_shaper(xform->lcms_ctx, xform->cmap_3dlut,
len_shaper, shaper);
if (!ret)
return false;
- ret = build_3d_lut(compositor, xform->cmap_3dlut,
+ for (i = 0; i < 100; i++)
+ ret = build_3d_lut(compositor, xform->cmap_3dlut,
len_shaper, shaper, len_lut3d, lut3d);
if (!ret)
return false;
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ fprintf(stderr, "%s: %" PRId64 " ms\n", __func__, timespec_sub_to_msec(&end, &begin));
return true;
}
Using this command:
$ ./tests/test-color-icc-output -f 8 opaque_pixel_conversion
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This removes the API impedance mismatch between
weston_color_curve_sample() and weston_color_curve_to_3x1D_LUT() that
was temporarily introduced in the previous commit. That mismatch is now
limited to gl_color_curve_lut_3x1d().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Future development will need to evaluate pipelines with curves and
matrices. Such pipelines naturally operate on vec3, as matrices cannot
be operated one channel at a time. Make weston_color_curve_sample()
operate on arrays of vec3.
Its currently only caller, weston_color_curve_to_3x1D_LUT(), is modified
to employ a temporary array for the API impedance mismatch. This
workaround will be removed later as weston_color_curve_to_3x1D_LUT()
itself will be converted to operate on vec3 arrays.
weston_v3f_array_to_planar() documentation was generated with AI.
weston_color_curve_sample() is restructured a little bit, attempting to
make it simpler to read.
color-operations.h gets the #includes needed to make it self-standing.
Assisted-by: Github Copilot (Claude Sonnet 3.5)
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
We can handle the mirroring for negative input without conditional this
way. Maybe it's faster, maybe it's not, but I like this style better.
In color-operations we need only one call to the elementary function
rather than two. This helps a lot with code clarity, when we get a vec3
at a time to handle in the future, doing three trivial calls instead of
six with an if-else hassle.
fragment.glsl sheds one layer of function wrapping, which is nice.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
For some cases such as remote control, need to disable the interaction
between input device and the weston. It will not affect the use of input
device by other modules or applications.
Signed-off-by: Elliot Chen <elliot.chen@nxp.com>
since abfe874a51 we no longer do a full view list rebuild after a
surface_set_size(), but that was ensuring we always had an up to
date transform in the repaint loop.
Add a weston_view_update_transform() here to dodge the assert in
the repaint loop.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This was missed in e169b77430
when leaving planes in the scene graph meant we no longer needed
to calculate this clip.
It's just a few wasted cycles, so no backport required.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of clipping the visible region to the output, clip the entire
region to the output first and save that, then create the visible region
from that.
Now we have both the clipped and visible view regions that the backends
may want to do plane assignment stored in paint nodes, so we can save
some duplicate math.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Assign planes in the future could benefit from visibility information on
pnodes being up to date.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This is a step towards having correct visibility information in
assign_planes. Instead of visible_next and visible, we now have
visible_previous and visible, with visible being set up in the
visibility update function instead of being copied across in
the late update.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In the future I plan to move the paint node visibility calculation, and
in doing so the different callers to paint_node_damage_below() will have
different visibility regions.
Add the region as a parameter.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that we're validating that buffer size must be an integer multiple of
scale, add some tests to make sure it's happening.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We're supposed to generate an INVALID_SIZE error if the buffer size isn't
an integer multiple of the scale.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that we use single pixel buffer, we need to be careful to only use
scale of 1, as other scales are supposed to generate an INVALID_SIZE
protocol errors (because the buffer size is not an integer multiple
of the scale).
Right now a bad scale just breaks background repaints, but in the future
we'll properly validate scale, which would cause the shell client to
be disconnected.
Fixes: 6cc8f48cd ("clients: Paint desktop-shell color background with single-pixel-buffer")
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Allow dictating which color format we'd like to use. This introduces the
front-end side and the core parts, leaving the EDID parsing and DRM
connector property for later patches.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
When we're going through assign_planes and repaint, give the backend an
opportunity to see what's changed during this repaint.
Signed-off-by: Daniel Stone <daniels@collabora.com>
If a surface changes size or opaque region, or a view changes position,
we don't need to rebuild the entire view list from scratch: we can just
rebuild what's changed and nothing else.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Nothing uses this, and it was also being set incorrectly, as it would
return true when there was no damage to actually be flushed.
Signed-off-by: Daniel Stone <daniels@collabora.com>
In order to streamline our checks and to make it easier to ensure
that we replace paint nodes with solid placeholders correctly.
Fix the failure reason in one case while on it.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
In order to be more in line with weston_view_is_opaque() - which we
use in most cases to set the value - and ensure the expectations of
existing places in the code are honored, see usages in both
draw_paint_node() implementations.
An exception here are holes - these always need to get painted as fully
opaque in the renderer path.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
I heard rumoours this is mostly unnecessary to check nowdays since it is
the default.
The real reason is that it crashes sometimes:
$ ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/gitlab/exceptions.py", line 344, in wrapped_f
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/gitlab/mixins.py", line 125, in get
server_data = self.gitlab.http_get(path, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/gitlab/client.py", line 813, in http_get
result = self.http_request(
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/gitlab/client.py", line 779, in http_request
raise gitlab.exceptions.GitlabHttpError(
gitlab.exceptions.GitlabHttpError: 403: 403 Forbidden
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/ci-fairy", line 8, in <module>
sys.exit(ci_fairy())
^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 1082, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/core.py", line 788, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/ci_fairy.py", line 1795, in check_merge_request
mr = p.mergerequests.get(merge_request_iid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/gitlab/v4/objects/merge_requests.py", line 523, in get
return cast(ProjectMergeRequest, super().get(id=id, lazy=lazy, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/gitlab/exceptions.py", line 346, in wrapped_f
raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabGetError: 403: 403 Forbidden
Observed in https://gitlab.freedesktop.org/elliot_chen/weston/-/jobs/86174879
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This should be checking for a valid transform so it doesn't use corners
of an axis aligned bounding box for free-form transformed views.
It should still check surf_xform for color management, but it should only
do that when surf_xform_valid is true.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This test is critical, so only do it once, and throw some asserts around
to make sure we don't mess it up.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Video underlay "holes" are fully transparent but must be rendered
fully opaque. However, they appear to be fully transparent to
the current gl-renderer test which is missing a need_hole check.
Add a paint node attribute for this so it can be more easily
checked in assign_planes and renderers.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Remove maybe_replace_paint_node entirely and place the parts of it
properly between early and late updates.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We'll need this in both the early and late paint node updates soon,
so this saves a couple of lines of code.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We're going to assert on a bunch of stuff, so let's put it in a function
to remove clutter.
For now it's trivial, but I'll be adding more tests shortly.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
It's the same as buffer->direct_display essentially 100% of the time,
except maybe if someone set weston_direct on a single-pixel-buffer, but
that's madness.
Just drop it entirely, and let the only existing reader of the variable
get it from the buffer directly.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
At the moment this is only replacing two clear calls with one. However,
when client_buffer starts using properly-bracketed CPU access, this will
become much more tedious. Introduce a helper now to make it easier.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We always have the name of a reference image to compare to; comparison
is kind of impossible without one.
Signed-off-by: Daniel Stone <daniels@collabora.com>
It's pretty trivial to make verify_screen_content() and
capture_screenshot_from_output() support decorations, so we can reuse
those in output-decorations tests rather than open-coding.
Signed-off-by: Daniel Stone <daniels@collabora.com>
get_middle_row() is a pure CPU accessor which only needs to operate on a
pixman_image_t. Pass this directly instead of struct buffer.
Signed-off-by: Daniel Stone <daniels@collabora.com>
A very marginal benefit, but why not. Any tests using screen capture are
now using a refresh rate of 0 (redraw immediately on capture request),
whilst others are using HIGHEST_OUTPUT_REFRESH.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When we fail out because we couldn't even start a container or bring the
runner environment up, just retry the job.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Some client use subsurfaces with fully transparent single-pixel buffers
for various reasons, such as making it easier to order trees of
subsurfaces. As they are invisible we can simply ignore them in the
scene graph.
This allows us to use direct-scanout/plane-only in more circumstances,
as ensured in the test.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Previously I didn't think we needed this set up before assign_planes, but
certainly in the near future we'll want access to these bits for plane
assignment. It should be harmless to move them all now.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Recent improvements to llvmpipe made it possible to test dmabuf import
and offloading on vkms. Use our new client-buffer helper and the
presentation protocol to implement tests for simple offloading
scenarios.
Right now this is limited to the vkms default config, only providing us
with one primary and one cursor plane. In the future we can extend the
test to include more advanced scenarios.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Add a minimal implementation to allow client to use xdg_toplevel_set_fullscreen().
Note that desktest_shell does not yet properly handle various changes of the surface
state once mapped. Thus we don't handle such cases here either and just
assert on the expected behavior where appropriate.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
This test goes through all the errors one can do in weston.ini
color-profile section, and ensures they give the proper error logging.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This tests the [output] section key 'color-profile', which is meant for
setting up parametric color profiles. It tests the special names, and
fetching values from EDID. There are also tests for all accepted keys in
a [color-profile] section.
These tests are all positive. Error messages are tested in another
patch.
The test client helper changes are needed for loading the EDID file.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This allow users to specify a fully custom parametric color profile in
weston.ini for a certain output.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The protocol does not carry target primaries by enumeration, but in
weston.ini I want to be able to use a name rather than raw values.
Adding this API makes that possible.
main.c cannot look up the enumeration itself, because color-properties.h
is private. As it should be.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is for parsing multiple numbers from one weston.ini key, which
means I cannot use weston_config_section_get_double(). Also going to use
float type, which has less range than double.
Ironically, the tests fill likely fail on locales that do not use
period as the radix character.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If we have a solid region which is opaque, we don't need to go through
blending: we can simply emit a glClear, which has a pretty big benefit
on tilers in particular.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Instead of predicating the call to ensure_surface_buffer_is_ready() on
various conditions, move those into early exits from there.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Now that paint nodes handle solid buffers properly, we can use the same
codepath through gl-renderer for all solid buffers, regardless of
whether they're a single-pixel buffer from clients, or a weston_curtain,
or a temporary placeholder due to content-protection or direct-display.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Single-pixel buffers are, by definition, a single-colour fill across the
entire paint node. Use the draw_solid path for these where we can.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When we're censoring output due to a content-protection mismatch, we
were setting draw_solid for the placeholder, but losing is_direct for
the original buffer.
There's no real effect with the current renderers, but best to be
consistent and make pnode->is_direct always accurate.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When we're calling weston_surface_copy_content() from a solid buffer,
use the buffer's solid colour directly instead of our local copy.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The answer is that no, we do not need to be using the view's opaque
region. If the paint node is marked as fully opaque, that's because the
view itself is also opaque, and as we are dealing with surface
co-ordinates we don't need to be handling the transform here.
Signed-off-by: Daniel Stone <daniels@collabora.com>
drm_pending_state_apply_atomic is supposed to leave pending_state
untouched if called as a test-only and that test fails, as per the docs
for drm_pending_state_test. If it gets as far as doing the atomic test
and it fails, it doesn't free pending_state. However if it fails to even
compile the state for the atomic test (for example, if a particular
property is not implemented in the driver for a particular plane), it
frees pending_state. In this case, drm_output_propose_state will free
the contained drm_output_state again, typically leading to a segfault.
Treat failing to compile the state for the atomic test in the same way
as successfully running the atomic test but it failing.
Signed-off-by: Ray Smith <rsmith@brightsign.biz>
On 32-bit ARM, tv_sec is of type long long int. Cast to int64_t and
use PRId64 from inttypes.h instead of %ld to silence these format
warnings:
.../libweston/compositor.c: In function 'weston_compositor_print_scene_graph':
.../libweston/compositor.c:9297:14: warning: format '%ld' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Wformat=]
.../libweston/compositor.c:9322:16: warning: format '%ld' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Wformat=]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
On 32-bit ARM, tv_usec is of type long long int. Cast to int64_t and
use PRId64 from inttypes.h instead of %ld/%li to silence these format
warnings:
.../libweston/weston-log.c: In function 'weston_log_scope_timestamp':
.../libweston/weston-log.c:961:22: warning: format '%ld' expects argument of type 'long int', but argument 5 has type '__suseconds64_t' {aka 'long long int'} [-Wformat=]
.../libweston/weston-log.c: In function 'weston_log_timestamp':
.../libweston/weston-log.c:1015:27: warning: format '%li' expects argument of type 'long int', but argument 6 has type '__suseconds64_t' {aka 'long long int'} [-Wformat=]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Replace two always-true assertions:
weston_assert_true(wc, &other_shview->view->layer_link.layer);
with what seems to have been the intended check:
weston_assert_ptr_not_null(wc, other_shview->view->layer_link.layer);
This fixes a build warning:
.../lua-shell/lua-shell.c: In function 'lua_shell_env_view_move_behind_other_view':
.../lua-shell/lua-shell.c:1466:1: warning: the comparison will always evaluate as 'true' for the address of 'layer' will never be NULL [-Waddress]
In file included from .../include/libweston/desktop.h:27,
from .../lua-shell/lua-shell.h:27,
from .../lua-shell/lua-shell.c:33:
.../include/libweston/libweston.h:1112:23: note: 'layer' declared here
.../lua-shell/lua-shell.c: In function 'lua_shell_env_view_move_in_front_of_other_view':
.../lua-shell/lua-shell.c:1482:1: warning: the comparison will always evaluate as 'true' for the address of 'layer' will never be NULL [-Waddress]
.../include/libweston/libweston.h:1112:23: note: 'layer' declared here
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
The average tolerance was very very close on my AMD machine, but not
enough; the maximum tolerance certainly needed to be increased.
Observed on an AMD Radeon 780M with radeonsi from an October 2025 Mesa
build.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The error path in cmlcms_color_transform_create() uses
cmlcms_color_transform_destroy() to clean up. cmap_lut3d can be NULL in
that case, and cmsDeleteTransform() chokes on it.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This introduces a new key for outputs in weston.ini, "color-profile".
For starters, implement a pre-defined sRGB profile and an automatic
profile.
Automatic color profiles are created based on the colorimetry-mode and
the eotf-mode of the output. EDID can also be taken into account, but it
is opt-in due to its potential unreliability.
This feature is documented as not fully implemented, because color-lcms
does not yet handle parametric color profiles together with ICC
profiles. Specifically, the stock sRGB profile is still an ICC profile,
and would not be able to be used together with a parametric output
profile.
Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This will be useful for parsing config file entries that have several
items on key, like x,y coordinates or a list of flags. Code reading
custom color profiles from weston.ini will use this.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
As it should have been. Found, when I temporarily needed to print
'static const struct weston_color_profile_params'.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Details are printed separately for logs and debugs, we don't need to
clutter the (short) description with these. The name_part is already
long enough for frontend-created automatic profiles.
Client-created parametric profiles will be indistinguishable from each
other, but we also don't log them anywhere. In debug prints, they are
identified by id numbers and printed in detail.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This error gets sent to clients or into the Weston log. Print the name
rather than the meaningless number.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The target luminance range is implied when not explicitly set, so maxCLL
and maxFALL should be checked against target luminances regardless of
whether target luminances are explicit.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Make sure the given values are finite, positive, and non-zero where
appropriate.
Because these validations are not mandated in the color-management
protocol, they are not immediate failures. They will fail the final
image description creation.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Statements phrased positive are easier to understand than phrased
negative. Use "must" instead of "should".
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The old code checked x for low limit and y for high limit, rather than
checking both for both limits. Fix this.
Check all value pairs rather than the first one four times. Don't stop
at the first error, record them all.
While at it, we might as well print exactly what value was the problem.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If any output uses a YUV format, instead of trying to composite into a
png, write the raw data into .yuv files for each output.
These files don't contain any metadata yet, thus one may want to convert
them into y4m files with e.g. a command like the this:
ffmpeg -s 1024x768 -r 1 -pix_fmt yuv420p -i ~/wayland-screenshot-output-0-2025-08-01_15-58-24.yuv -c:v copy screenshot.y4m
Note that this may only work for certain pixel formats, such as
DRM_FORMAT_YUV4[20|22|44], and not for e.g. DRM_FORMAT_P010.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Instead of relying on the compositor to allocate dmabufs for the
writeback connector and copying the results to the client-provided
shm-buffer, support allocating dmabufs in the client. The compositor
will pass them through to the writeback connector, effectively doing
the equivalent to "passthrough"/"plane-offloading"/"zero-copy".
Based on a patch by Chien Phung Van <chien.phungvan@vn.bosch.com>
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Which is not supported with Pixman, thus test the GL and VK renderers.
This ensures the code-path for directly forwarding client-allocated
dmabufs to the writeback connector works as expected.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
In the next commit we will need syncing for reading. Thus adapt the sync
helper accordingly. We are not using the helper for performance-critical
tasks yet, thus there's currently no strong reason to allow users to
differentiate between the cases.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Using the newly introduced create_buffer(), to which the buffer type is
passed on in order to allow taking writeback screenshots with dmabufs.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
If the client requests to take a screenshot using the writeback source
with a DMA buffer, Weston will get the framebuffer from that dmabuf
object and attach it to the writeback connector.
Original commit by Chien Phung Van.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Co-authored-by: Chien Phung Van <chien.phungvan@vn.bosch.com>
This is not strictly always necessary depending on the implementation,
so the extension requirement can be made optional.
Also improve its usage by first checking whether the dedicated
allocation is preferred/required by the driver, before importing
with dedicated allocation.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
So the buffer has the WESTON_BUFFER_SOLID type, which will make
additional optimizations easier going forward.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
This is identical to MAXIMIZE side where we change the state to
MAXIMIZE, and implicitly go through a state surface check.
For XWAYLAND type of windows (non weston_desktop_surface)
that surface state check will be needed. This is a temporary work-around
to avoid Weston crashing as some X11 Window types will hit this path.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
windows in the XWAYLAND state are popups and other such things that aren't
managed by libweston-desktop, so we crash if we query their position
with weston_desktop_api.
Query the position for these XWAYLAND windows based on their weston_view
and window geometry.
This should result in synthetic configure notify events no longer crashing.
Fixes#831Fixes#1019
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In a multi-screen setup, removing the first screen triggers `handle_output_move`.
If `weston_view_set_position` is called on an output that has an active popup,
it causes a weston crash due to the view has a parent.
Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
A change in the connector state require a possible full modest depending on the
hardware.
The connector wasn't set to unconnect if the head was detached while the output
is still enabled. Fix this by always checking the disable_head_link list during
drm_output_apply_state_atomic().
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
DRM_MODE_ATOMIC_TEST_ONLY shouldn't remove the head from the
drm_output::disable_head list else the head is lost for the actual modeset
action.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
The shell_set_view_fullscreen function was dereferencing
shsurf->fullscreen_output without checking if it was NULL first. This
could lead to a crash when a fullscreen surface had no associated
output during display hotplug.
Fix issue: https://gitlab.freedesktop.org/wayland/weston/-/issues/1028
Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
1. Bump the kernel version to the drm-misc-next-2025-09-04 tag, fixing
various issues required for vkms testing.
2. Use /sys/bus/faux/devices/vkms/drm/ instead of /sys/devices/platform/vkms/drm/
for the card basename.
3. Bump Mesa to the commit needed for vkms+lavapipe. This also needs another
leak workaround, so the code got a small cleanup.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
The new formats_done event has to be at the end, triggering warnings
like the following otherwise:
warning: since version not increasing
Fixes: 00902a592 (output-capture: Allow multiple formats and add formats_done event)
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Comparing floating-point values for identity is fragile. Comparaing with
a small tolerance allows for matches that differ only due to numerical
precision of computations.
The tolerance is taken from
weston_color_tf_info_from_parametric_curve().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It is nice to see the numbers of a parametric color profile when created
from CTA or EDID or just to cross-check with weston.ini.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
At first I wanted to wrap
float tf_params[MAX_PARAMS_TF]
into a struct, so that it would become type-safe to pass into functions,
and it could be copied with a simple assignment. Then I noticed that for
tf_params to be operable, it must always be accompanied by struct
weston_color_tf_info. Hence, struct weston_color_tf was born.
The need for #define MAX_PARAMS_TF got eliminated.
Because struct weston_color_tf is a member of struct
weston_color_profile_params, now both need to not contain implicit
padding.
This patch makes the internal enumerated TF structures follow the
current protocol requests: all color channels use the same curve.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This was never used, and I happened to write a slightly different
version of it in color-lcms.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
And also for connector changes. This would allow tracking hot-plug
events from the udev/kernel and figure out that connector properties
changed.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
A infinitesimal short-flip in HDMI HDP in-out (hot-plug event) would
cause a discrepancy between kernel's connector's state and Weston
connector state resulting in kernel and Weston disagreeing on the final
connector state.
This has the undesired effect where the output would never turn on when
this short burst of HDP events come through.
To avoid that, just set the device invalid_state as true to go through a
modeset. Also, schedule a repaint when that happens to go through a
repaint.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This way we can differentiate when we get a HOTPLUG event that gave us a
CONNECTOR ID to work with.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This splits drm_backend_update_connectors into
drm_backend_update_connector and a post destroy phase/function.
There's no functional change, but this allows to pass
drm_backend_update_connector() on its own as we'll need that.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Add support for using writeback connectors as source. Those potentially
support more than one format, thus allow selecting those as well.
While on it, add a verbose flag for useful debug output.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Writeback connectors often support multiple formats, fully independent
of the input framebuffer. Wire up support for querying formats and send
them to clients.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
The writeback output capture source may allow clients to select from
multiple possible formats. Update the protocol and its users
accordingly, and add formats_done event, making the implementation
easier and following common protocol practice.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
The writeback connector UAPI does not mention modifiers explicitly,
however implicitly we assume and use a linear modifier when using
dumb buffers.
Adding that to the format thus makes the assumption more obvious and
allows us to use the weston_drm_format_array as intended.
For example we can now use weston_drm_format_array_count_pairs() to
log the number of supported formats - previously it always returned 0.
See
https://www.kernel.org/doc/html/v6.16/gpu/drm-kms.html#writeback-connectors
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Create a linux_dmabuf_memory subclass so that it holds the associated
gbm_bo and it can be properly destroyed with the dmabuf object.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
This is not required and creates a refcount imbalance,
causing a memory leak at drm-backend teardown.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Follow-up of "color: introduce output color effects". This adds a few
sanity tests for color effects.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Output color effects are applied to the whole output scenegraph. It
depends on color-management being disabled, as the color effects are
applied in sRGB content.
For now we added only a few accessibility options: color inversion,
deuteranopia, protanopia and tritanopia CVD correction.
Note that surfaces presented on outputs that contains a color effect
can't be used for direct scanout (i.e. bypass composition and offloading
to KMS overlay planes). The color effect is applied in our GL-renderer.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
When we have a mirror, it will be at the same x,y position as the output
it's mirroring. On hot unplug, the current logic results in the mirroring
output being moved to the left by the width of its target output. The
mirror will then be destroyed, and the views can be left dangling outside
of usable space when a hot plug restores the outputs.
Subtly change the reflow logic to only reflow outputs to the right of the
removed output by testing co-ordinates, instead of assuming that every
output in the list is to the right of the previous.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that FAILURE_REASONS_FORCE_RENDERER isn't set for all not-scanout
capable failures, add some other reasons to the test in
dma_feedback_maybe_update.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The default output format setting to the backend format was removed and
renderer-specific format picking functions were introduced, but one was
not included for vulkan-renderer.
Vulkan-renderer doesn't yet implement color management features which
would benefit from a full featured format selection here, so for now
just have a base implementation which restores the previous behavior.
This fixes the introduced segfault with vulkan-renderer and drm-backend.
Fixes: 56c27ea2 ("backend-drm: improve code that chooses output->format")
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
We didn't have many Weston assert macros in place, but now we do.
Make use of a few of the newer macros where they make sense. No big
difference, but just to exercise using the correct ones now that they
exist.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This adds a ton of weston assert macros that were missing, as well as
tests for all of that.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Rename parameter "compositor" to "comp", allowing us to have one-line
macros that makes the file easier to read. Also moves a few macros
to other parts of the file.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Currently weston-test-assert.h has a better naming style than
weston-assert.h: more concise and standardized.
So let's copy the same style to weston-assert.h
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The initial drm backend implementation for Vulkan passes display device
allocated gbm bos directly to the renderer. This is a bit awkward since
it requires the renderer to maintain a custom output creation interface
and another code path for importing specifically gbm bos.
Since then, vulkan-renderer received support to use dmabuf renderbuffers
to support e.g. pipewire dmabuf, in an interface which is also common
with gl-renderer.
The dmabuf renderbuffer code path is similar to what the drm backend
implementation intended to do, so we can unify it to a single interface.
This has the advantages of requiring one less custom output creation
interface, as well as the renderer being able to handle the drm backend
through a single shared dmabuf renderbuffer path.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
The fbo naming inherited from gl-renderer is confusing, and now it
is used in many places.
Rename the two options for output creation to surface and surfaceless
to hopefully make them more meaningful.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Fixes a minor issue with 28bdcb46be ("frontend: Log when exiting due to
insufficient active outputs") to only print that we have
no outputs enabled but we're allowed to continue when we actually get to
that scenario.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Fixes the following mem leak:
=================================================================
==191==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 56 byte(s) in 1 object(s) allocated from:
#0 0x7f6b843f6610 in calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
#1 0x7f6b8302f499 in output_created_listener ../tests/weston-test.c:145
#2 0x7f6b83032dcd in wet_module_init ../tests/weston-test.c:857
#3 0x7f6b842b8425 in wet_load_module ../frontend/main.c:989
#4 0x7f6b842b89eb in load_modules ../frontend/main.c:1069
#5 0x7f6b842d2711 in wet_main ../frontend/main.c:4865
#6 0x562862e934d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#7 0x562862e9756b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#8 0x562862e81e1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#9 0x562862e81e9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#10 0x562862e97bb6 in main ../tests/weston-test-runner.c:726
#11 0x7f6b83d33ca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Fixes the following memory leak:
=================================================================
==191==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x7f18bfa83610 in calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
#1 0x7f18bf890191 in zalloc ../include/libweston/zalloc.h:38
#2 0x7f18bf89184c in weston_log_ctx_add_log_scope ../libweston/weston-log.c:631
#3 0x7f18bf891c2c in weston_compositor_add_log_scope ../libweston/weston-log.c:696
#4 0x7f18be524ef6 in wet_module_init ../tests/weston-test.c:864
#5 0x7f18bf945425 in wet_load_module ../frontend/main.c:989
#6 0x7f18bf9459eb in load_modules ../frontend/main.c:1069
#7 0x7f18bf95f711 in wet_main ../frontend/main.c:4865
#8 0x557b36c114d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#9 0x557b36c1556b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#10 0x557b36bffe1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#11 0x557b36bffe9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#12 0x557b36c15bb6 in main ../tests/weston-test-runner.c:726
#13 0x7f18bf3c0ca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Direct leak of 56 byte(s) in 1 object(s) allocated from:
#0 0x7f18bfa83610 in calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
#1 0x7f18be521499 in output_created_listener ../tests/weston-test.c:145
#2 0x7f18be524dcd in wet_module_init ../tests/weston-test.c:857
#3 0x7f18bf945425 in wet_load_module ../frontend/main.c:989
#4 0x7f18bf9459eb in load_modules ../frontend/main.c:1069
#5 0x7f18bf95f711 in wet_main ../frontend/main.c:4865
#6 0x557b36c114d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#7 0x557b36c1556b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#8 0x557b36bffe1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#9 0x557b36bffe9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#10 0x557b36c15bb6 in main ../tests/weston-test-runner.c:726
#11 0x7f18bf3c0ca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Indirect leak of 33 byte(s) in 1 object(s) allocated from:
#0 0x7f18bfa7dd60 in strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:578
#1 0x7f18bf8918ed in weston_log_ctx_add_log_scope ../libweston/weston-log.c:639
#2 0x7f18bf891c2c in weston_compositor_add_log_scope ../libweston/weston-log.c:696
#3 0x7f18be524ef6 in wet_module_init ../tests/weston-test.c:864
#4 0x7f18bf945425 in wet_load_module ../frontend/main.c:989
#5 0x7f18bf9459eb in load_modules ../frontend/main.c:1069
#6 0x7f18bf95f711 in wet_main ../frontend/main.c:4865
#7 0x557b36c114d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#8 0x557b36c1556b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#9 0x557b36bffe1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#10 0x557b36bffe9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#11 0x557b36c15bb6 in main ../tests/weston-test-runner.c:726
#12 0x7f18bf3c0ca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Fixes the following UAF:
==191==ERROR: AddressSanitizer: heap-use-after-free on address 0x518000000360 at pc 0x7f1ee142f5df bp 0x7ffe60aaf010 sp 0x7ffe60aaf008
READ of size 8 at 0x518000000360 thread T0
#0 0x7f1ee142f5de in output_destroyed_listener ../tests/weston-test.c:166
#1 0x7f1ee25f08eb in wl_signal_emit_mutable ../src/wayland-server.c:2401
#2 0x7f1ee274c7f8 in weston_compositor_remove_output ../libweston/compositor.c:7877
#3 0x7f1ee274fa92 in weston_output_release ../libweston/compositor.c:8641
#4 0x7f1ee146e5f8 in drm_output_destroy ../libweston/backend-drm/drm.c:2626
#5 0x7f1ee27552df in weston_compositor_shutdown ../libweston/compositor.c:9941
#6 0x7f1ee2756a89 in weston_compositor_destroy ../libweston/compositor.c:10369
#7 0x7f1ee286bed8 in wet_main ../frontend/main.c:4934
#8 0x56113c4244d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#9 0x56113c42856b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#10 0x56113c412e1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#11 0x56113c412e9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#12 0x56113c428bb6 in main ../tests/weston-test-runner.c:726
#13 0x7f1ee22ccca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#14 0x7f1ee22ccd64 in __libc_start_main_impl ../csu/libc-start.c:360
#15 0x56113c412860 in _start (/home/mvlad/vkms/weston/b/tests/test-drm-writeback-screenshot+0xe860) (BuildId: 9f9e2ed12b9317dd859498374500f2406c32e5d3)
0x518000000360 is located 736 bytes inside of 792-byte region [0x518000000080,0x518000000398)
freed by thread T0 here:
#0 0x7f1ee298e8f8 in free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:52
#1 0x7f1ee1433002 in wet_module_init ../tests/weston-test.c:882
#2 0x7f1ee2851425 in wet_load_module ../frontend/main.c:989
#3 0x7f1ee28519eb in load_modules ../frontend/main.c:1069
#4 0x7f1ee286b711 in wet_main ../frontend/main.c:4865
#5 0x56113c4244d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#6 0x56113c42856b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#7 0x56113c412e1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#8 0x56113c412e9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#9 0x56113c428bb6 in main ../tests/weston-test-runner.c:726
#10 0x7f1ee22ccca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
previously allocated by thread T0 here:
#0 0x7f1ee298f610 in calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
#1 0x7f1ee142edc5 in zalloc ../include/libweston/zalloc.h:38
#2 0x7f1ee1432cba in wet_module_init ../tests/weston-test.c:840
#3 0x7f1ee2851425 in wet_load_module ../frontend/main.c:989
#4 0x7f1ee28519eb in load_modules ../frontend/main.c:1069
#5 0x7f1ee286b711 in wet_main ../frontend/main.c:4865
#6 0x56113c4244d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#7 0x56113c42856b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#8 0x56113c412e1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#9 0x56113c412e9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#10 0x56113c428bb6 in main ../tests/weston-test-runner.c:726
#11 0x7f1ee22ccca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
For fixing the following UAF.
==191==ERROR: AddressSanitizer: heap-use-after-free on address 0x518000000168 at pc 0x7f7aac77493e bp 0x7ffdd9dddc00 sp 0x7ffdd9dddbf8
READ of size 8 at 0x518000000168 thread T0
#0 0x7f7aac77493d in udev_input_destroy ../libweston/libinput-seat.c:388
#1 0x7f7aac73e632 in drm_shutdown ../libweston/backend-drm/drm.c:3623
#2 0x7f7aad9208b8 in weston_compositor_shutdown_backends ../libweston/compositor.c:10337
#3 0x7f7aad920a7d in weston_compositor_destroy ../libweston/compositor.c:10367
#4 0x7f7aada35ed8 in wet_main ../frontend/main.c:4934
#5 0x561e808014d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#6 0x561e8080556b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#7 0x561e807efe1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#8 0x561e807efe9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#9 0x561e80805bb6 in main ../tests/weston-test-runner.c:726
#10 0x7f7aad496ca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#11 0x7f7aad496d64 in __libc_start_main_impl ../csu/libc-start.c:360
#12 0x561e807ef860 in _start (/home/mvlad/vkms/weston/b/tests/test-drm-writeback-screenshot+0xe860) (BuildId: 9f9e2ed12b9317dd859498374500f2406c32e5d3)
0x518000000168 is located 232 bytes inside of 792-byte region [0x518000000080,0x518000000398)
freed by thread T0 here:
#0 0x7f7aadb588f8 in free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:52
#1 0x7f7aac3f2f9d in wet_module_init ../tests/weston-test.c:878
#2 0x7f7aada1b425 in wet_load_module ../frontend/main.c:989
#3 0x7f7aada1b9eb in load_modules ../frontend/main.c:1069
#4 0x7f7aada35711 in wet_main ../frontend/main.c:4865
#5 0x561e808014d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#6 0x561e8080556b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#7 0x561e807efe1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#8 0x561e807efe9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#9 0x561e80805bb6 in main ../tests/weston-test-runner.c:726
#10 0x7f7aad496ca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
previously allocated by thread T0 here:
#0 0x7f7aadb59610 in calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
#1 0x7f7aac3eedc5 in zalloc ../include/libweston/zalloc.h:38
#2 0x7f7aac3f2c55 in wet_module_init ../tests/weston-test.c:836
#3 0x7f7aada1b425 in wet_load_module ../frontend/main.c:989
#4 0x7f7aada1b9eb in load_modules ../frontend/main.c:1069
#5 0x7f7aada35711 in wet_main ../frontend/main.c:4865
#6 0x561e808014d6 in execute_compositor ../tests/weston-test-fixture-compositor.c:431
#7 0x561e8080556b in weston_test_harness_execute_as_client ../tests/weston-test-runner.c:570
#8 0x561e807efe1d in fixture_setup ../tests/drm-writeback-screenshot-test.c:48
#9 0x561e807efe9e in fixture_setup_run_ ../tests/drm-writeback-screenshot-test.c:50
#10 0x561e80805bb6 in main ../tests/weston-test-runner.c:726
#11 0x7f7aad496ca7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
This would be caused by not being able to compile keymaps.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
In a2a6030902 I introduced a crash when no
cursor plane exists. Fix this by pulling the cursor plane tests into their
own function and doing an early return when we have a conclusive no-cursor
failure state.
Fixes a2a6030902
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
On certain setups - notably virtual machines - the output name can
be already taken (by e.g. virtio).
Given that we only use a single output for the test, do what other
tests do and don't assume any name.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Notably including
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35915
which is needed for some upcoming MRs.
Returning to a proper release also makes it easier to understand
what we are testing against.
Mesa 25.2 requires Meson >= 1.4 and libX11 >= 1.8. The later requires
autoconf >= 2.70.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Now that new formats are supported by the Vulkan renderer, update
this list to match our driver in CI for a more reasonable coverage.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Remove the limited shm formats hardcoded list and add a query to
populate them according to the device.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Update list of Vulkan equivalent of the DRM formats.
Fix some format information to account for endianness according
to the "DRM pixel format guide".
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
This file used both __BYTE_ORDER and __BYTE_ORDER__ which could become
confusing to inspect.
Both appear to be valid, since it is being compared to __LITTLE_ENDIAN
stick to __BYTE_ORDER for all uses.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Define extension tables for all extensions that are potentially used,
and use that to enumerate and request extensions which will be used.
This allows for a bitset to hold supported extensions and makes it
less cumbersome to define new ones to use later, as well as requiring
less traversing of the extension string list to decide which extensions
to request.
This also fixes some missing dependency issues which could trigger
validation errors on some drivers with limited extension support.
It also allows some code paths that didn't require some specific
extensions that were in the default list before, by checking for
those in the code path that actually uses them at runtime.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Follow-up of "compositor: let backends handle output->disable_planes".
Now we always call assign_planes() before a repaint, so we must have
a valid output state when we enter assign_planes().
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
For clients using old protocol versions, the WESTON_SURFACE_DIRTY_POS bit
currently gets set on any attachment. It should really only be set if
the attachment is non-zero.
Since it's possible to attach mulitple times, or to invoke
wl_surface.offset multiple times, let's allow clearing the bit so it
stays up to date with the state that will actually be used on commmit().
Currently, this is pointlessly pedantic, as we don't really do much with
the bit, but in a future commit I intend to use it to notice states that
may change visibility/occlusion status of a surface.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This is not what any sensible person would expect it to be. It was updated
by a walk of all the paint nodes on the output most recently repainted,
so if a view spanned outputs the visible region would only make sense
within the most recently painted output's region.
It's basically a scratchpad for a mid-repaint operation. Instead of making
it a view member, put it in the paint node, which are always per-output.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Add transform information to scene graph debug dumps, which can be
helpful in determining why application surfaces aren't ending up on
hardware planes.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
At the end we'll have the plane failure reasons in their final state for
the frame we're submitting (instead of a stale state from the previous)
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
While this is generally drm specific stuff, it's leaked into paint nodes
a little bit already.
Pushing it into the core gives us the ability to print failure reasons
in the scene graph debug text (in a future commit), which can be very
informative.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We have a big bitfield of failure reasons for when we can't place a paint
node on a plane - but between the introduction of this bitfield and now
we added many new reasons, so it's an expecation that the reason
FAILURE_REASON_FORCE_RENDERER only means that the compositor is configured
to force the use of the renderer via the WESTON_FORCE_RENDERER environment
variable, or debug key bind, or similar.
Some of the code retained the older generic use of FORCE_RENDERER to mean
any number of things.
Add some new reasons and use other existing reasons to disambiguate the
FORCE_RENDERER reason.
Since we already print the (somewhat misleading) failure reason strings
late in the repaint pass, we can drop the (currently accurate) debug
prints we fired off along the way, and just print them accurately at the
end.
We also move the failure reason reset point to the start of repaint,
as it is convenient to have it be valid after plane assignment so
we can print it in scene graph debug text in a later commit.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The caller to drm_plane_state_coords_for_paint_node() has already tested
for valid transforms, so drm_plane_state_coords_for_paint_node() is never
called with a transform that needs to be tested.
Replace the test with an assert() - and this also lets us stop returning
a bool, and drop the debug prints that could never trigger.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Move some code around so we only have a single call to
weston_surface_apply(). This will simplify having deferred state updates
later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
weston_subsurface_commit_to_cache and weston_subsurface_commit are
trivial functions with single call sites. Eliminate them.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that we don't have a buffer_ref to manage outside the surface_state
struct, this function is a trivial wrapper.
Just inline it where it's used.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Use a buffer_ref here to allow us to remove the subsurface
cached_buffer_ref and keep it in the surface state struct instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We don't need to define weston_compositor_build_view_list here, as it's
already defined before it's used.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
compositor.c is too big, let's try to peel off a bit of surface state
handling code into another file.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
I'll want to use this in another file soon, but for now let's just
clean up the extra prototypes.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Push the subsurface vs surface logic into weston_surface_commit so there's
just one function to call from surface_commit to handle both.
This is mostly preparation for splitting off a bunch of surface handling
functions into their own file later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Do a subsurface cache flush in weston_subsurface_set_effectively_synchronized
instead of in the protocol handler.
This is just so when I move some functions into another file later, I don't
need to expose weston_subsurface_apply_from_cache().
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Finish up renaming functions so that committing state and applying state
have their own function names. This will be useful soon when we have a
mechanism to commit state into a queue and apply it later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
To streamline state handling, push the weston_subsurface_parent_apply
calls and list walks into weston_surface_apply().
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We have several places where we apply surface state, then walk the
subsurface list.
In surface_commit() however, we walk the list first then apply state.
Re-order surface_commit() so it's the same as the other sites.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Continue renaming "commit" functions to "apply" in anticipation of
a violent split between the two concepts.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In a future commit, we'll need weston_subsurface_parent_commit sooner,
so just move both of these prototypes earlier in the file.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We don't use it anymore, we just casually commit and expect that
applying clean state is harmless.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
It really doesn't matter if we do a little extra work here,
weston_subsurface_commit_from_cache() is harmless if called on clean state.
If this turns out to waste some cycles we can add some more dirty bits
later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We called subsurface_parent_commit with a flag to indicate whether we're
committing from a synchronized parent or not - this was used for
determining if a subsurface was effectively synchronized.
Now that we know whether a subsurface is effectively synchronized, we
can drop the parameter.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This was used to check if a subsurface was effectively sync,
and we now have a bool to check for that instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Keep track of subsurface effective sync status when it changes instead of
figuring it out when we need to know it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Create a common weston_surface_apply() for both subsurface and normal
surfaces to push state through, as this will let us remove a bunch of
common code in the future.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Continuing to make a split between "commit" and "apply" in preparation
for a future where the application happens later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We'll eventually have a hard split between the commit and the application
of state, so rename this function to better indicate what it does.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Use the shared helper in order to avoid duplication. This will also
ensure that any format added to the test will also be usable by other
tests and clients.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Factor out client-buffer creation into a helper library in order to
avoid duplication. This notably allows clients and tests to easily reuse
the dmabuf and yuv logic.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Historically, weston-screenshooter attempts a capture on all
wl_outputs, and if any output fails to capture it exits immediately.
These days it's possible to set up the pipewire backend to mirror
a drm backend output. This leads to surprising behaviour if one
tries to screenshot while no pipewire client is in use. Since the
pipewire backend has no buffer to render into at this point, the
screenshot fails. The drm screenshot is then dropped on the floor
because one of the wl_outputs failed to capture.
Avoid this for now by just continuing in the case of such
"graceful failures". Though maybe in the future we should allow
picking a wl_output by name, or have a command line switch to
decide whether to stop after a failure or not.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If there's no running connection, we can't capture, so just burn down any
waiting tasks so we don't assert later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Listen to the capture destroy signal so we can prevent the async fd
source from causing a UAF.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
An output task may be destroyed by a client disconnect. This causes
problems for our drm backend's asynchronous capture task handler, which
currently has no way to notice this.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
No functional change.
This will help to keep the code more straightforward when
parametric<->ICC color transformations are added, and they need more
operations than just the cmap_3dlut for the 3D LUT.
Particularly, there will be a new flag telling if cmap_3dlut is
populated, and the flag is best set in init_icc_to_icc_chain() instead
of xform_realize_chain().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When crafting an ICC to ICC color transformation, all the steps in
weston_color_transformation are at disposal. In the future also
parametric<->ICC color transformations will be crafted using the same
ICC chain machinery. However, there some steps must be reserved for
additional operations.
Add a bit mask that tells which color steps can be used by
xform_realize_icc_chain().
Unfortunately the mask is most conveniently stored in struct
cmlcms_color_transform. The LittleCMS context user data is the only good
way of passing our own bits into the factory code, but the user data
cannot be reset without destroying the context. It is probably not safe
to destroy the context as long as we have any LittleCMS objects alive
and created in that context. Hence, the user data must out-live the
LittleCMS context.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I will be adding a MAPPING value, and it would look odd without any
prefix. This adds a bit of namespacing.
The definition is moved to the header, because I will be needing it in
struct cmlcms_color_transform.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Split init_icc_to_icc_chain() into two parts:
- init_icc_to_icc_chain() is specific for ICC to ICC transformation
- xform_realize_icc_chain() can process any chain of cmsHPROFILEs
xform_realize_icc_chain() will be used by ICC-to-parametric and
parametric-to-ICC transformations in following commits.
No changes to functionality. 'extra' local variable is lost as unused.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I will be splitting this function, and xform_realize_chain() matches the
parts I'm going to split out of it, while the remainder will be specific
to icc-to-icc transformations.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
In this patch we allow offloading the post-blend color transformation
to KMS.
As KMS currently only supports to offload the transformation in a LUT,
this may result in precision issues. So this introduces the config
option "offload-blend-to-output", which is disabled by default.
This option requires "color-management" to be enabled, otherwise it is
ignored.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
We already get the core section a few lines above, and no other call
get_section() call are made in between.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This is a leftover from "color: do not use color steps for non-optimized
pipelines". If a xform don't have valid steps, it shouldn't have curves.
So this function should fail.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
At this point, the DRM/KMS API supports offloading post-blend color
xform only through LUT's. This is not ideal, and an API to improve that
should be proposed in the future.
But we still want to experiment with offloading pre-blend (not post)
color transformation through the colorop API, which is close to being
accepted upstream. But this requires us to offload post-blend as well.
weston_color_curve_to_3x1D_LUT() currently fails if we detect that
crafting a LUT from the color curve may result in bad precision.
Instead, let's add a boolean param to control if we forbid or not bad
precision. This should allow us to offload post-blend xform through
LUT's.
This also improves the error messages in this function.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Since commit "backend-drm: improve code that chooses output->format", we
changed how b->format (the GBM format from the config file) is used.
There are config options in weston.ini that allow us to ignore the GBM
format set. So what matters to us is which output->format is being used,
and we compute that in drm_output_pick_format_egl() and
drm_output_pick_format_pixman().
So remove these checks that disable underlay planes based on b->format,
keeping only the ones that depend on the output->format selection.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Instead of picking an arbitrary format, let's first ensure that the
format is supported by the renderer.
Also, start choosing formats with alpha channel if we have b->underlay.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This function is required for producing color transformations from
parametric image descriptions.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
In the next commit we introduce a real "renderer-only" mode. So let's
rename DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY to
DRM_OUTPUT_PROPOSE_STATE_RENDERER_AND_CURSOR, as it also assign views
to cursor planes.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Bump the tag to trigger container rebuild to include new kernel and also
ci-templates updates.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
When the same buffer is reused for both the first and second screenshot,
this can result in a deadlock. Avoid the issue by using a new buffer for
the second screenshot.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Use the FDO_CI_BASH_HELPERS functions from ci-templates to format the
gitlab ci logs for build-and-test.sh. This adds collapsible sections to make
the overall log easier to read.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Move the script from the build-and-test job to a separate bash file.
This makes it easier to read the .gitlab-ci.yml file and to edit the bash
script.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Use the FDO_CI_BASH_HELPERS functions from ci-templates to format the
gitlab ci logs for build-deps.sh. This adds collapsible sections to make
the overall log easier to read.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Update the ci-templates so that the ci tests can use new template
features such as gitlab log formatting.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
CONFIG_DRM_KMS_FB_HELPER was removed in v5.14, it doesn't hurt to have
it here, but removing it makes the code clearer.
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
When resizing the outputs, re-create the background and relayout the
views according to the (newer) output dimensions.
This is a common feature amongs our shells, so do this for lua-shell as
well.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
There was an old kernel bug where the drm driver could give us a stale
timestamp. We worked around this by performing a page flip at the
start of the repaint loop.
Now that we support VRR, when we don't render our refresh rate drops to the
display's lowest possible refresh rate. This leaves us with a race where
the repaint loop could be started between the mode's refresh rate and the
lowest possible VRR rate - which is indistinguishable from a stale
timestamp. In this case we'd perform a needless page flip and potentially
miss an opportunity to render.
The kernel bug was introduced in v3.16 in commit 844b03f27739135 and later
fixed in v4.1 in commit fdb68e09bbb1c98
Since the vrr_capable property was introduced in v4.20 in commit
ba1b0f6c73d4ea1, any kernel that supports VRR is new enough not to give us
stale timestamps, so we don't have to miss these opportunities.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Initial support for dmabuf renderbuffers, based on the GL renderer
implementation.
This enables Vulkan renderer to use the pipewire backend with dmabuf.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Rework the dmabuf import Vulkan code so that it is possible to reuse
a single routine across the DRM backend gbm import and dmabuf client
import.
This is will also make it possible to reuse it for dmabuf renderbuffers
as a follow-up.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Decouple render_fence_fd from the DRM output, in particular so that
it is allowed in headless outputs (for upcoming dmabuf renderbuffers).
Also simplify the code to make it clear that it is handled per-output.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
For swapchain outputs, in some cases it is possible that a frame becomes
available by its fence but the last used swapchain image has still not
been returned to the swapchain. If the render_done semaphore is part of
the frame struct it will be reused and cause a validation error.
To prevent this from happening, move the render_done semaphore to the
image struct so that each of those semaphores is only used when the
associated image is safely acquired from the swapchain.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
In some cases it is possible that a frame becomes available by its
fence but the last used swapchain image has still not been returned to
the swapchain. If the render_done semaphore is part of the frame struct
it will be reused and cause a validation error.
To prevent this from happening, move the render_done semaphore to the
image struct so that each of those semaphores is only used when the
associated image is safely acquired from the swapchain.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
This is a trivial change to allow passing a user-defined color to
specify the color for the placeholder.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Every .c file in RDP-backend hits this:
cc -Ilibweston/backend-rdp/rdp-backend.so.p -Ilibweston/backend-rdp
-I../../git/weston/libweston/backend-rdp -I. -I../../git/weston
-Iinclude -I../../git/weston/include -Ilibweston
-I../../git/weston/libweston -I/home/pq/local/include
-I/usr/include/pixman-1
-I/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/freerdp3/
-I/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/winpr3
-I/usr/include/libdrm -fdiagnostics-color=always
-fsanitize=address,undefined -fno-omit-frame-pointer
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -Werror
-std=gnu11 -O0 -g -Wmissing-prototypes -Wno-unused-parameter
-Wno-shift-negative-value -Wno-missing-field-initializers -Wno-pedantic
-Wundef -fvisibility=hidden -Wmissing-prototypes -Wno-unused-parameter
-Wno-shift-negative-value -Wno-missing-field-initializers -Wno-pedantic
-Wundef -fvisibility=hidden -fPIC -MD -MQ
libweston/backend-rdp/rdp-backend.so.p/rdp.c.o -MF
libweston/backend-rdp/rdp-backend.so.p/rdp.c.o.d -o
libweston/backend-rdp/rdp-backend.so.p/rdp.c.o -c
../../git/weston/libweston/backend-rdp/rdp.c
In file included from /usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/freerdp3/freerdp/client/rdpgfx.h:28,
from /usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/freerdp3/freerdp/gdi/gdi.h:34,
from /usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/freerdp3/freerdp/freerdp.h:35,
from ../../git/weston/libweston/backend-rdp/rdp.h:32,
from ../../git/weston/libweston/backend-rdp/rdp.c:37:
/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/freerdp3/freerdp/codecs.h:93:9: error: ‘codecs_free’ is deprecated: [since 3.6.0] Use freerdp_client_codecs_free [-Werror=deprecated-declarations]
93 | WINPR_DEPRECATED_VAR("[since 3.6.0] Use freerdp_client_codecs_new",
| ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/winpr3/winpr/winpr.h:22,
from /usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/winpr3/winpr/stream.h:26,
from /usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/freerdp3/freerdp/freerdp.h:25:
/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/freerdp3/freerdp/codecs.h:91:47: note: declared here
91 | FREERDP_API void codecs_free(rdpCodecs* codecs));
| ^~~~~~~~~~~
/usr/lib/x86_64-linux-gnu/pkgconfig/../../../include/winpr3/winpr/platform.h:497:41: note: in definition of macro ‘WINPR_DEPRECATED_VAR’
497 | #define WINPR_DEPRECATED_VAR(text, obj) obj __attribute__((deprecated(text)))
| ^~~
cc1: all warnings being treated as errors
Looks like there is a magic define that fixes this, as we are not using
the deprecated things to begin with.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Which is the correct place for them.
Currently they cause warnings like:
```
/usr/include/libdrm/drm_fourcc.h:389:9: warning: ‘DRM_FORMAT_S010’ redefined
```
with libdrm >= 2.4.125.
Fixes: 3dce9e8c2 (pixel-formats: Add Sx1x software decoder formats)
Signed-off-by: Robert Mader <robert.mader@collabora.com>
The loop in notify_key() that traverses the keyboard keys array has been
improved by adding a break statement after removing a key and simplifying
the loop structure. This eliminates unnecessary iterations and removes
ambiguity in the code flow, making it both more efficient and clearer.
Signed-off-by: Taehyeon Jeong wxogus25@gmail.com
It's a count, so it's not a bool. Luckily the only counts ever assigned
to it so far were 0 and 1.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If the offset was negative, there would be no space between the columns:
Matrix
1.0025 0.0000 0.0000-0.0012
Add the space.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Removes repetition and makes weston_color_profile_params_to_str() a
little more concise. Eases changing the xy number formatting next.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
These can be much more terse and still remain completely readable,
improving debug prints' readability.
Only one place needs to explicitly mention it's about primaries, the
rest are already evident.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
In the future parametric<->ICC color transformations will be a thing.
Clarify that the printed pipeline is just the ICC-to-ICC part of it.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Several places that print this string already include "transfer
function", so there is no need to say it twice. The one place where it
is needed is fixed accordingly. Other places already imply it enough.
This shortens the prints without losing anything.
A few descriptions are improved to help understanding.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
As otherwise we might trip because the output might be not available.
Fixes: cda8de1089 ("backend-drm: Count and display KMS page flips")
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Set the shared output's Weston output reference before obtaining
the registry from the parent display. Ensures proper access to
output context during registry event handling.
Also prevent weston_seat_init when shared output lacks a compositor,
avoiding crashes on invalid initialization.
Signed-off-by: Pablo Saavedra <psaavedra@igalia.com>
weston_surface retains a pointer to its associated output, but if the
output is destroyed, the pointer becomes invalid. In set_fullscreen(),
weston_shell_utils_get_focused_output may return this stale output via
weston_keyboard, leading to a use-after-free crash.
This change ensures the output reference is cleared when the output is
destroyed, preventing potential crashes.
Signed-off-by: zhou liang <liang.zhou@gehealthcare.com>
To prevent configure_idle from being called again by wl_event_source_remove,
now set configure_idle to NULL inside its handler function. This ensures
the idle source won't be removed multiple times if the handler is called
again.
Signed-off-by: zhou liang <liang.zhou@gehealthcare.com>
This was changed in 75280d2e40 but only
updated in the weston CLI help. But there's still documentation leftover
in .ini files and manpages that refer to the older flag.
Signed-off-by: Joshua Goins <joshua.goins@kdab.com>
This patch introduces a new cmd line option, namely `--debug-scopes`
(or shorthand `-d`) to limit which debug scopes are being advertised
over the westond-debug protocol.
To avoid tedious work to make this work in the same time as `--debug`, a
boolean type of option which doesn't accept any other entries, I've
decided to have a dedicated string cmd line argument.
If passing `--debug` all debug scopes are advertised by default
(keep the same behaviour). If you'd like to limit which of those scopes are
advertised, use the -d and only that one those scopes be advertised.
Pass these as a command-separated list.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This introduces a new list that is being checked up when advertising
or when the client attempts to bind a debug scope.
This would allow for a way in which the frontend can determine which
debug scopes the weston-debug protocol can advertise or the client
using the protocol can bind to.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
If not libseat-debug scope is not set we would hit an assert, and
we might have a legitimate case where we don't want to have it enabled.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
As further weston_log_subscription_iterate implicitly assumes we can
create one, and that might not be always the case.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
We might not want to enable these scopes always so don't limit
the GL-renderer availability based if these are enabled or not.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
lua-shell is a new meta-shell for Weston. It does nothing in and of
itself, but is defined to be user-scriptable and configurable. A
supplied Lua script will be interpreted and executed by Weston, allowing
full control over window management in response to events.
This includes a shell.lua example script which behaves as a tiling WM.
Co-authored-by: Michael Tretter <m.tretter@pengutronix.de>
Co-authored-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Add a function to move a view in front of a layer entry, so we can easily
add this functionality to lua-shell in a future commit.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
I don't know when this was improved, I just noticed that we can reduce
the tolerance here.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The sRGB expected display behavior uses the pure power-law with exponent
2.2, not the two-piece sRGB transfer function.
cmsCreate_sRGBProfileTHR() used the two-piece TF, now we use the proper
display TF.
This is particularly meaningful when implicit sRGB content is converted
to HDR formats, in order to maintain the stimuli reproduction near zero.
cmlcms_send_image_desc_info() is already sending this, it doesn't need
fixing.
Changing the curve also changes the error tolerances. The change is
theoretically a no-op, but the curve and its inverse and temporary
rounding add error. The new curve is more prone to error, so it is not
surprising we need to raise the tolerance. The color transformation does
end up as power-2.2 analytical form and I do not think it is ever
lowered to a LUT in alpha-blending test, so there is no obvious fix
improving the accuracy. The worst case point in alpha-blending still
occurs at the very same point as before.
The test reference images are updated for the same reason, they would
fail otherwise.
Both alpha-blending and color-icc-output contain the same sRGB-optical
sub-test, hence the same error tolerance.
It is surprising to have to increase the ICC roundtrip error tolerance
in color-icc-output test, given that the curves are passed as parametric
to LittleCMS, and adobeRGB case works with the old tolerance even. I did
not investigate further.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Refactoring data about a thing into one place to simplify code.
Also this function is never expected to fail, so no need for the boolean
return.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Collect all information of an item into a table entry in one place. Will
be easier to add new items this way.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The sRGB display uses a power-2.2 transfer characteristic. These enum
values refer to the two-piece sRGB transfer function instead, so they
should not be named "EOTF".
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When I was changing the stock sRGB profile from the two-piece TF to the
power-2.2 TF, all CLUT tests in color-icc-output started failing. It
appeared that cmsSmoothToneCurve() caused an already monotonic curve to
become non-monotonic, and then failing its own monotonicity test. I can
only guess that it might have something to do with the power-2.2 curve
having nearly zero derivative near zero.
As a workaround, check if the curve is already monotonic and don't
bother smoothing in that case. This allows the tests to pass in the
future where the sRGB profile has been changed.
OTOH, increasing smoothing_param up to 10.0f still did not help.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
As DRM_FORMAT_P030 was introduced in some later libdrm (2.4.114)
version add a fallback for it to allow building on systems which do
not have that libdrm version.
Fixes 4f4011d79e ("pixel-formats: Add P030")
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
As spotted in the wild, building without Vulkan still picks up
Vulkan headers. This drops the VkInstance alltogether as that's not
really used.
As this file appears to be pulling XCB headers guard them as well.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
When I changed the weston_matrix implementation to linalg-4.h, I broke
the type computations: they were getting reset instead of accumulated.
This manifested with the desktop-shell feature where one can arbitrarily
rotate the windows. A rotated window triggered an incorrect matrix type,
which then did not ignore the surface opaque region as it should have.
That caused rendering artifacts on all renderers.
Fixes: 3fefb5ba44
Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1031
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It has no more callers, and hasn't done what its name implies for a very
long time.
Remove it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
weston_view_damage_below() does nothing but schedule a repaint, and a
repaint will be scheduled in weston_view_geometry_dirty_internal() anyway,
so remove the extra call.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of calling weston_view_damage_below(), which only schedules a
repaint, call weston_view_schedule_repaint() instead.
The result is the same, but the code is less confusing.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Update transform only does something if we've called
weston_view_geometry_dirty_internal() previously to set the dirty flag.
weston_view_damage_below() just schedules a repaint, and
weston_view_geometry_dirty_internal() will already have done that.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
weston_view_damage_below() has done nothing but schedule a repaint for a
long time now.
weston_view_destroy() will trigger the repaint without forcing it here.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
kiosk-shell/xdg-shell is the (more) modern approach, so let's inform
users that fullscreen-shell is going way.
This also adds an explicit dependency of shell-fullscreen for
screenshare. With this change, both screenshare and fullscreen-share
are disabled by default.
Fixes: #848
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
There is no valid reason for anyone to call this.
True surface damage is already handled when surfaces are committed. View
damage is already handled through any per-view manipulation which would
generate damage. There is thus no reason for anyone to ever call this.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The content-protection state is a property of the output, as it affects
quite a bit of output state, as well as things like whether or not
recording is possible.
Instead of damaging surfaces for content-protection state changes,
damage each output for which the protected surface is relevant.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When we change the subsurface order, the surface itself has not received
any damage: what's been damaged is the views. Place the damage where it
should be, as the act of moving the view within the view list is where
the damage originates from.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This already calls either weston_view_add_transform() or
weston_view_remove_transform() followed by
weston_view_update_transform(), the combination of which will already
force a repaint for those views.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This already calls weston_view_geometry_dirty_internal() and
weston_view_update_transform(), the combination of which will already
force a repaint for those views.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This already calls weston_view_geometry_dirty_internal() and
weston_view_update_transform(), the combination of which will already
force a repaint for those views.
Signed-off-by: Daniel Stone <daniels@collabora.com>
These already call weston_view_geometry_dirty_internal() and
weston_view_update_transform(), the combination of which will already
force a repaint for those views.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Add the Vulkan renderer in the pipewire backend renderer switches.
For now this goes over the pipewire memfd path.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
The captured buffer cannot be just memcpy'ed to the destination as
it might overwrite existing pixels outside of the capture region.
For now switch it to a pixman composition.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
When xdg_toplevel_send_configure is executed, the xdg_toplevel resource
may have already been destroyed, causing Weston to crash.
Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
Adjust the no-GL jobs to also do no-Vulkan and only create a couple more
to cover disabling the individual renderers.
Copy the hack for obscure LLVM leak reports so that tests can pass in CI
with lavapipe for a Vulkan driver.
Disable vulkan-renderer build on debian lts for now as unsupported.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Example to serve as a reference of a basic Wayland client using
Vulkan with dmabuf. This does not use a traditional Vulkan swapchain
but implements it using imported gbm buffers. Also features use of
linux-explicit-synchronization-unstable-v1 with Vulkan.
Based on weston-simple-dmabuf-egl.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Example to serve as a reference of a basic Wayland client using
Vulkan, contained in a single source file and with a minimal set
of dependencies.
Features incremental present (similar to swap_buffers_with_damage
from EGL) which is not commonly used by other Vulkan demos and is
useful to test the compositor.
Based on weston-simple-egl.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
A Vulkan renderer for weston, based on the GL renderer.
The goal is to impose the least requirements as possible on Vulkan
implementations, as to allow even Vulkan 1.0 (or early development)
drivers to run a Wayland compositor. Any additional features or
extensions are made optional if possible.
Currently supports drm, wayland, x11 and headless backends.
As of this implementation, this is still considered an experimental
renderer.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
None active window might be interpreted from an X point of view as a
transient focus state, and is used by multiple X window managers when
a temporary focus change is in progress, or simply when grabbing the
keyboard.
From Wine side, we translate any active window change to the Win32
application, and handling None active window as an actual window
deactivation and focus loss creates spurious events and an undesired
feedback loop, as apps might react to it.
We still want to be able to detect actual focus loss under an XWayland
session, and having XWayland window manager focus an actual X window
instead will make the distinction possible.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
This just moves gl-borders up to libweston weston_renderer as-is,
with no change in functionality.
This is a preparation step so that other renderers can use the
same interface.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Containining the pre-compiler conditionals inside tiny functions makes
the code easier to read.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
These cases were never meant to exist, but because the harness assumes
all tests must run on all fixtures, we have to return something.
This is a temporary measure to improve readability. Eventually this test
program should be split:
- shm RGB + YUV
- dmabuf RGB without force-yuv-fallback
- dmabuf YUV with and without force-yuv-fallback
or
- shm RGB + YUV
- dmabuf RGB + YUV without force-yuv-fallback
- dmabuf YUV with force-yuv-fallback
or
- shm + dmabuf; RGB + YUV without force-yuv-fallback
- dmabuf YUV with force-yuv-fallback
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The implementation got removed already and we can just check
the color_model now.
Fixes: 51ed256d (libweston: Replace pixel format's sampler_type with color_model enum)
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Forcing the fallback paths for YUV formats. This will allow us
to test these paths on CI now that llvmpipe supports all tested
formats natively.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Update a comment explaining what we may do in the future when
cmsSmoothToneCurve() fails.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
If we're shutting down, moving surfaces to a different output will not
be profitable. Just clear out the output mask entirely and return early.
This specifically avoids the following issue seen with the Wayland
backend when shutting down:
- outputs destroyed
- colour manager destroyed
- seats destroyed
- pointer destroyed
- sprite view destroyed
- find new output for the sprite view
- update colour profile for the sprite view
- neither the view nor the compositor has any outputs left
- try to use the stock sRGB transfer
- oops, no colour manager
Signed-off-by: Daniel Stone <daniels@collabora.com>
Since "color: do not use color steps for non-optimized pipelines",
WESTON_COLOR_MAPPING_TYPE_3D_LUT became unused. So drop it from our
code.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
For non-optimized pipelines, stop using the color steps (pre curve,
color mapping and post curve). Instead, make use of the
xform->to_shaper_plus_3dlut() vfunc.
In this patch we add a bool to signalize that the steps are valid (for
optimized pipelines) or not. If not (non-optimized ones), the vfunc must
be used.
This brings flexibility for the renderer/backend implementing the xform.
For now we only implement xform's in the GL-renderer, and this has no
behavior changes. It should be relevant when we implement the xform in
our DRM-backend, see commit "color: add to_shaper_plus_3dlut() vfunc to
struct weston_color_transform".
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This function allow us to get a shaper (3x1D LUT) + 3D LUT that is
equivalent to a certain xform.
With that, we allow backend/renderer that are not capable of handling
the color steps of the xform to fallback to something else.
E.g. when we introduce the code to offload color xform to KMS using the
DRM-backend, we'll depend on the driver/hardware implementing the color
steps. With this patch, DRM-backend should be able to fallback to a
shaper (3x1D LUT) + 3DLUT, color operations that should be commonly
supported by drivers/hardwares.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Up to now, when we were able to optimize a color pipeline, we'd delete
xform->cmap_3dlut. In such cases, we'd have a pre curve, color mapping
and post curve that Weston recognizes and implements in the shaders. So
there was no need to use xform->cmap_3dlut.
But at some point we'll try to offload such color transformations to our
DRM-backend, and we are not in control of what color operations the
hardware/driver are capable of. In such case, we may want to use the
fallback LCMS xform (xform->cmap_3dlut) and decompose it into a shaper
(3x1D LUT) + 3D LUT, as such operations should be commonly supported
by hardwares/drivers.
This shows that using the optimized pipeline or not should be a
renderer/backend decision. So do not delete xform->cmap_3dlut even when
we optimize the pipeline.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Change this function signature to look similar to
gl_color_curve_lut_3x1d(), as they do similar things.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
We are filling a struct gl_renderer_color_mapping in this function,
so rename to better reflect that.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This test has only supported the GL renderer, with a must pass list of
formats which matches what the GL renderer advertises and supports.
This commit prepares the test to support other renderers by moving the
must pass list to the test setup declaration, so that it can be defined
per renderer. This is in preparation to add more renderers here as a
followup.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
As I found myself writing these for a MR think it would better
to have to easily available to point people to.
Another small change is that since c706e1f8c8 we no longer
default subscribe to drm-backend for the flight recorder so update docs
as well. Combined with this new file should actually explain better how
to make use of it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
And make use of it in kiosk-shell-test. There's no functional change,
this is for other shells to re-use the code here.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Now that color mapping matrix in GL-renderer supports an offset, allow
merging and translating matrix stages with offsets.
color-icc-output test is already hitting these new paths with the
sRGB->sRGB CLUT fixture (number 6), hence new tests are not needed.
Previously, after optimization the pipeline still contained 3
consecutive matrix stages. Now, those three are combined into one.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Add a new header for colorimetry stuff. Adding more things in
libweston.h doesn't feel good, they drown in the sea of everything.
Pure refactoring, no changes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Add a status return value to every test definition. There are no
behavioral changes, previously the RESULT_OK was simply assumed.
The benefit of this is that in the future individual tests can also
return RESULT_SKIP, so that we can keep statistics of skipped tests.
ivi-layout-internal-test.c has the only case where a test function may
return early. That one is set to return RESULT_HARD_ERROR to match the
compositor exit code already there.
Also documentation is updated.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Using the udmabuf allocator which is usually available these days,
both on CI runners and dev mashines. The buffers have the the same
content are tested against the same reference images as in the shm
case.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Allow querying supported formats and modifiers.
We use version 3 as it is easier to implement and also works
if no main device is present - such as when using llvmpipe.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
So we can test them on CI. For completeness and because they
are commonly used by SW decoders.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Add stride alignment support make various cleanups in
order to support both shm and dmabufs. No changes in
test results intended.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Similar to 0ff5ac0f7b, "desktop-shell: Add a placeholder curtain on
new outputs", to address the 68761d3f11, "compositor: Ensure the
scene graph isn't empty at repaint".
This is needed to allow ivi-shell to start-up otherwise we hit the
assertion introduced with 68761d3f11.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Fix a typo that caused test results to not be found. This adds them back
to the MR and pipeline Gitlab pages.
Fixes: 68fd41a719
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This consolidates the parameter unpacking for the two types of
parametric curves. The goal is code that reads better.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Using more structured types allows removing one of color_pre_curve() and
color_post_curve() completely, reducing code duplication.
Ideally I would have wanted to use a single type for a curve, having
both lut and par in it, but I am not sure the unused half would still be
eliminated during compilation.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reduce pasta, reads better.
Shame that the string manipulation is so cumbersome. All strings are
hardcoded literals though, so the assert is good enough.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The output resized signal sends a struct weston_output as the data, not
a struct weston_head.
Fixes 197c5e0084
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If the view has become unmapped, the weston_desktop_surface should still
be unreferenced, otherwise it'll be leaked until the client disconnects.
Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
In my haste to fix a crash in kiosk-shell, I made it potentially put
surfaces on wrong outputs instead.
Fixes e1ac6139ca
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Add asserts the same as what the color mapping 3D LUT uses, for
consistency since both implement a LUT with the same principles.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The frequency of checking remaing the same, but we can use an already
needed switch statement and do not need one just for the asserts. This
makes gl_shader_config_set_color_transform() nice and short.
The MAPPING_MATRIX assert was useless, the variable is set right above.
Asserting the mapping type is valid happens already in
gl_shader_load_config_mapping().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The new function parameters acts as shorthands, making the moved code a
little more concise. It also gains an assert for an invalid mapping
type, which previously would have been awkward to code.
gl_shader_load_config() becomes easier to read.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is both more consistent with other embedded unions, and it allows
to pull the union out into its own named type in the following patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This will help reducing the duplicate open-coding of pre- and
post-curves in the following commits. This is also a step towards
eliminating the duplication between struct gl_shader_config and
gl_renderer_color_transform.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace a plain array with a type-safe documented structure.
This will get more wide use later.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Rather than using a two-dimensional array, provide names to the fields.
The fields are primarily used by their names, but we also need the data
as a flat array of floats, so use unions to achieve that: two different
views into the same data.
This makes the code more self-explanatory. In color-operations.c it
removes a handful of temporaries. Comparison in color-properties.c is
simplified. ARRAY_COPY() turns into an assignment.
MAX_PARAMS_PARAM_CURVE is eliminated. Instead of having to maintain a
copy in fragment.glsl, the definition there is automated.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This helps me with VScode when clangd doesn't claim this header to be
full of unknown stuff.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The output can be NULL, so that must be tested before looking up the
shell_output from the output.
Fixes 77dcbe381f
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When weston tries to update drm head info, if the connector is disconnected, it cannot get the connector's property.
If get connector's property failed, drm_connector_assign_connector_info returns -1 and head->connector->conn, head->connector->props_drm remain to be nullptr, but they are used in update_head_from_connector, so the crash occurs.
So just return ret when drm_connector_assign_connector_info returns -1, and head->connector, head->connector will not be used later.
Signed-off-by: xufeng wang <550002860@gehealthcare.com>
Some external API's (e.g. DRM/KMS) are not capable of dealing with
enumerated color curves. In such cases, we may need to create LUT's that
correspond to such curves and give them to such API's
So add function weston_color_curve_to_3x1D_LUT() to craft 3x1D LUT from
a color curve.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
When we create a parametric color profile (we still do not fully
support, but plan to), a struct weston_color_tf_info is created.
So add a new function weston_color_curve_from_tf_info() to create a
color curve given a transfer function.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Since "color-lcms: recognize LCMS curves that matches transfer
functions", a few function names became slightly outdated. Rename them.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
LittleCMS curves contain curves that are parametric. They may be
well-known curves, and we are not checking that. If that's the case,
we should create enumerated color curves, instead of parametric.
This can be helpful for renderers and/or backends that want to implement
the curve, as they may have access to an API that accept enumerated
curves.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Not all color curves comes from parameters. For instance, with the
CM&HDR protocol users can set color curves from tf_info.
So let's add a new curve type to accommodate that.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This just makes the code more readable and should help us to avoid
mistakes in the future. No behavior changes.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Follow-up of "color: define max number of params for parametric curves
and tf's". Let's do the same for LittleCMS parametric curves.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Up to now we were using 10 as the max number of params for color curves
and transfer functions. But this came from LittleCMS, whose parametric
curves may contain up to 10 params.
But out color curves and tf's are not tied to LittleCMS, so let's define
constants to help avoid confusion.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
weston_global_destroy_save() can directly destroy a global if the
compositor state is WESTON_COMPOSITOR_OFFSCREEN.
Make sure we don't try to set_user_data after this has happened.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
With udmabuf we can write test for dmabuf paths in a similar
manner to shm. It's available by default in most recent distros
and thus works OOTB on developer setups.
Drop vgem as it isn't needed any more and makes the CI use
kms_swrast (instead swrast), which isn't compatible with the
llvmpipe dmabuf implementation yet.
Using swrast also streamlines CI with running tests locally,
making debugging easier.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
llvmpipe now supports EGL_EXT_image_dma_buf_import, allowing
us to test zwp_linux_dmabuf_v1 on CI.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
We have the following error message in parse_color_characteristics():
name=%s: reserved name. Do not use ':' character in the name.
It gets confusing when "name" ends with ':'. So rephrase it to clarify
the error message in such case.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
First of all, we make it work for NaN CIE xy values.
We also improve the error message a bit. It was only printing that the
color gamut was invalid, but it didn't explain why. This adds the
explanation (out of valid range).
And finally, we make the code a bit shorter.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The internal API to create parametric color profiles should be available
not only to libweston, but also to frontend. WL_EXPORT was missing from
the functions, so add that.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Assert that the search param structure is well-formed, so that there
won't be cache misses due inconsistent fields.
Anything called from inside cmlcms_color_transform_get() can skip
asserting these.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is a nice clean-up.
The parameter-based color profile is actually fully formed. The problem
of using it is dealt in the next patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Split the create function into two parts, allocation and finalization.
All ICC-specific code is moved into callers, so that the parameter-based
profile creation can start using alloc/register too.
cmlcms_color_profile 120 bytes, so it's unlikely we could ever deal with
that allocation failing - don't even try.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
While no-op does not support these, other color managers might. Change
the wording so that the user does not think that Weston does not support
these at all.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
drm_output_propose_state() is called during from drm_assign_planes(). At this
point, the output is enabled, but it may be disabled in the current state, that
is copied.
So explicitly enable the output by setting dpms to WESTON_DPMS_ON.
The same thing is already done in drm_output_repaint() but that's to late for
drm_output_propose_state(). Move that to the fallback path when planes are
disabled. It's no longer needed in general and changing the state between the
atomic test and commit is not a good idea anyways.
Without this, the atomic commit may fail, even though the corresponding test was
successful.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Slight oversight of counting page flips from within the atomic commit
handler when we don't really have an output. Do that after *after*
checking for a valid output.
Fixes: cda8de1089, ("backend-drm: Count and display KMS page flips")
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
When the 1st frame of the X11 backend is rendered by the GL renderer,
an invalid call to glBindTexture() with a target of 0 is emitted. This
is because the border status of the window renderbuffers are flagged
dirty while the border status of the output state is not. This commit
ensures that the output state and the renderbuffers border status are
dirty by default. It also enforces the creation of output border
textures even though no valid data have (yet) been passed, in which
case the textures are filled with transparent pixels.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This makes multiply_matrix_stages() handle offset vectors correctly, but
they will not apprear here yet, because
is_matrix_stage_with_zero_offset() forbids merging such matrices.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace an ad hoc 3x3 matrix, that was supposed to match LittleCMS matrix
but did not, with our new consistent weston_mat3f API.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This converts weston_matrix and weston_vector to use linalg-types
internally. All direct accesses to members had to be converted
everywhere, mostly in the simplest form possible which leaves some
trivially reducable code around.
The intention is that we can now gradually migrate away from
weston_matrix in the future.
Look like one trailing space got accidentally annihilated in
compositor.c.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
These are the same as linalg-4 cases, except the matrices have been
generated anew, and checked with Octave that the condition numbers and
determinant values hold.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
3x3 matrices, a straight-forward copy of libalg-4.h.
Useful for color computations and 2-D geometry.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
linalg-types.h can be used from e.g. libweston.h so that structures can
embed linalg types but without forcing every user of libweston.h to
compile all the inline functions.
weston_mat4f implements most of weston_matrix, and some more. This is
just for starters. Implementing weston_mat3fwill be essentially a copy
of all this.
The matrix inversion is a copy from weston_matrix with a little bit of
clean-up.
The goal is to create a more intuitive libear algebra API, that is easy
to extend to 3x3 matrices and 3-vectors, eventually superseding all
existing matrix code: weston_matrix, calls to LittleCMS matrix
routines (plugin API), and ad hoc matrix code in tests/.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The 24 bpp RGB and BGR SHM formats are meant to be stored little
endian, not big endian.
Fixes a regression in commit 815ccaff.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
As we exit early we never have the chance to mark it as is_direct when
the buffer type is direct_display.
This is required as is_direct is never checked in GL attach part we
end up tripping on invalid renderer_private causing it to assert.
Fixes 2db4f17244f, "compositor: re-order paint node placeholder checks"
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Found out in https://github.com/mm2/Little-CMS/issues/483
This should be a complete no-op change, but there is one difference.
Previously matrix_inf_norm() summed over rows. Now it sums over columns
as it should be. This shouldn't hurt because it is only used to identify
identity matrices. The bug was actually in is_identity_matrix_stage()
because it deliberately passed what was assumed to be a transpose of the
matrix.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Prior to executing a new command restore the parent process to the
default SIG_DLF handler as we normally use SIG_IGN it to avoid
crashing on pasted input.
As we seem to be hitting a Broken Pipe message when running
certain scripts, it seem we need to restore back the
default handler.
This is similar to what other folks have been doing in
https://github.com/labwc/labwc/issues/1209.
Fixes: #994
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This is required to avoid a namespace collision for LED_COMPOSE key
code and was introduced with c112760368, "input: Add support for
LED_COMPOSE and LED_KANA".
If not already done this requires a libweston major version bump.
Fixes: #997
Fixes: c112760368, "input: Add support for LED_COMPOSE and LED_KANA
USB HID LEDs"
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
We get rid of a little bit of fallback code, but the real reason is that
in the future the frontend will start using libdisplay-info as well, and
this lets us avoid adding fallback code there too.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Frontend will be needing it, too, so move it up. In doing so, we make it
a mandatory dependency of Weston. This should be fine, because it was
required by DRM-backend which is the foremost.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
As the flight recorder subscribed by default to the drm-backend will
implicily arm the KMS page flip counter. Just use the "log", log scope.
To make this more obvious, with this change we also print the
subscriptions, when we detect that the flight recorder is enabled.
Users can use the provided cmd line args (-f/--flight-rec-scopes) to
adjust those.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
when drm-backend debug scope is set.
This follows-up with the surface counter timer but because this is
buried in the drm-backend we make use the drm-backend scope if there's a
subscription to it and enable and arm the counter as well when that
happens.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This patch counts the page flips (either in atomic or legacy page flips)
for DRM outputs and prints them using the drm-backend scope.
Similar to the frame callback timer counter this installs a counter that
periodically computes page flips per a pre-defined interval.
This also includes a perfetto counter to display these in perfetto.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Rather than having this timer always fire up & running, do it when we actually
enable debug, with the `--debug` cmd line argument.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Rather than using wl_surface::commit to count the frame rate, use the
painted frames for each paint node, and implictly the surface.
This happens in the output repaint paint node list parsing, and includes
also a perfetto counter to display it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This is a continuation of work from
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/24
This patch adds a surface callback frame rate counter to the scene-graph
debug scope.
The timer interval is set by default to 1 second. This use a timer to
periodically compute the current frame callback commits in that interval
as the surface frame rate per timer interval. Note that is solely based on
wl_surface::commit call.
Together with this, this patch also adds perfetto counter that stores
the same computed frame rate. This means the counter will be updated on
the next interval timer when the timer is armed/fired such that that
perfetto drawings will show up in a window period of time (interval).
Helpful to identify what frame rates clients achieve to debug
performance issues as to provide an objective common group. Using the
debug-scope aggregates all surfaces at the same place. This is not based
on the GPU whatsoever so it can also work on SHM type of buffers.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Changwoo Cho <changwoo.cho@lge.com>
This way we can use the same ID when for perfetto counters to allow
to identify clients much easier.
Also, renamed "surface" with "unlabelled surface" when get_label function
is not set.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Similar to what's just been done to kiosk-shell, use our internal
shell_output instead of directly using weston_output in our internal
structures.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Shells need to find their own internal structures for weston_outputs.
Let's make that process trivial instead of a list walk.
Add a getter and setter for this private data and use it from the kiosk
shell.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We end up doing some extra list walks and mildly awkward contortions to
find the kiosk_shell_output from the weston_output.
Store the kiosk_shell_output instead - it's always trivial to find the
weston_output from that, and it just seems a bit cleaner conceptually for
kiosk shell abstractions to point to other kiosk shell abstractions when
available.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Fixes the following UBSan error:
../../git/weston/libweston/id-number-allocator.c:140:16: runtime error:
left shift of 1 by 31 places cannot be represented in type 'int'
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
realloc() does not initialize the added memory, it needs to be zeroed
explicitly.
Not zeroing this memory had one severe consequence: if the new
lowest_free_bucket was 0xffffffff, weston_idalloc_get_id() would fail an
assertion.
Otherwise non-zero bits in the added memory would just cause id numbers
to be skipped unnecessarily, which does no harm.
Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1000
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
No functional change here other than asserting that next_num didn't wrap
around. This reorganization helps adding the code
needed to clear the memory added by xrealloc() in the next patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Setup a custom assertion handler that increases an assertion counter
instead of aborting on failure. This allows to run all the sub tests
defined for a test and to correctly report which sub test failed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
NDEBUG doesn't need to be catched anymore now that the test suite
don't use libc's abort() anymore.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit gets rid of libc's abort() usage in the test suite using
test asserts instead.
Asserts run in the server as plugins aren't converted because they are
shared between server and client.
Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
It's much more common to have bits defined as enums than having a
position, so let's just directly take a bit as argument to the bit
asserts. For the few cases where only the position is available, it's
easy to get the right bit using a shift.
The is_pow2_64() helper functions have been added in order to validate
the bit passed as argument and prevent programming errors.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit introduces various Weston based asserts for the testing
framework. The goal is to ease test writing and improve readability.
Using custom asserts instead of relying on libc's assert() will also
help providing NDEBUG builds. This is currently not possible because
setting NDEBUG would disable all the asserts in the tests.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
re-aligned the ivi_layout_interface structure in ivi-layout.c.
purely a formatting update, no functional changes were made.
Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
Implement new ivi_layout_interface method and signal to forward
desktop client ping timeout events for unresponsive client handling.
Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
A window freeze can occur in specific use cases like when using a kiosk
shell. It scales surfaces to fit the compositor size and the transformation
to buffer space can, in some cases, round the size one pixel higher than
the texture size, making glTexSubImage2D() refuse the size argument and
generate a GL_INVALID_VALUE without updating the texture.
This commit ensures the GL renderer doesn't exceed the texture size.
Here is how the issue was reproduced:
$ weston --renderer=gl --backend=wayland --width=1920 --height=1080 --shell=kiosk
$ gst-launch-1.0 videotestsrc ! video/x-raw,height=590,width=500 ! waylandsink display=wayland-1
Signed-off-by: Théo Maillart <tmaillart@freebox.fr>
When in VRR mode, repainting without a wait might happen instantly,
so do it.
This is likely not the best long term solution, but is ok for now
while weston's vrr support is experimental.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Query the vrr_capable property for heads, and expose it to frontends.
Currently we only support game mode VRR, but expose VRR capabilities as
an enum in anticipation of supporting QMS VRR in the future.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Formats using SHADER_VARIANT_Y_XUXV can now use SHADER_VARIANT_Y_UV
instead with swizzle variations in order to simplify the fragment
shader.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The sampler type, which was initially meant for the GL renderer, is
currently used to derive the color model of pixel formats. This commit
gets rid of this legacy field and replaces it with an explicit one
indicating the color model.
Note that it also fixes the issue that formats wouldn't be considered
YUV if ENABLE_EGL isn't defined because the sampler type field in that
particular case would always be 0.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Automatise variant and planes selection for legacy EGL buffers support
by using the global information from the YUV formats table and setup
texture swizzles for legacy EGL buffers and dma-buf.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This is a temporary solution to easily test wl_shm support for
different RGB formats. I think it would be better to have a dedicated
client to test all the supported RGB and YUV formats for the wl_shm,
dma-buf import and legacy EGL protocols.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Support more YUV formats using texture swizzles. Automatise wl_shm
format addition based on the format table using the new texture format
utility gl_texture_is_format_supported().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Add new formats supported by OpenGL to the pixel formats table: R16,
RG88, GR1616, RG1616, XRGB16161616 and ARGB16161616.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Support more RGB formats using texture swizzles. Automatise wl_shm
format addition based on the format table using the new texture format
utility gl_texture_is_format_supported().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Simplify fragment shader logic by getting rid of the RGBX variant
which can be implemented using texture swizzles instead.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
All the formats are declared as RGBA swizzled variations. Make the
BGRA8888 format do the same for consistency reasons as there shouldn't
be any performance impact for it.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The channel ordering system currently proposes to swizzle components
in the fragment shader for a few combinations. This commit replaces
this system with texture swizzling parameters in order to support all
the possible combinations in a more efficient way.
This will allow to easily add a lot more formats and as a nice side
effect to force components to 0 or 1, which is useful for opaque
formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OpenGL ES 3 adds support for texture swizzling parameters in order to
let graphics drivers efficiently swizzle R, G, B and A components at
texture look-up, with the nice feature of allowing 0 and 1 as
supported values.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Cache and update texture parameters only when changed by storing
minification/magnification filters, wrap modes and their target into a
dedicated gl_texture_parameters structure and by calling new utility
functions to create and flush parameters.
This structure is itself stored into the buffer state for each texture
of a surface and into the output state for border and shadow textures.
The shader config filled before emitting a draw call now just takes a
pointer to the array of texture ids, a pointer to the array of
parameters and the number of textures.
This allows to simplify the logic in gl-renderer.c, to minimise GL
state changes and to let the utility wrapper validate the parameters.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_EGL_image_storage provides a mechanism for creating texture
objects that are both EGL image targets and immutable. When available,
this makes the texture object target immutable, preventing
respecifications.
While adding support for that extension, it appeared that the
compositor calls attach_buffer() at every buffer updates and that the
texture object is each time respecified to the same EGL image. This
commit additionally prevents any respecification when
EXT_EGL_image_storage isn't available.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The parent surface may not be on a layer. In that case, remove all child
surfaces from their current layer as well.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This is purely cosmetic but we do this in other parts as well, when
releasing the GEM handles. Use the macro for no of planes as well when
going over them.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Turns out it seems we have a missed some spots when using the
weston-direct-display protocol.
Specifically we still seem to be attempting a dma buffer import which
ultimately can reach the GPU. This patch rectifies that in such a way
that we can actually provide a full scanout path for client's (dma)
buffers as to avoid hitting the GPU entirely.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This can end up being the first function to touch a surface in a flow,
which leads to confusing traces.
Just trace the function without a flow instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
headless_output_repaint() is not actually called immediately after
weston_output_finish_frame(): Weston waits for "frame-duration - repaint-window"
but at least one millisecond.
And renderning can also take an arbitrary amount of time.
So use weston_output_arm_frame_timer() like all other timer based backends. It
takes all of this into account and calculates the delay relative to the next
expected vblank time.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This tests out if libweston can be built with a C++ compiler and catch
potential issues which we don't normally see.
We re-use one of the builds, the full-x86-64 one, and build this new
front-end alongside it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
A new gl_format_info structure is added to the pixel_format_info
structure in order to store new GL format information (compatible with
Table 1 in gl-utils.c) for each supported format. There will be a
temporary duplication of GL format info in order to keep other parts
of the code not yet ported working. That will be removed later.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_format_BGRA8888 allows OpenGL ES implementations to
support GL_BGRA8_EXT FBO and texture format.
OpenGL implementations handle the spec differently regarding the use
of GL_BGRA8_EXT or GL_BGRA_EXT with TexStorage*D(), TexImage*D() and
RenderbufferStorage(). A recent revision of the spec (and Mesa)
clarifies all that, but in order to support most drivers we simply
check which method is supported by order of preference.
Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Before the creation of the EXT_texture_storage extension,
OES_required_internalformat used to guarantee minimal FBO and texture
precisions to OpenGL ES 1 and 2 implementations using sized internal
formats.
Note that new external format and type combinations (like for instance
GL_RGB and GL_UNSIGNED_BYTE for the GL_RGB565 sized internal format)
should be available when OES_required_internalformat is supported.
This isn't supported by this wrapper for now because of the implicit
conversion in gl_texture_2d_init() that forces a specific type when
EXT_texture_storage isn't available.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_type_2_10_10_10_REV allows OpenGL ES 2 implementations to
support GL_RGB10_A2 texture format.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
QCOM_render_sRGB_R8_RG8 allows OpenGL ES 3 implementations to support
GL_SR8_EXT and GL_SRG8_EXT FBO formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_sRGB_RG8 allows OpenGL ES 3 implementations to support
GL_SRG8_EXT texture format.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_sRGB_R8 allows OpenGL ES 3 implementations to support
GL_SR8_EXT texture format.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
APPLE_texture_packed_float allows OpenGL ES 2 implementations to
support GL_R11F_G11F_B10F and GL_RGB9_A5 texture formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
NV_packed_float allows OpenGL ES 2 implementations to support
GL_R11F_G11F_B10F FBO and texture format.
Note that GL_HALF_FLOAT should be available (the spec is a bit
confusing) as type combination with the GL_RGB external format when
both NV_packed_float and OES_texture_half_float are supported on
OpenGL ES 2. This isn't supported by this wrapper for now because of
the implicit conversion in gl_texture_2d_init() that forces a specific
type when EXT_texture_storage isn't available.
NV_packed_float_linear would require a new utility function to
retrieve whether a texture can be linearly interpolated by the texture
samplers or not. This hasn't been added for the other formats because
there's no users for now but this might be added later.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_color_buffer_float allows OpenGL ES implementations to support
GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_RGBA32F and
GL_R11F_G11F_B10F FBO formats. All of these are supported by default
from OpenGL ES 3.2.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_color_buffer_half_float allows OpenGL ES implementations to
support GL_R16F, GL_RG16F, GL_RGB16F and GL_RGBA16F FBO formats.
GL_R16F, GL_RG16F and GL_RGBA16F are supported by default from OpenGL
ES 3.2.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OES_texture_float allows OpenGL ES 2 implementations to support
GL_R32F, GL_RG32F, GL_RGB32F and GL_RGBA32F texture formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OES_texture_half_float allows OpenGL ES 2 implementations to support
GL_R16F, GL_RG16F, GL_RGB16F and GL_RGBA16F texture formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OpenGL ES 2 implementations support texture immutability and sized
internal formats using the GL_EXT_texture_storage extension.
Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Use glTexImage2D() instead of glTexStorage2D() and convert coloured
sized internal formats to base formats in order to support OpenGL ES
2.
Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Add gl_texture_is_format_supported(), gl_texture_2d_init(),
gl_texture_2d_upload() and gl_texture_fini() utilities. The creation
function accepts all the coloured sized internal format from OpenGL ES
3 using glTexStorage2D() to create immutable textures and reduce API
overhead.
Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Validate the colour-renderable sized internal formats passed to
gl_fbo_init() using a new gl_fbo_is_format_supported() utility. Sized
internal formats are now required. More formats will progressively be
added depending on the OpenGL ES version and the supported extensions.
Support for RGBA8 FBOs is now required by the GL renderer.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Avoid duplicating the inclusion of the GLES headers by including them
once in gl-renderer-internal.h.
Upgrade GLES3 header to gl32.h.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
These utility functions are used (or will be used) in different source
files. This prevents gl-renderer.c from growing too much (the coming
texture utilities are quite verbose) by moving generic functions out.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Next commits will add support for a bunch of extensions. The extension
flag enumeration is sorted alhpabetically. This commit makes some
space for the coming flags and presets the current values in order to
avoid useless diff lines and ease code review.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
As most SDR video content uses that instead of BT.601. Crucially, most
KMS drivers use BT.709 as the default for the COLOR_ENCODING value,
making it the effective default for hardware planes we used before we
started setting an explicit value.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
In order to be consistent with our internal YUV shader and KMS plane
output. Note that the extension requires the hints to be ignored for
RGB formats.
Note that the attribs array previously was slightly larger than the
maximum number of attributes required.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Upstream KMS drivers currently default to either ITU-R BT.601 YCbCr or
ITU-R BT.709 YCbCr. Ensure consistent behavior by setting a default.
We use BT.601 as that is what our fallback shader uses at the moment.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Which will be used in later commits. For now using the sampler_type
works for all existing formats, however should we ever want to use
it for RGB formats this functions needs to get adopted.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
We add a flow_id when we touch a surface that has no flow id, and clear
it when we flush damage, so a flow line will be drawn connecting any
operations on a surface and terminating in its damage clear.
This is less useful for surfaces that never receive explicit damage after
they're set up, such as background images and the panel, as they might
never show up as a damage track, and have an unterminated flow line.
For surfaces that do show up on a damage track, we can follow them back to
the commit that caused them to update.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This shouldn't cause any problems with WESGR output, since the timing
will still be very close to what it was previously.
With perfetto tracing, this helps with event ordering. The final flush
event will now come after the damage accumulation function calls instead
of before. This is better when we add flow lines in a following commit.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Try to roughly achieve feature parity with WESGR by processing the same
timepoint data and feeding it into perfetto, with output and surface
specific tracks.
We can't match the way WESGR draws this information, because perfetto has
a different display paradigm, but we can try to at least make sure all the
same information is visible in an understandable way.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When we use perfetto, we'll want to enable the renderer timepoints, which
are currently gated behind weston_log_scope_is_enabled(). So let's make a
function that checks if either the timeline scope or perfetto is enabled.
We do not yet process these timepoints, that comes in a future commit.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Just pepper some perfetto tracing about.
These functions are picked mostly to provide some visibility into repaint,
but in the future we might want to add more sites, such as input
processing.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This borrows heavily from the Mesa project's perfetto instrumentation, and
for now just adds perfetto to the build and a collection of useful macros
for adding trace points.
The atomics have been cargo culted in - Weston currently has no need of
such things, but I guess they're harmless for now and could be useful if
we consider threads in the future.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
I'll be adding perfetto instrumentation, which will want to know the
timepoint name without having to parse it.
For now, just pass an enum and add a helper function to convert to strings.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Weston seems quite ready for that so let us do it!
This makes the winpr3 Static assert warning message go away, allowing us
to perform a build (as we fail with any type of warnings).
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Add asserts ensuring that outputs aren't created or destroyed twice
and that a valid pair of output/renderbuffer is passed to
repaint_output().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Accumulate renderbuffer damages and select a GL renderbuffer for
repaint in a dedicated function.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Coalesce gl_renderer_create_renderbuffer_window() and
output_get_window_renderbuffer() into a single
gl_renderer_get_renderbuffer_window() function.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Use the term window instead of dummy to make it clear we're dealing
with buffers allocated by the window-system.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
renderbuffer_get_image() is only used by the X11 backend to retrieve
the size of the renderbuffer. The previous commit assumes that
renderbuffers are created at the size of the associated output so the
renderbuffer size can now be retrieved from the output.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Although backends can create renderbuffers of any size, they always
request the output's current mode size (including decorations).
Letting backends ask for a different size than the output has a few
read-back related design issues like for instance weston_renderer's
read_pixels() API users, currently assuming the output size and
without knowledge of renderbuffers, can retrieve cropped images if a
backend asks for a smaller size. Same issue for the output capture
subsystem.
This commit proposes to fix these issues by simply, albeit perhaps
radically, removing the width and height parameters from
create_renderbuffer(), enforcing the current mode's size of the
associated output.
The VNC and PipeWire backends now also access the output size via the
current mode, not through the width and height variables. This has the
benefit of unifying the backends, as well as the renderers, in their
use of output sizes.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The Pixman renderer creates renderbuffers with the create_image() and
create_image_from_ptr() functions. The recent addition of the GL
renderer's create_fbo() function, which is pretty similar to the
Pixman ones, brings the opportunity to unify Pixman and GL renderers.
This commit proposes a common renderer function create_renderbuffer()
to create a renderbuffer of the specified format with an optional user
provided destination buffer.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This avoids having to re-bind them in functions that reuse them
immediately afterwards and does not affect any other parts of code.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit makes gl_fbo_texture_init() and gl_fbo_texture_fini()
consistent with the new FBO handling utilities by using the same
conventions: output parameters, variable names, descriptions.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Remove the glGetError() check from gl_fbo_image_init() after the call
to glEGLImageTargetRenderbufferStorageOES(). It would probably just
return a previous error queued by an unrelated GL call because the
error flags aren't cleared. So instead of obfuscating the code, this
commit removes that check and relies instead on the framebuffer
completeness check which will better report issues.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Add generic gl_fbo_init(), gl_fbo_image_init() and gl_fbo_fini()
utilities to the GL renderer and make use of these in the renderbuffer
creation functions.
This also fixes a framebuffer object leak on dma-buf renderbuffer
creation when the EGLImageTargetRenderbufferStorageOES() call fails.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
There's no need to render the surface content to a GL texture so make
it render to a GL renderbuffer instead.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Move gl_renderer_create_renderuffer_dmabuf() along with the other
renderbuffer creation functions, using a common naming pattern.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This makes type specific accesses more explicit and less verbose than
the container_of/base alternative which was needed when the base
renderbuffer type was exposed in libweston-internal.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
No backends currently create FBO or dma-buf renderbuffers on outputs
associated to a window. This is theoretically possible though and
should be allowed by the GL renderer. This commit prevents
output_get_dummy_renderbuffer() from mixing up renderbuffer types.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Stale renderbuffers are kept in the renderbuffer list until they're
destroyed by the backend. In the meantime, they shouldn't accumulate
damages since they won't be used anymore.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The output doesn't get finalised and initialised again on resizes
anymore with the Pixman renderer. Only the current dumb and render
buffers get reallocated.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
It's currently assumed by backends that renderers discard
renderbuffers on resize. This commit introduces a new
weston_renderbuffer_discarded_func callback that must be passed at
renderbuffer creation in order to be notified of discarded events from
the renderer. This discarded event could potentially be reused later
by renderers on other occasions without having to change backends once
they get proper support for that.
On output resize, once a discarded event handler fails (returns false)
on a renderbuffer, all the remaining renderbuffers in the output list
go stale and weston_renderer_resize_output() ultimately returns false
for backends to be notified of the failure.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Renderbuffers currently have a libweston-internal base data structure
with a ref-counting system to handle their lifetime. The problem is
that renderers keep a ref to all renderbuffers in a list per output
(to deal with damages) and that it prevents backends from releasing
renderbuffer resources when not needed anymore. Renderbuffers are then
only released (last ref removed) when the output is destroyed or
resized. dma-buf renderbuffers even expose a dedicated function
remove_renderbuffer_dmabuf() to explictly request the release of their
resources.
This commit proposes to get rid of the ref-counting system by exposing
a single entry point to explicitly destroy all types of renderbuffers
from the renderer.
Instead of removing a renderbuffer from its output list and dropping
its ref when the output is resized, this commit also introduces the
concept of stale renderbuffers which consists in releasing the
resources of a renderbuffer when it's discarded by the renderer while
keeping it in the output list, with a stale state, until it's
explicitly destroyed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Move the responsibility for damaging the entire area of new
renderbuffers from backends to renderers.
There's one little drawback: VNC damage logging can't log the
accumulated renderbuffer damage anymore, but I guess this should
somehow be done as an option in the renderers.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This adds tests to create image descriptions through color parameters
using the CM&HDR protocol extension.
The code for that was added in commit "color: allow clients to create
image description from parameters".
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Start to print the parameters from struct cmlcms_color_profile::params
in cmlcms_color_profile_print(). This will be useful for the next
commit, in which we add tests that craft parametric color profiles.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
A counter instead of a boolean should be useful when we add code
printing the parameters. This should help us to avoid printing unused
parameters.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Commit "color: add support to the color-management protocol" added
support for the majority of the interfaces from the color-management
protocol.
The missing part was the interface that allows clients to create image
descriptions from parameters. In this patch we do that.
For now this just exercises the mechanical aspects of the protocol, we
still need to write the code to create proper color profiles from that
and make use of them in our codebase.
In the next commits we add a new test file with lots of tests exercising
the creation of image descriptions through parameters.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
If a certain feature is unsupported, return UNSUPPORTED instead of
BAD_TF, BAD_PRIMARIES, etc.
Also, up to now cm->get_color_profile_from_params() would return
UNSUPPORTED. But this is different from the other UNSUPPORTED usages, so
return a new error.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In the parametric builder API, which is used by our color management
protocol implementation, we have errors that may be translated to
protocol errors or graceful failures. As we return a single err code
to the protocol implementation, let's prioritize the protocol error.
We do that by inverting the order of checks, as the first error code
caught is the one prioritized.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This follows a recent change in the CM&HDR protocol (more specifically,
v4 of the experimental version). Now users of the API can set luminance
parameters for the primary color volume.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This follows a recent change in the CM&HDR protocol (more specifically,
v4 of the experimental version). Now clients can use the protocol to set
luminance parameters for the primary color volume.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The CM&HDR protocol extension spec relaxed the requirements for the
max_fall and max_cll setters. Now we accept such values even when the
transfer function is not PQ.
This also fixes an issue in which we'd not accept target_luminance
for transfer function different from PQ, which was not on the spec.
INCONSISTENT_SET is not being used in any other errors, so remove that
from enum weston_color_profile_param_builder_error.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In the experimental color-management protocol v3
(xx-color-management-v3), we had only the luminance parameters that were
defining the luminance range targeted by the image description. But in
v4 a way to specify luminance parameters for the primary color volume
has been added.
In order to avoid confusion, rename existent luminance variables to
target luminance.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
While choosing a name for file color-properties.h, I've had originally
opted for color-characteristics.h. But we already have some other stuff
named color characteristics in the code, so I've changed that to
color-properties.h.
This fixes a leftover from that. Rename WESTON_COLOR_CHARACTERISTICS_H
to WESTON_COLOR_PROPERTIES_H.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
We need this common helper as we don't have access to shared helper, so
just define one in-situ.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This is problematic as we don't have namespacing for these and some of
the macros can interfere with other defines.
This reverts commit 8634c7e349.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Fix weston crash when user click the mouse continuosly while
the video is playing.
Call weston_view_update_transform before calling
weston_coord_global_to_surface to update view->transform.dirty to 0.
Fixes#985
Tested-by: Sooyeon Kang sooyeon8979@gmail.com
Signed-off-by: Sooyeon Kang sooyeon8979@gmail.com
Up to now, we've been logging only the failures that we get from
drm_fb_get_from_paint_node(). So let's start logging the other failures
we get in drm_output_find_plane_for_view() as well.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This should help people to debug. Instead of printing an hex value,
print each enum value present in the bitmask as a string (comma
separated).
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This function is useful across multiple components of the project, so
move it to a helper header.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Client won't be able to do direct-scanout with this surface, and the
format/modifier doesn't matter in this case. So let's remove the scanout
tranche from dma-buf feedback in such case.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Currently we have the following situation: we add a scanout tranche
because if the client re-allocates with another format/modifier, the
chances of being placed in a DRM/KMS plane is higher.
But then we run out of overlay planes. So we remove the scanout tranche,
because the format/modifier available in the renderer tranche are
optimal for rendering.
Now Weston detects again that the format/modifier is what may be
avoiding the view being place in a plane, re-adding the scanout tranche.
And we have an endless loop.
To avoid this, let's accumulate the reasons why placing the view in a
place failed. So if we detect that we don't have planes available, no
matter the format/modifier, we won't add the scanout tranche.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
FAILURE_REASONS_ADD_FB_FAILED is defined as (1 << 3), so when we are
accumulating "failure reasons" in a variable we don't need to do the bit
shift again.
This results in an issue, because (1 << FAILURE_REASONS_ADD_FB_FAILED)
results in (1 << (1 << 3)) == (1 << 8).
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
There are a few points in the code where we are wrongly using
FAILURE_REASONS_ADD_FB_FAILED, probably because we didn't have so many
"failure reasons" previously. This update such cases to use enum's that
make sense.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Do not skip all the planes if a single one of them do not support
fences. The other may do.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This flag ensures support for both the GL_ANDROID_native_fence_sync
and the GL_EXT_disjoint_timer_query extensions at run-time. The GL
features log now reports that flag so the warning log has been
removed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Storing GL function pointers along with their associated extension
name allows to better track the function pointers declared.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Now that the GL extensions are stored in the gl_extensions bitfield,
there's no need to use booleans anymore.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit ensures GL_OES_EGL_image is available before setting up
dma-buf renderer functions because it's not implied by the presence of
the EGL_EXT_image_dma_buf_import extension.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
GL_OES_texture_3D isn't used because of the complexity implied for
correct OpenGL ES 2 support (see commit 734c2278), so there's no need
to check for it. The check also now avoids checking for
GL_EXT_color_buffer_half_float on OpenGL ES 3.2 which includes support
for 16-bit FP renderbuffers by default.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The GL renderer supports OpenGL ES from version 2.0 to 3.2. It's meant
to correctly link on systems with only OpenGL ES 2, so OpenGL ES 3
symbols can't be used directly. eglGetProcAddress() is currently
defined to not support the querying of non-extension OpenGL ES
functions. Support for that is exposed by the
KHR_get_all_proc_addresses extension. This commit ensures OpenGL ES 3
function addresses can be retrieved by eglGetProcAddress() by checking
for that extension at run-time.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
A new gl_extensions bitfield is added to the renderer to store the
flags supported by the GL implementation. This allows the GL renderer
to easily check for extension support whenever needed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Don't flag EGL_PBUFFER_BIT to get the EGL config if the
EGL_KHR_surfaceless_context extension isn't available. The branch is
never taken because the extension is required and if it isn't
available, the function would have already returned.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Get the EGL_WL_bind_wayland_display extension function addresses after
checking for extension availability.
Let the EGL display setup end before trying to bind the Wayland
display in gl-renderer.c. The EGL features log will now report the
extension as supported even if the bind subsequently fails, in which
case a warning is logged.
This commit also avoids calling query_buffer() if the display isn't
bound in fill_buffer_info(), it would otherwise fail or even segfault
if the EGL_WL_bind_wayland_display extension isn't available.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OpenGL ES 2 and some attributes like EGL_RENDERABLE_TYPE are supported
by EGL from version 1.2.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This feature flag is for explicit sync support.
We replace the explicit sync warning by logging supported fence syncs
along with the report EGL features report.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Trying to follow the principle presented previously, this commit
ensures extension function addresses are retrieved once their
associated extension has been checked for availability.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Get eglCreateImageKHR() and eglDestroyImageKHR() function addresses
depending on EGL_KHR_image_base availability.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This second feature flag ensures that either the
EGL_EXT_swap_buffers_with_damage or EGL_EXT_swap_buffers_with_damage
extension is available.
Some function pointer addresses are currently retrieved depending on
the availabilty of their associated extension and some others are
retrieved unconditionally. For consistency reasons, we'll try from now
on in this commit set to first load function pointers depending on the
associated extension availability and then flag features once all the
addresses are retrieved.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit introduces feature flags. While an extension flag only
ensures the availability of an extension at run-time, a feature flag
ensures the availability of a minimal OpenGL ES version and/or
extensions in order to easily check for the availability of a specific
feature at run-time.
This first feature ensures the availability of either the
EGL_KHR_no_config_context or EGL_MESA_configless_context extensions.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
A new GET_PROC_ADDRESS() macro is added to get a function address at
run-time using eglGetProcAddress() and to assert() the address isn't
NULL at once.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Storing EGL function pointers along with their associated extension
name allows to better track the function pointers declared.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Now that the EGL extensions are stored in the egl_*_extensions
bitfields, there's no need to use booleans anymore.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The egl_display_extensions bitfield is added to store the display
extensions supported by the EGL implementation.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The egl_device_extensions bitfield is added to store the device
extensions supported by the EGL implementation.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
A new egl_client_extensions bitfield is added to the renderer to store
the client flags supported by the EGL implementation. This allows the
GL renderer to easily check for extension support whenever needed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This new utility parses extension strings and fills a bitfield of
matched flags. This will be used to store EGL and GL extension flags.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
With this, when unplugging an extended display, the view displayed on
the extended display won't be re-positioned to other displays.
On some embedded devices, the views are often fullscreen displayed, even
on the extended displays. When disconnecting the extended displays, the
views are not desired to be moved onto the existing displays. Without
this change, we can see the view flash across the existing displays
even though the UI program hides the view as soon as it can, which is
unexpected.
Signed-off-by: Paul Pu <hui.pu@gehealthcare.com>
Now that secondary planes can be both underlay and overlay, this flag's
meaning also changed. Update it for correctness.
Signed-off-by: Leo Li <sunpeng.li@amd.com>
Previously, whether a KMS plane is underlay-able is determined by
whether it's zpos_max is < the primary plane's zpos_min. In other words,
a plane will only be considered underlay-able if its entire valid zpos
range is under the primary plane's lowest zpos.
This is too restrictive - it's possible for planes to have a valid zpos
range that spans below and above the primary's zpos range.
Therefore, allow planes to be used as underlays if their zpos_min is <
the primary plane's zpos_min.
In addition, force rendering on a view if it contains alpha, and is
occluded by a rendered view. If such a view is overlaid, it would render
with incorrect zorder. If it's underlaid, it would render with incorrect
alpha-blending due to hole-punching. Therefore, it must be rendered.
Force rendering prevents the view from going into
`drm_output_find_plane_for_view()`, which serves as an optimization, but
is also observed to prevent dmabuf feedback (derived from
`try_view_on_plane_failure_reasons`) from ping-ponging between two
values, causing some apps (like weston-simple-egl) to constantly
reallocate its buffers.
Because a plane can now - if supported - be used as an underlay, an
overlay, or both, add a `enum drm_plane_subtype` to differentiate
between them. Then, print it's subtype and underlay/overlay assignment
once a decision is made.
v2:
* Squash w/ patch to force rendering on alpha view occluded by rendered
view
* Bring back plane subtype enum to be more expressive about plane
capabilities
* Correct need_hole != false when a view's assignment changes from
underlay to overlay
Signed-off-by: Leo Li <sunpeng.li@amd.com>
When the head is already destroyed, its global resource still can be
accessible by the client, which leads to a UAF crash.
This sets the head's global resource's user data to null before the
head is destroyed, and when the `bind` request is being handled but the
object's user data is null, do what we do when the the head's output is
null.
Signed-off-by: Paul Pu <hui.pu@gehealthcare.com>
Commit 264c205add ignored the fact that a
background color of 0 should fall back to the background image, and
broke that case.
Fixes 264c205add
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The drm_color_encoding and drm_color_range enums are used for
YUV->RGB conversion and mirror what EGL_YUV_COLOR_SPACE_HINT_EXT
and EGL_SAMPLE_RANGE_HINT_EXT as well as our `yuva2rgba()`
shader func do. Add the necessary boiler plate for them.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Non-opaque backgrounds don't make sense, and cause rendering
problems.
Silently set backgrounds fully opaque, and remove any mention of
alpha from the man page.
Kiosk-shell already implicitly forces opaque backgrounds.
Old weston.ini with FF for alpha will always continue to work.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If the scene graph is empty at repaint the renderer will do nothing to the
buffer. On some platforms this results in displaying garbage, and on
platforms where we use frame buffer compression we can cause longer
lasting visual problems.
Make sure we never get here with an empty scene graph.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Desktop-shell currently waits for the desktop-shell client to set up a
background image. But the outputs are enabled before this happens, which
forces a repaint.
If the fade animation is enabled, there's a fade curtain in place, but if
it's disabled the scene graph is empty at the repaint.
This repaint with an empty scene graph can have very nasty consequences,
especially if frame buffer compression is in use, as the buffer isn't
rendered into and can be in an undefined state that confuses whatever
video hardware is trying to decode the buffer.
Add a temporary black curtain placeholder that ensures the scene graph has
something in it before the client gets a chance to commit the real
background.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Previously, commands could only be specified by their path,
so it was not possible to pass arguments.
Use the 'command' config first,
and if it is NULL, fall back to the existing 'path' config.
Signed-off-by: Gyeyoung Baek <gyeyoung976@gmail.com>
Co-authored-by: Michael Olbrich <m.olbrich@pengutronix.de>
A client can call get_xdg_output() at any time. If the output was destroyed,
then all output resources are orphaned. This includes clearing the user data of
the resource.
This can happen, for example, when a monitor or HDMI switch quickly toggles the
HDMI hotplug pin.
So check if a head is associated with the resource. If not, just create the
resource and then return immediately.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Doing these in the wrong order breaks content protection, and breaks
placing direct-display paint nodes on underlays.
Fixes: 827e2276 ("gl-renderer: Draw holes on primary plane for the view on underlay")
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We need to reset the underlay check inside the view evaluation loop,
otherwise once we need an underlay we'll treat every following view as
needing an underlay.
Fixes: 1065d23406 ("backend-drm: Improve plane assignment for underlay platform")
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The dmabuf allocator pulls in libgbm which lives inside Mesa and is built
as a non-standalone part Mesa. This makes gl-renderer hard-wired to Mesa.
The allocator is only used by an optional pipewire backend so make
the allocator optional too.
Signed-off-by: Tomek Bury <tomek.bury@gmail.com>
The buffer_init function added with commit 83b37c0ac4, "renderers: pull
dmabuf initial setup out of attach", doesn't take into consideration the
the buffer's direct-display property.
Previously, gl_renderer_attach_dmabuf, wasn't being called when dmabuf's
direct-display was turned on, but with commit 83b37c0ac4 this has been changed.
So with commit 83b37c0ac4, linux_dmabuf_buffer_get_user_data will never
return a valid gb (gl buffer state), causing a crash using
direct-display extension. This adds an explicit check to return early
when this happens.
Fixes: 83b37c0ac4, "renderers: pull dmabuf initial setup out of attach"
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
As weston_windowed_output_get_api needs ARRAY_LENGTH() move helpers to a
libweston/ so other users can re-use that instead of re-defining these
all over. Easier for other front-ends to make use of them.
With this change windowed-output-api.h also includes the helpers header.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Fix binding-modifier "none" which was defaulting to Super.
Commit [1] introduced the original support for "none" but the logic was
subsequently lost in f7ba35f5.
[1] 553d1248 ("desktop-shell: Allow binding-modifier weston.ini option to be none")
Fixes: #976
Fixes: f7ba35f5 ("kiosk-shell: Enable debug keybindings")
Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
We can startup with the display already in type1 content protection mode.
When this happens, we call weston_output_dirty_paint_nodes() on a display
that hasn't yet been enabled. The paint node list isn't initialized yet,
so we crash.
We don't actually need to touch the paint nodes here anyway, as
weston_output_damage() ensures a repaint if the ourput is enabled, and
weston_output_dirty_paint_nodes() just forces calculation of things
unrelated to protection, and we'll override most of that in
maybe_replace_paint_node() if necessary when we get there.
Just drop the weston_output_dirty_paint_nodes() call to stop the
crash.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Which is used on the RPi4/5 by the HEVC HW decoder for 10bit content.
Note that this is not enough to make KMS offloading work as the
decoder uses the BROADCOM_SAND128 modifier which - for now - requires
manual/unusual handling (i.e. this requires going through GL).
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Grabbing requires a single chain of grabbing popups, but it doesn't require
grabbing to start with a toplevel, it could just as well start with a
non-grabbing popup.
Avoid seding an error when a client attempts to do this.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
If the output is destroyed between setting the panel and committing the
panel, or between setting the background and committing the background,
we have a use after free crash.
Handle this by clearing the surface private pointers on output destroy
so we can skip the useless commits.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
And add ifndef guards for cases were do have support for it.
While at it I need to change how we build it due to:
'meson.build:21:0: ERROR: Value "false" (of type "string") for combo
option "Enable support for vc4's KMS API." is not one of the choices.
Possible choices are (as string): "enabled", "disabled", "auto".'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
From "color: update color-management protocol to xx-v4" onwards, we
should accept ICC profiles of device class ColorSpace, as the CM&HDR
protocol says. So do that.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
NV15/20/30 are a family of 10bpc YUV formats which have 4
horizontally-adjacent samples packed into a 40-bit cluster. The
difference between 15/20/30 is in the subsampling.
No fallbacks are provided, as there is no format pairing which would
allow us to sensibly unpack the clusters.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This checks for a valid resource when getting a xdg_popup. Similar to
the check in get_toplevel.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Upon xdg_toplevel::destroy we seem to be calling xdg_surface::destroy
destroy handler. Protocol states that we should umap the surface with
client having the posibility to getting another toplevel role for the
same xdg_surface and re-map the window.
This also adds a guard for an unlikely invalid resource.
Fixes: #774
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Fixes the following C++ narrow conversion:
/include/libweston-14/libweston/matrix.h: In function ‘weston_coord
weston_coord_truncate(weston_coord)’:
/include/libweston-14/libweston/matrix.h:212:39: error: narrowing
conversion of ‘(int)in.weston_coord::x’ from ‘int’ to ‘double’
[-Werror=narrowing] 212 | return (struct weston_coord){
(int)in.x, (int)in.y };
| ^~~~~~~~~
/home/mvlad/install-new/include/libweston-14/libweston/matrix.h:212:50:
error: narrowing conversion of ‘(int)in.weston_coord::y’ from ‘int’ to
‘double’ [-Werror=narrowing] 212 | return (struct weston_coord){
(int)in.x, (int)in.y };
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This change fixes a side-effect of weston_view_move_to_layer helper
which would basically unmap the view because the layer entry list is no
longer visible. Only add the view to panel layer the first time.
Fixes: #956
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
checks the resource and sends a protocol error if the client tries to
send a request to an inert object then returns out of the request
handler
Signed-off-by: Jeri Li <jeri.li@mediatek.com>
Clients need to know the seat name at the time they create mouse and
keyboard objects. This brings Weston in line with other compositors.
The documentation upstream currently is not super clear. It states name
is explicitly sent on bind, capabilities don't mention being sent on
bind in any way.
Signed-off-by: David Edmundson <davidedmundson@kde.org>
These should be repositioned relative to their parents, attempting to
move them independently not only doesn't make sense, but violates
weston_coord sanity checks.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We need libdisplay-info 0.2.0 for some features, but our wrapper
currently builds 0.1.1, leading to some surprising errors when
trying to use those features.
Bump the wrap version so if we're pulling this in from a wrap
we get the latest features.
We leave the hard dependency alone for now, as it's still not
widely deployed.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Add a client that creates a surface with one color using single pixel buffer.
Set to that surface an image_description created with the parametric creator of
the color management protocol.
This client can get as params:
1. Width and height
2. Color channels R, G, B, A
3. The name of primaries
4. The name of a transfer function
5. The min, max, ref luminance levels
Signed-off-by: Joan Torres <joan.torres@suse.com>
Rendering the shadow currently renders some dark color near the border inside
the inner content.
Altough the content is on top of it, if the content has some transparency,
that dark color appears and this might be unwanted.
Add an option to not render the shadow to avoid that problem.
Signed-off-by: Joan Torres <joan.torres@suse.com>
warning('deprecated-screenshare. This will go away, see https://gitlab.freedesktop.org/wayland/weston/-/issues/848. Consider using mirroring (see man page) for same functionality and better performance.')