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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The #ifndef doesn't work with the built-in static_assert from C++11, so
it ends up getting redefined. It seems that there are other versions of
static_assert internally in some C++ standard library implementations
that have additional arguments, and these also get overwritten by the
two-argument version here.
Detect if we're using a suitably-recent version of C++ and avoid the
redefintion in that case.
Signed-off-by: Ray Smith <rsmith@brightsign.biz>
Use gcc and clang's 'fallthrough' attribute instead of a comment to
fall through switch statements. This allows to request fall through
inside a block and prevents issues with preprocessed files.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
image should be initialised to NULL in case image loading fails
between setjmp() and xzalloc().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Fix ‘image’ clobbered by ‘longjmp’ warning using volatile.
jpeg_image_data members are now also declared volatile (like
png_image_data members) to explicitly request compilers to store them
on the stack (not in registers) to avoid warnings and bugs later.
Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Render wireframe within paint nodes instead of drawing lines in a
second pass. The wireframe is blended over the node in a single draw
call. This slightly simplifies the logic by removing the computation
of a second set of indices and enables wireframe anti-aliasing using
Celes and Abraham's "Fast and versatile texture-based wireframe
rendering" paper from 2011.
Celes and Abraham use a one-dimensional set of texture coords for each
triangle edge, 1.0 for the 2 vertices defining the edge and 0.0 for
the other vertex, which basically define barycentric coords. Texture
mapping and the mip chain is then exploited to give a constant-width
edge. The main drawback of the technique is that contour edges of
node's damage mesh are drawn half as thick as interior lines since
each triangle draws half of each line's thickness.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Wrap compiler builtins into shared functions with proper generic
implementations. __builtin_clz() isn't wrapped for now because its use
by screenshooter is pretty specific. It will be properly wrapped in
the next commit which needs a round up to the next power of 2
function.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
We're now using EGL_EXT_present_opaque and EGL_EXT_surface_compression
in weston-simple-egl, but this breaks the build for people that don't have
them in their system headers.
Pull them in from the khronos headers.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We have a single user of load_image(), and that can be easily replaced
by the new and more flexible weston_image_load() function.
So replace and drop load_image() from the code.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Instead of loading only the pixman image through load_image(), load both
the pixman image and the ICC profile with weston_image_load().
It also sets the struct weston_image as the cairo surface user data and
adds a function so that users can retrieve this.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Follow up of "shared: allow to get ICC profile from PNG using
weston_image_load()". This adds the support to get ICC profiles from
JPEG files.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This introduces the functionality to also load the embedded ICC profile
from an image. For now, this only supports PNG files, but in the next
commit we add the support for JPEG as well.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In the next commits we plan to add support to load ICC profiles that are
embedded in images. So we need something more flexible than
load_image().
This patch introduces a new function that, for now, does the same as
load_image(). For now we keep load_image() as well, but the plan is
to drop it later.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
A paint node with 'n' rects damaged by 'm' quads emits 'n*m' OpenGL
draw calls. This commit batches the 'n*m' clipped polygons into an
indexed triangle strip damage mesh using degenerate triangles. A
single draw call per paint node is emitted to reduce API overhead.
Fan debug mode is disabled for now and will be added back using
batching in the next commits.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Effective from Linux 6.3 onward, this creates the memfd without execute
permissions and prevents that setting from ever being changed. A
run-time fallback is made to not using MFD_NOEXEC_SEAL when
weston compiled on Linux >= 6.3 is run on Linux < 6.3.
Signed-off-by: Sami Uddin <sami.uddin@astc-design.com>
Helper to assert that a value does not have any bit set outside of the
mask. To be used with "all bits mask" of enum types that enumerate bits.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If png_create_info_struct() fails, we should pass NULL to
png_destroy_read_struct(), and not the address of the info we just
failed to create.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Currently in translate_curve_element() we always translate the curve
into a LUT. But in the future we'll be able to translate the curves to
parametric ones.
So move the current code to a new function
translate_curve_element_LUT(), so that in translate_curve_element() we
are able to call one of the two functions (_LUT() or _parametric()).
No behavior changes, just preparation for the upcoming patches.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Not a behavior change, but this allow us to decide what function pointer
to use within this function (instead of forcing callers to decide that).
In the following commits this will be helpful. We'll add more curves
besides 3x1D LUT's and, depending on the curve, the function pointer
signature may differ.
Also, we now pass the xform directly to the function, and it can select
the curves depending if it is being called for a pre or a post curve.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
A proper dependency on egl is missing for several backends as well as
for libshared. This dependency is necessary to pull in the correct
include directories from the egl.pc pkg-config file.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>