gl_fbo_image_init() allocates and returns a renderbuffer through its rb
argument.
If it is not set in the dmabuf.rb field, gl_fbo_fini() will not be able to
release it and DMA buffers can start leaking.
This is usually not an issue because the DMA buffers are released when
Weston closes, but in the case of the pipewire output, the buffers are
allocated when a pipewire client connects and freed when the client
disconnects.
In that situation, dangling DMA buffers can be observed because of the
unfreed render buffer (rb).
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Add the set_output function to weston_touch_device to allow touch binding
interfaces to re-assign the touch-to-output mapping.
Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
Add a signal for touch device creation to allow plugins to detect and
respond to touch device changes.
Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
When create_renderbuffer_dmabuf() fails and returns NULL, the previously
allocated linux_dmabuf_memory was leaked because pipewire_output_setup_dmabuf()
had already been called with no cleanup path.
Reorder the calls so that create_renderbuffer_dmabuf() is invoked first.
If it fails, explicitly destroy linux_dmabuf_memory and return early to
avoid the leak.
Signed-off-by: Elliot Chen <elliot.chen@nxp.com>
The only legal way to destroy a cm_image_desc is to go through the
wl_resource destruction. Calling the function otherwise would have left
a dangling pointer in the resource. Let's not have the temptation to
"fix" that dangling pointer.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Since "color: refactor cm_image_desc_create()" if cm_image_desc exists
then the cprof exists as well.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Previously, cm_image_desc_create() created the wl_resource, the
compositor object, and linked them together. Call sites that do not have
a ready-made color profile to use for it, had to call
cm_image_desc_create() with a NULL cprof. Then they would attempt to
create the cprof, and:
- if it succeeded, patch it into struct cm_image_desc;
- if it failed, release the cm_image desc and reset resource user data
to NULL.
Let's make this more straightforward by refactoring.
create_image_description_resource() creates the wl_resource and sets up
the implementation, but user data remains NULL. This is a common
operation done at all cm_image_desc_create() call sites.
link_image_description_resource() creates struct cm_image_desc and links
it to the resource via user data. This can only be called with a valid
cprof.
If anything fails, there is no need to back things out like before. The
sending of errors and 'ready' events is consolidated.
cm_image_desc->cprof is guaranteed to be non-NULL.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Convert the pointer surface coordinates to doubles so we can more readily
see what they mean.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Annotations give us a more generic way to incorporate flows into our
perfetto traces.
This will eventually let us remove some _FLOW() variants of our trace
macros.
It also lets us have multiple flows through the same function/annotation.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This should be variadic. Nothing uses it, so it hasn't broken yet,
but we're about to use it, so clean it up.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This hopefully isn't ridiculously heavy. The heavy part is committing the
flow array later, which is already gated by perfetto internally, so we
don't have to protect anything here ourselves.
This makes it easier to put flows in annotation arrays, because flows need
to be kept up to date even when not tracing.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This was supposed to early return after logging the NULL buffer, not
foolishly carry on and attempt to dereference it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This can turn into a NULL pointer dereference, and the values
aren't meaningful in this state anyway.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This includes an additional _double variant for _Generics and a bool
one.
Similarly, _WESTON_TRACE_ANNOTATE_FUNC_FLOW gets a _Generics macro variant
to handle the case were we have a integer flow ID, rather than an a
pointer.
Finally we always have a flow ID set when weston_input_event gets
initalized.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This basically starts tracking input event. From here on we can start
flow tracking the event until it exits and is being delivered to the
client.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
And with it include a dedicated track in Perfetto to display the event
timestamp on that a weston_seat. This includes support for timeline and
for timeline Perfetto.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Ever since 160394b2c3 we can have
perfetto flow ids in const structs.
We need to preserve the perfetto flow even when tracing is disabled -
a flow will start in a function that has non-const access to a struct,
but other functions further along the flow may only have const access.
Fix up "instant annotations" to preserve flows when not tracing, and to
reset the annotation count on commit when not tracing.
I suppose this also fixes a potential race where annotations aren't
properly reset if tracing is started and stopped multiple times during
the execution of a single function - but I can't imagine that being possible
to hit.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Update to Neat VNC 1.0.0 and aml 1.0.0, which promise stable API.
Adapt to API changes:
- authentication API now wraps username/password into
credentials and can be asynchronous
- userdata get/setters are now type specific
- fbs have been renamed to frames, storing dimensions and damage
- nvnc_open() is split into nvnc_new() and nvnc_listen_tcp()
- nvnc_close() is now nvnc_del()
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Probably copy-pasta. Noticed by gcc 15
../../git/weston/libweston/backend-x11/x11.c: In function ‘x11_backend_handle_event’:
../../git/weston/libweston/backend-x11/x11.c:1687:58: error: ‘key_release’ may be used uninitialized [-Werror=maybe-uninitialized]
1687 | key_release->detail - 8,
Fixes: 99527e6b92
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Similar to "input: Introduce weston_key_event struct" this struct is for
touch events. With this we add the initialization helpers, pass the
weston_touch_event as a const and remove the timespec argument.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Move to a const struct weston_pointer_axis_event, add the base_event
struct that contains the timespec and use the initialization functions.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Similar to "input: Introduce weston_key_event struct", this adds a way
to store all required information with a common struct event to be able
to pass it down and to allow also pass additonal information like
Perfetto's flow IDs.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This adapts weston_pointer_motion_event struct to align in with
weston_key_event and includes the following changes:
- include base struct
- remove the const struct timespec from calls and use the base struct
- pass by a const pointer motion event in all the callers
- add init helper
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Replace weston_pointer_move with weston_pointer_move_to and drop
uneeded weston_pointer_motion_event, as weston_pointer_move_to
would clamp the pointer inside the output's area.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Rather than passing a time stamp, key, key state and key event state
use a weston_key_event struct to pass by all that using it.
This would allow in further patches to attach additional information
like a flow id used by Perfetto debug annotations for input events.
This patch has no functional change as it is now.
All the callees will just will extract the required information out of
struct weston_key_event.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
The flow_id set code obnoxiously wants write access to the flow_id always,
which can lead to situations where we can't pass a struct as const to
appease the perfetto code.
Now that we're embracing C generics, we can tell if a struct is const,
update the flow if it's not, and assert if we don't have a valid flow_id
when it is.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This pointer is the same for the life of the view, even if the matrix
changes.
This is a last pedantic step towards preventing renderers from directly
accessing a weston_view.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of having the drm backend calculate these per frame, let's store
them in the paint node when they change.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This was confusing, because it seemed to magically imply that we could
transform points by invalid transformations.
Rename and better define the variable.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Do the math on floats before the conversion to fixed point. Later, we'll
move this math to the front end where we'd like to store these values
clamped, but not in the backend specific fixed point format.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Before checking if our LittleCMS curve matches any of our known tf, we
need to map it to one of our well-known LINPOW or POWLIN.
We were doing that, but setting only the g param of the curve. a, b, c,
and d were not being set, resulting in a mismatch when comparing the
curve parameters with the ones in our tf's. As we were not finding any
match, we were always mapping the LittleCMS power-law to the parametric
power-law tf, even if the exponent was 2.2 or 2.4 (which have their own
tf's).
Now we properly set all the parameters before doing the check.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Up to now, we'd not try to offload WESTON_TF_ST2084_PQ through a colorop
of type curve. The kernel supports only PQ 125 EOTF, which is the PQ
EOTF scaled by 125. Same goes for the inverse of the EOTF.
In order to support that, use multiplier colorops to scale things up or
down (depending if we have EOTF or its inverse).
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
When the pipelines do not support our color xform or when the color
manager is unable to convert the color xform into operations that Weston
understands (currently: pre-curve, color mapping and post-curve), we
were simply not trying to offload the transformation.
But we have an alternative: trying to decompose the xform into shaper +
3D cLUT and check if there's a compatible pipeline. This commits adds
the support for that.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This name is quite long and awkward to use in certain functions. On ICC
nomenclature, cLUT is a multidimensional LUT with a shaper (1D LUT) in
front of it. So let's just call it to_clut() to simplify.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>