Add user authentication support for remote backends via PAM.
This requires a configuration file /etc/pam.d/weston.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
A couple of additional assert()s for transforms being dirty in places
where it could lead to unexpected results.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Let's simplify this code by asserting, and letting it explode naturally
(return Inf, possibly SIGFPE depending on external factors) if compiled
NDEBUG, instead of a contained explosion (safely returning 0).
If this actually happens it's Really Bad, so we'd like to catch is ASAP,
especially in CI.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We always set it up correctly, even if transforms are disabled. The code
is simpler if we always use the matrix instead of having two cases.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If the view transform is dirty it might be incorrect. Also, we normally
set up the view transform matrix properly regardless of whether the
transform is enabled or not - but if we've never run
weston_view_update_transform() it will be all zeros.
This is a step towards removing view->transform.enabled checks and just
using the transform matrix in all cases.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
These places all eventually lead to calling weston_view_to_global_float()
or weston_view_from_global_float() on a view with a dirty transform.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
I inverted the direction of this transform when I stopped doing it from
weston_compositor_pick_view()
Fixes 4d141a788
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
There are two problems here, one is that the surface jump logic only makes
sense if the view remains the same.
The more important fix is that pointer coordinates are in global coordinates
and we want view coordinates, so this test was always wrong and led to an
xdg ping storm due to spurious focus changes.
Fixes 4d141a788
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
weston_pointer_move() can change the pointer->focus, so we have to ensure
we're only testing old_sx and old_sy if we had a focus set before that
point.
Fixes 9b5a525a3d
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This introduces a few getters to retrieve the pending state from
libweston-desktop, now just libweston, and makes use of it,
specifically get_pending_maximized to avoid sending invalid
dimensions to the client in the particular use case
set_maximized/unset_fullscreen.
These pending state getters are useful to query/poke a not-applied
yet state, and could be useful where we don't have a buffer attached
where the client might be set-up as maximized, but internally libweston
hasn't yet applied that pending state.
Fixes#645
Suggested-by: Morgane Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Listening the shell destroy instead of compositor destroy signal.
This show how to in case the controller depends on shell resource.
The order destroying had changed in this commit, the controller
is destroyed first now
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
The surface listeners must remove when hmi-controller destroying.
To avoid to use after free.
Suggested-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
In the case the controlelrs are depended on ivi-shell resource,
it must be destroy before the ivi shell destroy. To do this,
add new ivi shell destroy signal on ivi shell, emit it on
the begining of the shell destroying
Suggested-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
Suggested-by: Michael Olbrich <m.olbrich@pengutronix.de>
Suggested-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
This is particularly useful when using the weston-editor which seems to
cause an issue with cairo_debug_reset_static_data(), as that still seems
to find out there are references laying around, causing a crash when
exiting:
../../../../src/cairo-hash.c:217: _cairo_hash_table_destroy: Assertion
`hash_table->live_entries == 0' failed
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Rather than creating a new PangoContext each time the menu redraw
handler is triggered re-use it if one was created previously.
All toytoolkit clients do create a layout (and implicitly a
PangoContext) but only those that have menu redraw
handler installed will create a new layout for each redraw of the menu,
effectively creating a new PangoContext each time.
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
We are already doing that before calling theme_render_frame() so no need
to do it again in layout creation.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
These have been in wayland a while back with version 1.20.0.
We also need to update the test client helper with this bump, as
those bind to version 4.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Before this patch, when a new head is found its information is printed
first as "updated" and then as "found" in the log.
The reason is that drm_head_create() calls drm_head_update_info() which
printed the head as "changed". Then drm_head_create() itself prints it
as "found".
This fixes it to print only once as "found".
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Mimic the existing behaviour of logging once, but make it once
per output instead of per run.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Mimic the existing behaviour of logging 5 times, with no reset, but
change it so it's per device instead of using a static variable.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The current code only prints this once, and this is a probably a sensible
thing to do, as a clock read failure is probably not a condition that will
correct itself.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Ideally we'd like to see this more than just a single time, but we'd also
like to prevent it from triggering endlessly. Let's also make this happen
per output.
While we're here, use the word "abnormal" instead of "insane"
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We have a few places where we log messages only the first time they occur.
Provide a log throttling implementation so we don't have to open code this
in all the places that need it.
Instead of just logging a single time, allow some finer control. We allow
logging of a specified number of events. Additionally, we have an optional
timeout after which the event count is reset so we can log at most N
events in M ms.
The first new event printed after the timeout expires will also include a
count of suppressed events.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
To avoid the following UAF:
Invalid read of size 8
at 0x4AE5EFF: weston_desktop_get_display (libweston-desktop.c:110)
by 0x4AEB2C9: weston_desktop_xdg_surface_schedule_configure (xdg-shell.c:1160)
by 0x4AEA77A: weston_desktop_xdg_toplevel_set_size (xdg-shell.c:711)
by 0x4AE839D: weston_desktop_surface_set_size (surface.c:504)
by 0x63F7D43: ivi_layout_surface_set_size (ivi-layout.c:1599)
by 0x63F949F: transition_move_resize_view_destroy (ivi-layout-transition.c:311)
by 0x63F9397: layout_transition_destroy (ivi-layout-transition.c:259)
by 0x63F8E0B: ivi_layout_remove_all_surface_transitions (ivi-layout-transition.c:121)
by 0x63F4BC1: ivi_layout_surface_destroy (ivi-layout.c:258)
by 0x63F38AF: layout_surface_cleanup (ivi-shell.c:162)
by 0x63F3D2D: shell_destroy (ivi-shell.c:359)
by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
Address 0x174202d0 is 0 bytes inside a block of size 152 free'd
at 0x484617B: free (vg_replace_malloc.c:872)
by 0x4AE5EDC: weston_desktop_destroy (libweston-desktop.c:97)
by 0x63F3CF2: shell_destroy (ivi-shell.c:355)
by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
by 0x4864A4B: wet_main (main.c:3908)
by 0x10915D: main (executable.c:33)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Shutting down the compositor gives us:
Invalid write of size 8
at 0x4B1AEDB: wl_list_remove (wayland-util.c:56)
by 0x4AF05BF: weston_signal_emit_mutable (signal.c:66)
by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
by 0x4864A4B: wet_main (main.c:3908)
by 0x10915D: main (executable.c:33)
Address 0x17435f20 is 224 bytes inside a block of size 384 free'd
at 0x484617B: free (vg_replace_malloc.c:872)
by 0x17718C7E: hmi_controller_destroy (hmi-controller.c:761)
by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
by 0x4864A4B: wet_main (main.c:3908)
by 0x10915D: main (executable.c:33)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Similar to changes in simple-dmabuf-egl, this perform a x-axis
reflection as it has the same NDC values as simple-dmabuf-egl and we get
an inverted image. We do it straight in the shader this time.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
The motivations for this are:
- Y_INVERT is not used by most real-world clients.
weston-simple-dmabuf-egl and weston-simple-dmabuf-v4l are one only
known users. Thus this creates a special case just for these demo
clients.
- Some compositors (wlroots) have dropped support for DMA-BUF flags,
so the client no longer runs there.
- Dropping the flag allows compositors to use a KMS hardware plane to
display the buffer.
It keeps the same axis orientation we had in place where we had the
y-invert flag enabled by default, by doing a reflection about x-axis.
Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/675
Spinning up the full desktop-shell is pointless overhead for most tests,
which don't need the full load.
Signed-off-by: Daniel Stone <daniels@collabora.com>
There's no need to spin up the full desktop-shell for the vast majority
of our tests. Rework them to use weston-test-desktop-shell, which is
more lightweight and sensible.
Signed-off-by: Daniel Stone <daniels@collabora.com>
listen the signal and destroy the screen
corresponding to the destroyed weston_output.
clear also pending and order layer lists and
unmap all active views on the screen.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
The controller should decide what to do with the views. It can
destroy the views or move the view to other screen. So, don't unmap
the views on the destroy screen event in ivi-layout. Removing typecast
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
listen the signal and create new ivi screens.
this is required to handle hotplug events.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
don't need to check the output in event, remove the typecast
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
Some monitors expose a selector for the kind of content that will get
displayed, allowing them to optimise their settings for this particular
content type.
I got access to such a monitor, sadly even setting it to game mode
didn’t lower its atrocious latency, but drm_info[1] reports it to be set
correctly so hopefully it’ll work better with other monitors.
[1] https://github.com/ascent12/drm_info
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
The controller sets the source and destination rectangles for any surface,
based on these parameters configure event is sent from the client application.
The controller commit the properties in the initial time, so
the view mask is capped to the current buffer dimensions of the
client. In runtime the client maybe sends some the bigger
configures of buffers. In this case view mask will be of smaller
dimension compared to the client buffer and it results in un-desired
clipping of client buffer.
To resolve this, use source rectangle as view mask. weston will take
care to clip the boundingbox of view to client buffer dimension if the
view mask is smaller.
Signed-off-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
Break this into internal and external parts so we don't have to pass
nonsense coordinates from fs_output_create()
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We're just going to crash at weston_view_from_global_fixed() anyway if
this is untrue, but we have a similar assertion elsewhere already.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Whether these coordinates are "invalid" (set to an unlikely sentinel value)
or not is based purely on whether pointer->view is valid.
Check pointer->view before using these values every time, and stop
using an "invalid" value entirely.
The reason for this is that in the future we're reworking how 2D
coordinates are handled, and removing the dubious conecept of an invalid
coordinate simplifies things a little.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Sometimes callers don't want them, and sometimes (when view is NULL) the
coordinate is invalid.
Waste a tiny bit of time calculating them as needed in the callers
instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
sx and sy are meaningless (-1000000) when view is NULL. The case this
is meant to catch is when the surface coordinates change while the
global coordinate doesn't, (eg: max/unmax a window with a keyboard
shortcut) - in that case view will always be set.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We're always passing pointer->x, y converted to surface coordinates, or
garbage if view is NULL. Let's just stop passing those coordinates
entirely and calculate them in the function.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Not all callers of weston_pointer_set_focus use weston_compositor_pick_view
to get their coordinate, so let's log something if the coordinate doesn't
make sense.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The ivi-shell keeps track of its surfaces by adding them to the ivi_surface_list
to be able to remove them on shutdown. It also creates an ivi_layout_surface for
a desktop surface, but does not keep track of these surfaces.
During compositor shutdown, libweston prints the following message:
BUG: finalizing a layer with views still on it.
Fix it by adding the created ivi_layout_surface to the ivi_surface_list to
remove the surfaces from the layer during shutdown.
Furthermore, remove the ivi_layout_surface from the desktop surface and free it
when the desktop surface is destroyed.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Removes the need to fabricate a fake coordinate pair when calling
weston_drag_set_focus to clear focus.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>