This does not change any behaviour, but creating complex dynamic things
was intended to be done in init() rather than color_manager_create().
Create is called from weston_compositor_load_color_manager() before
loading backends, and init is called from
weston_compositor_backends_loaded() after loading backends.
Now we assert instead of check that scope creation succeeded, because
the only way it could fail is to have small memory allocations fail, or
internal code error.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
No changes to the functions at all. This makes them available for use in
cmlcms_init() for the next patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This reverts commit 188a3ebd5e.
Call weston_compositor_enable_color_management_protocol() after
compositor->color_manager has been set, and so allows to check if the
color manager supports the features mandatory in protocol. The check is
added in the next patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
"Get" could imply increasing reference count, and color transform
objects indeed are reference counted, but this function does not do
that. Rename it to reduce confusion.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This makes it more explicit that this indeed is increasing the reference
count, rather than just returning a pointer.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
"Get" could imply increasing reference count, and color transform
objects indeed are reference counted, but this function does not do
that. Rename it to reduce confusion.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
"Get" could imply increasing reference count, and color profile objects
indeed are reference counted, but this function does not do that. Rename
it to reduce confusion.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
"Get" might easily imply reference counting, but there is none here.
"to" is more descriptive for a cast.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
"Get" could imply increasing reference count, and color profile objects
indeed are reference counted, but this function does not do that. Rename
it to reduce confusion.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
"Get" might easily imply reference counting, but there is none here.
"to" is more descriptive for a cast.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Currently we create the color profile id generator in
weston_compositor_backends_loaded() and destroy it in
weston_compositor_shutdown().
If something goes wrong and Weston does not start properly, we end up
calling weston_compositor_shutdown() for a struct weston_compositor
whose color profile id generator is NULL, crashing.
This fixes that, creating/destroying the id generator in
weston_compositor_create()/destroy().
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The shell_surface may disappear when keyboard lost focus,
then the shsurf will be NULL.
Have an ahead check for shsurf before calling the callback
in weston_desktop_surface_foreach_child.
Fixes#811
Tested-by: Erkai Ji <erkai.ji@nxp.com>
Signed-off-by: Wujian Sun <wujian.sun_1@nxp.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Damages and captures both trigger repaints of outputs. Some
configurations don't care about damages and use headless only for
captures. This commit adds a new feature to libweston that lets
outputs repaint only on captures, not on damages. The headless backend
enables that new feature when given a special refresh rate of 0 mHz.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Custom headless refresh rates can be useful to instrument clients
matching different screen configurations. This commit adds support for
that to the headless backend and exposes it to the frontend with the
"--refresh-rate" CLI option. The default refresh value is still 60 Hz.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
When we are destroying the color manager, the components referencing
color profiles should have already been destroyed. We have an assert
in cmnoop_destroy() to make sure that the stock profile has refcount
equal to 1.
But we currently have an issue in Weston. While shutting down with
client surfaces alive, we may leak them. So we try to destroy
the color manager with surfaces still alive, and they may be
referencing color profiles.
We already have a workaround for this in our LittleCMS color plugin,
but we've missed that in color-noop. This fixes that, so now we don't
hit the assert anymore.
As we are already dealing with asserts in color-noop, I took the
liberty to replace the last usage of assert with our own wrapper
in this file.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Avoid memory use-after-free when the trying to remove entries from an
already freed list later.
Also add missing removal in drm_output_detach_head() and drm_head_destroy().
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
When using some features from LittleCMS in our CI, we are seeing some
crashes on the address sanitizer. Bumping the LittleCMS version fixes
that. So build and install a more recent version of LittleCMS on our CI.
We chose version 2.16 because it introduces the function
cmsGetToneCurveSegment(). We already make extensive use of that in our
codebase, so it is a good idea to have that on our CI as well.
Now color-curve-segments.c will start to get build on the CI, as
HAVE_CMS_GET_TONE_CURVE_SEGMENT will be true. So we also fix a minor
issue in which we were comparing int with uint in this file, what was
caught after experimenting bumping the LittleCMS version.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In this patch we enable the color-management protocol support, as long
as the color-manager plugin in use supports it.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In this MR we add support to the majority of the interfaces from the
color-management protocol.
That means that we are able to advertise output's images descriptions to
clients, preferred surface images descriptions, and so on. We also
support clients that wants to create ICC-based images descriptions and
set such descriptions for surfaces.
We still don't support the interface to allow clients to create
image descriptions from parameters, but that should be addressed
in the near future.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Similar to pixel-formats.c, but for color properties. This helper
aggregates the same color properties from different APIs into tables,
and introduce functions to use that.
The idea is that we only use that internally in our libweston struct's,
and pick the specific API value only when necessary.
Preparation for the CM&HDR protocol extension implementation.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This is preparation for the CM&HDR protocol implementation. It requires
us to give a unique id to each color-profile, so let's do that.
In this commit we introduce a generic id generator to libweston, and
its first user: the color-profile.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The non-zero area check of clipper_quad_clip() is incorrect for quads
initialized with a polygon starting with a vertical edge. In order to
handle polygons starting with an horizontal edge and polygons starting
with a vertical one, it must check opposite vertices for equality.
The test previously described as "Box intersects entire smaller
aligned quad" is now described as "Clockwise winding and top/left
initial vertex". This test keeps the same values as before but all
combinations of winding order and first edge orientations are
also tested. The QUAD() macro isn't used anymore to do so.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Add quad clipping tests checking intersections at all edges and
corners of axis-aligned and unaligned quads with negative and positive
values.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
I want re-use this variable for printing the colorimetry mode list as
well in a future patch, so a generic name is less confusing.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Performance-wise this is moot, but since we are detecting if the raw
EDID data changed, might as well use it.
Now we have a path where the head's device_changed is almost guaranteed
since EDID changed, and that's useful for the next patch.
We can only do this, because the core initializes a head with values
that we would be setting anyway when EDID is missing, e.g. disconnected
head on compositor start-up.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Store the EDID data as-is, so that we can tell when the EDID blob has
changed. This is not too useful yet, because all the weston_head_set_*()
API raises the device_changed flag only if the information actually
changes. However, I want to expose the libdisplay-info di_info structure
through weston_head, and those cannot be (as) easily compared.
We need to know when the EDID blob changes, so we can call
weston_head_set_device_changed() appropriately when updating di_info.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
One of the three fixture setups of alpha-blending test requires
color-lcms.so. If color-lcms.so is not built, that fixture fails.
Make it skip as necessary, making the test suite pass with
color-management-lcms=false build option.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Just like we already do for planes with proper zpos. Otherwise we'll
often end up choosing the primary plane instead of an overlay one
in `drm_output_find_plane_for_view()`.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
This seems to think formats needs to be NULL terminated, but it doesn't
and gl_renderer_get_egl_config asserts that all formats_count elements
are not NULL.
This happens when EGL_KHR_no_config_context is not supported.
Signed-off-by: Ray Smith <rsmith@brightsign.biz>
It adds the followig paragraph:
```
Starting from version 5, the invalid_format protocol error is sent if
all planes don't use the same modifier.
```
We already assumed this in some places and, most importantly, it's
required by the kernel. Thus alter `dmabuf_attributes.modifier` to make
it clear that different modifiers for multi-planar dmabufs were never
supported.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
commit 79212ba9ad fixed a bug by
introducing a new one.
Before that point we could clip paint node damage to stale
visibility data. After that point we post damage for occluded
views, leading to large amounts of pointless drawing.
Add back the clip to visible region, in
weston_output_flush_damage_for_plane(), where we have up to date
visibility region information.
fixes 79212ba9ad
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If client changes the buffer transform or size and re-commit the surface
before surface dirtys buffer (weston_surface_attach), the viewport
source validity check may fail. Because the width_from_buffer and
height_from_buffer cannot be updated based on new buffer transform.
Therefore, add the situation of size dirty (WESTON_SURFACE_DIRTY_SIZE) to
source validity check, width_from_buffer and height_from_buffer can be
updated in time when the buffer transform and scale change.
Signed-off-by: Chao Guo <chao.guo@nxp.com>
The `drm_output_deinit` should use the drm device passed by the
function, should not use the `b->drm` device.
Signed-off-by: Zhou Liang <174381115@qq.com>
If both the head and writeback are not found, then we should add
connectors to the drm device passed by the function, not the b->drm
device.
Signed-off-by: Zhou Liang <174381115@qq.com>
In a multi-GPU environment, different cards may contain connectors with the
same ID, and drm_head_find_by_connector just use the connector_id to find
the connector, it may find the wrong connector.
Fix this by find the connector based on the drm device and connector id.
Signed-off-by: Zhou Liang <174381115@qq.com>
If a view is non-opaque - such as an overlay over a video - we shouldn't
force it to be on the primary plane, as that's where the underlying
content should be placed, such as the video view.
dc0de9ee already mentioned: "This check should be changed in future to
only filter for opaque views, but that's for another time."
Adding "Fixes" at this is arguably a bug fix:
Fixes: dc0de9ee (backend-drm: Move overlay vs. primary plane check earlier)
Fixes: 2538aacc (backend-drm: Construct a zpos candidate list of planes)
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Currently we flush damage for the "primary plane" every repaint, but this
is folly.
The drm backend may skip rendering entirely if using an all-planes
composition. This could leave the renderer plane in a messy state if a
surface on an overlay plane disappears.
Instead, let the backends flush the primary plane damage when they know
they need to render.
Fixes#864
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
And with it, bump libweston to next major version, 14. We seems like
we never used that argument so better just removed it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
The idle_animation_destroy task should be removed when destroying
animations by the other callers such as handle_animation_view_destroy().
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Latest musl has removed the declaration from string.h [1] as it only
implements POSIX version alone and string.h in glibc implements GNU
version of basename. This now results in compile errors on musl.
This might be a warning with older compilers but it is error with
Clang-17+ as it treats -Wimplicit-function-declaration as error
Switch the use in backlight_init function to use POSIX version
[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This was added in 4def21c196.
0c1ab2ad76 removed all uses of NULL
weston_compositor, making the workaround unnecessary.
Drop the workaround, it's dead code.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Fix a crash when right-clicking on a weston-terminal, where
weston_desktop_seat_popup_grab_add_surface() is called with
seat->popup_grab.keyboard.keyboard == NULL in case there is
no keyboard connected.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Manually mark the surface as mapped exactly once - in the committed
handler where we have our content, and assert that it's correct when we
want to use the surface by instantiating a view.
The view handling can be made much more simple by simply using the new
view helpers.
Signed-off-by: Daniel Stone <daniels@collabora.com>