Use the new label field instead. The code becomes much simpler.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
struct weston_curtain_params is changed to match the new
weston_surface_set_label() API. For now, I did not bother hooking up the
static label flavor.
Part of migration away from get_label().
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Every .c file must include config.h as the first thing.
Without this, when a later patch tries to use xstrdup() here, the build
will:
In file included from ../../git/weston/kiosk-shell/kiosk-shell.c:37:
../../git/weston/shared/xalloc.h: In function ‘abort_oom_if_null’:
../../git/weston/shared/xalloc.h:48:40: error: ‘program_invocation_short_name’ undeclared (first use in this function)
48 | written = write(STDERR_FILENO, program_invocation_short_name,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../git/weston/shared/xalloc.h:48:40: note: each undeclared identifier is reported only once for each function it appears in
This is caused by the lack of _GNU_SOURCE.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Part of migration away from get_label().
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Part of migration away from get_label().
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
To update the surface label based on client-controllable fields like
app_id and title we need to use a listener and update the label
accordingly using weston_surface_set_label() added previously.
The added weston_desktop_surface_make_label() will eventually supersede
weston_shell_utils_surface_get_label() by having a more fluent API.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Subsurfaces labels do not have dynamic fields that change so we can just
use it as is.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is an alternative to using set_label_func to avoid using get_label()
callback. get_label() is inconvenient to set up and to call. It incurs
the cost of creating the string every time it is needed. During
debug logging, the string is needed much more often than it changes.
The new label field simply stores the string, making it easy and cheap
to use. As the trade-off, components that set the label string must
re-create the string when it changes, whether it is needed or not.
For the migration to the new label field, get_label_member callback is
used. It will be deleted once the migration is done.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
On the quest to delete the get_label() vfunc completely, a temporary
default get_label implementation needs to be plugged in. This would
affect all the code that checks whether the get_label vfunc is NULL.
Let's make get_label vfunc non-NULL always intentionally first. We can
delete all the code that checked for NULL, and the bespoke label
replacements in that case. Now all those different "no label" cases are
unified.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Doing
weston_log_subscription_printf(sub, "%s", str);
would malloc a new buffer, copy str into it, flush it our to the
subscriber, and free the buffer before returning.
Using weston_log_subscription_write() instead there is no malloc and
copy. Only open_memstream() has a malloc'd temporary buffer.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Add a new gl-renderer scope (gl-renderer-paint-nodes) to print out
repaint (damage) regions, opaque and blended regions as well as other
optimizations we might be taking (clear region, color effects), and
skipping repaints.
It includes as well the elapsed time being used by GPU timeline
(GL_EXT_disjoint_timer_query) as well.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Further clarify that is printing the GL/EGL-extension by renaming
the internal scope name to extensions_scope and the advertised name
is gl-renderer-ext.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Just for completeness sake, let's commit the image description. This
should poke at the surface state machinery with the image description.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Enhancing the color-manager machinery in the client library to suffice
for color-management-test.c as well, we can remove a copy of the
boilerplate code.
The changes include renaming things, moving parameters from
image_description to image_description_info, deleting the list of image
descriptions and cleaning them up explicitly, and creating the
color-management surface and output objects on-demand.
image_description_get_information() explicitly waits for the done event
instead of relying on a ropund-trip.
Bit operations got helper functions. Gamut parameter printing was
re-written.
In spite of the massive changes, the tests themselves still work exactly
the same.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Turns out that the fail-case code does everything the good-case code
does and more, so we can reduce the code duplication.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
There are two partial implementations of the color-manager
protocol boilerplate, in color-management-test.c and
color-management-parametric-test.c. This patch moves the implementation
from the latter into the client library, and uses the helper bit().
This paves way for moving the other partial implementation as well,
de-duplicating the overlapping code, and allowing new test programs to
poke at color-manager.
The color-manager is initialized on-demand, because mosts tests in the
suite do not need it. This avoids a little of unnecessary work.
In anticipation of wp_color_management_v1 version 2, the interface
version is explicit and ensured.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
yuv_coefficients and yuv_offsets should get optimized away by shader
compilers as the related code paths can never be reached. This seems to
work well on Mesa but not necessarily with other drivers.
While on it, assert that the uniforms *are* present, unless the
yuv-to-rgb conversion is handled by the driver.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
The read() function expects a pointer to buffer, not address of
pointer. Three instances were incorrectly passing &buffer instead
of buffer to read().
Signed-off-by: Wang Yu <wangyu@uniontech.com>
These were simply leaked before. Now they get destroyed together with
the primary DRM device, too.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace all the open-coding in drm_backend_create() with a call to
drm_device_create(). This is much more maintainable.
drm_source is not needed, it is tracked in struct
drm_device::drm_event_source.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Otherwise we cannot clean it up.
The special backend->drm device has the special backend->drm_source for
the same purpose.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Will need to destroy more than the special b->drm. All the additional
devices are currently leaked.
Move the code into a new function to re-use it.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I want to consolidate 'struct drm_device' destruction into a single
function in the next patch, and that function needs to be usable for
both the primary device drm_backend::drm, and the secondary KMS devices
drm_backend::kms_list.
Sprites, a.k.a drm_planes, are objects fundamentally owned by their
drm_device. To encapsulate drm_device destruction into a single function
(that assumes that all outputs on that device are already destroyed),
one cannot call destroy_sprites() from drm_shutdown() anymore - it
logically belongs in drm_device_destroy().
The problem is that that will reverse the order of destroying drm_planes
vs. output (GBM) surfaces. drm_plane_state holds a reference to drm_fb
which points to a GBM BO that was received from a GBM surface. When the
GBM surface is destroyed, all its GBM BOs are destroyed as well, which
will cause all drm_fb pointing to them to be destroyed as well
regardless of drm_fb reference count. Therefore, if any object was
thought to hold a reference to a drm_fb, it now holds a dangling
pointer.
Why is drm_output_deinit() not clearing the drm_plane state it used,
releasing all the drm_fb references? And do that before destroying the
GBM surface?
Because drm_output_deinit_planes() explicitly skips clearing the
drm_plane state during compositor shutdown, because during shutdown the
drm_planes have already been destroyed.
If we change both, we get a much simpler tear-down logic:
- drm_output_deinit_planes() will always clear drm_plane states, no
special handling for shutdown (which is an elaborate way of saying
"before outputs are destroyed").
- drm_output_deinit() calls drm_output_deinit_planes() before it
destroys the GBM surface, which ensures no dangling drm_fb pointers
are left.
- destroy_sprites() call is moved *after* destruction of outputs where
it logically belongs.
This also means that the per-renderer fini functions do not need to
clean up manually when the compositor is not shutting down. They can
just assert the scanout_plane has already been cleaned up.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This makes it possible to use drm_device_create() from
drm_backend_create() in the future.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
find_primary_gpu() and open_specific_drm_device() are modified to return
drm_kms_device instead of modifying fields inside the given drm_device.
Likewise, there is no need to pass the whole drm_backend in (which is
not fully initialized, maybe), but just the needed things.
This should make the code a little easier to follow.
Accidentally, this seems to fix a reference leak of udev_device in
drm_device_create(), because the udev_device is now tracked inside
drm_kms_device and properly unref'd. drm_backend_create() had the unref
that drm_device_create() missed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
find_primary_gpu() and open_specific_drm_device() are currently
returning the udev_device while modifying the passed in drm_device. To
stop the modification, these functions should return drm_kms_device
directly, but the udev_device is also needed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
drm_device_is_kms() used to populate a few fields of the passed in
struct drm_device, releasing old values. This was inconvenient, because
one must allocate struct drm_device first, then call drm_device_kms() in
a loop, and finally end up with only some fields of drm_device
populated, then continue to populate it more.
The new function drm_kms_device_create() will malloc a new struct
drm_kms_device every time. RAII. No need to populate and re-populate the
same fields in drm_device until the right KMS device is found.
One can no longer check the fd >= 0 for device validity, now one checks
if kms_device is not NULL.
The fd_owner field is added because it would be inconvenient to pass in
the launcher to the destroy function. It's cleaner to save it, make sure
the right one used for releasing an fd (as if we had multiple launcher
instances, haa haa). Can't release it properly without the launcher.
This is just a minor step to facilitate more refactoring.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This gives the anonymous struct at struct drm_device::drm a name.
drm_device::drm is renamed to kms_device, which I think is a better
name, lacking an even better one.
The type of kms_device field is changed into a pointer, so that struct
drm_kms_device could be created and destroyed separately from struct
drm_device. Actually implementing this is left for the next patch, and
here the pointer is temporarily initialized with
device->kms_device = &device->kms_device_allocd;
Changing the name and type causes tons of trivial changes all over the
DRM-backend. This patch does only that, and the next patch will be more
interesting.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
There are failure paths here that may return without resetting the
variables, leaving dangling pointers behind.
Make sure there cannot be dangling pointers.
Found by manual code review.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
drm_gbm_dmabuf was the type allocated, so that is the type that should
be freed, too.
This was only a semantical bug. It did work before because 'base' was
the first member of struct drm_gbm_dmabuf and therefore the two pointers
were identical.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Having the options printed in addition to the layout and variant is
essential to trace how keyboard assignments ended up as they did.
Signed-off-by: Roland Kaufmann <rlndkfmn+freerdp@gmail.com>
The structure that convert_rdp_keyboard_to_xkb_rule_names fills is
next sent as argument to xkb_keymap_new_from_names, which constructs
the complete keymap.
Signed-off-by: Roland Kaufmann <rlndkfmn+freerdp@gmail.com>
Initially just allocate an extra data field and initialize this to
zero (meaning no particular options) for all keybords in the mapping
table.
Signed-off-by: Roland Kaufmann <rlndkfmn+freerdp@gmail.com>