Commit graph

8360 commits

Author SHA1 Message Date
Derek Foreman f9b57c5234 libweston: Use paced logger for bad repaint delays
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>
2022-11-08 08:32:26 -06:00
Derek Foreman 8e661b3c93 libweston: Add weston_log_paced()
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>
2022-11-08 08:32:26 -06:00
Marius Vlad eb755cd81a ivi-shell: Move out weston_desktop_shell at the end
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>
2022-11-07 14:02:20 +02:00
Marius Vlad cfbf2b0ab2 hmi-controller: Add missing removal of destroy listener
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>
2022-11-07 14:02:20 +02:00
Marius Vlad 75b6758fd2 simple-dmabuf-feedback: Correct the rectangle orientation
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>
2022-11-07 11:54:15 +02:00
Simon Ser 9b455e24a2 clients/simple-dmabuf-egl: drop Y_INVERT flag
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
2022-11-07 11:28:29 +02:00
Daniel Stone d1e8d46595 tests: Use weston-test-desktop-shell by default
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>
2022-11-04 10:24:42 +00:00
Daniel Stone c129bda562 tests: Use test-desktop-shell more widely
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>
2022-11-04 10:24:42 +00:00
Daniel Stone 1b837b6ff3 tests: Explicitly use desktop-shell for text-test
text-test wants to use the real desktop-shell so it can launch the input
method.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-11-04 10:24:42 +00:00
Emre Ucan 28842f210d ivi-shell: listen output_destroyed_signal
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>
2022-11-04 16:14:13 +07:00
Emre Ucan cbf476f208 ivi-shell: listen output_created signal
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>
2022-11-04 16:09:39 +07:00
Emmanuel Gil Peyrot 1c5ce4c2cc DRM: Add support for HDMI content type
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>
2022-11-03 15:40:00 +00:00
Harsha M M 2e39630214 ivi-shell: Set view mask solely based on source rectangle
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>
2022-11-03 12:27:42 +02:00
Derek Foreman 166ef1ad66 fullscreen-shell: refactor configure_presented_surface
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>
2022-11-03 10:22:47 +00:00
Derek Foreman de306e4601 input: make sure pointer->focus is set before trusting pointer->sx,sy
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>
2022-11-02 10:25:15 +00:00
Derek Foreman 9b5a525a3d input: Be more careful with pointer surface coordinates
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>
2022-11-02 10:25:15 +00:00
Derek Foreman 4d141a7881 libweston: Don't return coordinates from weston_compositor_pick_view
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>
2022-11-02 10:25:15 +00:00
Derek Foreman 9409ce7024 input: Don't test bogus coordinates in surface jump logic
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>
2022-11-02 10:25:15 +00:00
Derek Foreman eed00f679e input: Don't pass surface coordinates to weston_pointer_set_focus
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>
2022-11-02 10:25:15 +00:00
Derek Foreman fe0292d272 desktop-shell: Use the current pointer location for grab start
0, 0 doesn't make much sense, since we're not warping the cursor.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-02 10:25:15 +00:00
Derek Foreman 2995bc981d input: Complain if we focus a surface with a coordinate outside it
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>
2022-11-02 10:25:15 +00:00
Derek Foreman e2e0a73335 compositor: Factor out check if a view takes input for a point
Make this into its own function so we can use it for sanity checks later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-02 10:25:15 +00:00
Michael Tretter 266e2e1d48 ivi-shell: fix cleanup of desktop surfaces
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>
2022-11-02 10:38:39 +01:00
Derek Foreman 160a4ba3ad data-device: Split set_focus and clear_focus
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>
2022-10-27 12:17:51 -05:00
Derek Foreman c754847d68 data-device: Refactor grab and touch grab focus handlers
Reduce a tiny bit of code duplication.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-10-27 11:31:08 -05:00
Derek Foreman 5079f0b2f9 helpers: Add a u64 from 2 u32 helper
We do this enough that having a single implementation for it is probably
a win.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-10-27 08:13:30 +00:00
Derek Foreman 2ca2eac39a libweston: Split notify_pointer focus into notify/clear
This lets us say what we really mean instead of passing a NULL output
and garbage co-ordinates.

This will help later when manufacturing garbage coordinates becomes much
harder to do.

The clear_pointer_focus() path continues to do nothing, and is just a FIXME
macro, as it has been for a very long time...

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-10-25 15:58:24 -05:00
Michael Olbrich bdc39b5909 ivi-layout: fix rectangle calculation by calc_inverse_matrix_transform()
It's ok if the rectangle is too large: If the calculation fails, the
bounding rectangle is used anyways. However, a rectangle that is too small
will create incorrect results. So make sure to round all edges outwards.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-10-24 17:37:05 +03:00
Alexandros Frantzis 723709aa07 kiosk-shell: Don't use a modifier for surface activation bindings
The mouse button and touch bindings to activate a surface shouldn't
use the binding modifier.

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/679

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2022-10-21 15:19:18 +03:00
Michael Tretter c56e69bc85 ivi-shell: fix free in get_layers_under_surface
If a controller requests the layers under a surface that has no views attached,
Weston crashes since it tries to free the array that would be used to return the
found layers, but has not been allocated before.

Free the ppArray only if it was allocated in ivi_layout_get_layers_under_surface
before and no layers were found.

While at it, make it obvious that checking the length is an integer comparison
by comparing it to 0.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2022-10-19 14:16:06 +02:00
Philipp Zabel 2f0be4b4d0 backend-vnc: use configured keymap
Use the keymap rules/model/layout configured in the weston.ini [keyboard]
section.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-10-18 16:06:13 +02:00
Philipp Zabel 5cd87ff801 backend-vnc: implement direct key code handling
Allow clients that support the QEMU Extended Key Event Message to send
keycodes directly.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-10-18 16:06:13 +02:00
Philipp Zabel ad936f1de8 man: add a man page for the VNC backend
Add a new weston-vnc man page, based on the weston-rdp man page.
Also add links in the main weston man page.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-10-18 07:31:42 +02:00
Stefan Agner 12f7665310 backend-vnc: add VNC support using Neat VNC library
This adds basic VNC protocol support using the Neat VNC library
(https://github.com/any1/neatvnc). Neat VNC depends on the AML main
loop library. The backend makes use of AML's integrated epoll backend
and connects AML via file descriptor with the Wayland event loop.

This implementation does not support authentication and hardcodes the
pixel format currently.

Co-authored-by: Philipp Zabel <p.zabel@pengutronix.de>
Co-authored-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Stefan Agner <stefan@agner.ch>
[r.czerwinski@pengutronix.de:
 - use new (as of 0.5.0) Neat VNC buffer API, with a buffer pool]
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
[p.zabel@pengutronix.de:
 - transform repaint damage to output coordinates
 - transform pointer coordinates into global space
 - check that outputs and heads are in fact ours, see aab722bb1785..060ef82d9360
 - track damage across multiple frame buffers
 - choose pixel format by drm_fourcc, see 8b6c3fe0ad
 - enable ctrl and alt modifiers
 - fix frame timing to achieve a constant repaint rate
 - pass initial size explicitly, see f4559b0760
 - use resize_output with pixman-renderer, see 55d08f9634e8..84b5d0eb4bee
 - allow configuring the refresh rate]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-10-18 07:31:42 +02:00
Philipp Zabel 9e5922744d ci: Build and install aml and neatvnc
Since aml and neatvnc are not packaged yet, build them from source and
install them into the container image, to prepare for building the VNC
backend.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2022-10-14 20:36:49 +02:00
Pekka Paalanen 60c47701c3 Revert "CI: work around Gitlab Cobertura parsing quirk"
This reverts commit f6ff85b1b7.

This hack should not be needed anymore for Gitlab at freedesktop.org.

Mainly I worry that it might throw pycobertura off track in a
future patch.

See also: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1027

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-10-12 14:45:35 +03:00
Alexandros Frantzis 341d09d232 kiosk-shell: Update view transform after activation.
The activation of a view implies, among other things, a change in the
associated view layer which is initially unset. In order for this change
to be reflected in the corresponding surface's output mask, and hence
allow surface damage to trigger output repaints, we need to update the
view transform.

Fixes #674

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2022-10-11 14:04:42 +03:00
Simon Ser 722f211518 build: deprecate launcher-logind
Deprecate launcher-logind and disable it by default.

launcher-libseat supports logind, so this shouldn't cause any
regression.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wayland/weston/-/issues/488
2022-10-10 13:58:09 +02:00
Robert Mader ff459f0273 simple-egl: Add option for fixed width/height fullscreen ratio
As a realistic scenario used by clients.

The motivation is to have an easy way to test correct fullscreen
behavior of compositors, as they have to compensate for the smaller
buffer size by adding black bars.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-10-05 15:42:35 +03:00
Paul Kocialkowski 0afd3428dc screenshooter: Add SHM buffer destroy listener to avoid invalid memcpy
This adds a destroy listener on the SHM buffer provided by our client.
It will unregister the frame notify listener in case our buffer is
destroyed before the frame signal is emitted and thus avoid a memcpy
to invalid memory.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
2022-10-03 16:52:16 +02:00
Tomohito Esaki 036a76e3eb hmi-controller: don't add surface to layer in mode_random_replace()
There is no need to call layer_add_surface() in mode_random_replace()
because the surface has already been added to the layer. Rather, calling
layer_add_surface() has the issue that the child surface is displayed
below the parent surface.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2022-09-29 11:08:55 +09:00
Tomohito Esaki 9cdb7c7450 ivi-shell: activate keyboard focus for xdg-shell surface
Activate keyboard focus for surfaces created with xdg-shell protocol. If
the surface has child surface, the child surface is activated instead of
the parent surface.

Fixes: #630

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2022-09-29 11:08:55 +09:00
Vitaly Prosyak 52e6052f32 tests/color-icc-output: replace dump file name
Not a functional change. The replacement of const
dump file to use suffix of appropriate sub tests
(sRGB->sRGB, sRGB->adobeRGB, etc).

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-09-28 10:28:28 +00:00
Vitaly Prosyak 6678f8150c color-lcms: add support for matrices
This patch adds the essential LittleCMS color pipeline optimizations and
analysis that is necessary for extracting matrices from pipelines
correctly. When we can extract a matrix and 1D curve sets, we can use
those with GL-renderer without needing an inherently heavy and imprecise
3D LUT. This should improve color transformation precision and
performance when a 3D LUT is not necessary.

The core of the optimization and analysis is a custom plugin for
LittleCMS. The optimization step comprises of repeatedly merging
sequential matrices and sequential curve sets into one and eliminating
identity elements which may allow for more merging. The analysis step
takes the optimized LittleCMS pipeline and attempts to fit all of its
elements into the weston_color_transform model. If it fits, we have an
optimized color transformation and do not need a 3D LUT. If it does not
fit, we use a 3D LUT as before.

Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-28 10:28:28 +00:00
Pekka Paalanen 1874f4db92 color-lcms: add cmlcms_category_name()
This will be used by debug logging and error reporting.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-28 10:28:28 +00:00
Vitaly Prosyak f3277a4fa5 color-lcms: drop locals in cmlcms_color_transform_create()
Restructing cmlcms_color_transform_create for readibility.

Also dropped zalloc() check in favor of xzalloc() as per the recent
Weston development policy.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-28 10:28:28 +00:00
Pekka Paalanen 40e06794ad color-lcms: restructure xform_set_cmap_3dlut()
Right now this function only creates a CMM pipeline and produces a 3D
LUT from it, but in the future it can produce other types of
transformations. The function is renamed to xform_realize_chain()
because it creates a chain of profiles, forms a multi-profile-transform
from them, and fits that into weston_color_transform.

The further refactoring supports the future changes, and attempts to
make the code more readable.

There is provision for easily adding more profiles into the chain.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-28 10:28:28 +00:00
Pekka Paalanen 711b27797d color-lcms: relax cmlcms_fill_in_output_inv_eotf_vcgt()
Relax the types of color transformations categories where this function
can be used. Yes, it is only useful for BLEND_TO_OUTPUT, but that is for
the user of this function to take care of. This function always works as
named regardless. The only condition is that output_inv_eotf_vcgt has
been populated, so fill_in_curves() may as well assert that.

While at it, make the code a little more concise. The 'len' assertion
belongs in fill_in_curves() because that is where the problem would
appear if the assertion failed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-28 10:28:28 +00:00
Vitaly Prosyak 06d89fe192 color-lcms: rename cmslcms_fill_in_pre_curve
Rename cmslcms_fill_in_pre_curve to cmlcms_fill_in_output_inv_eotf_vcgt
due to importance what the function is fetching:
profile->output_inv_eotf_vcgt.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-09-28 10:28:28 +00:00
Vitaly Prosyak 003252a5bb color-lcms: rename output_eotf to eotf
Eotf is the transfer function whose inverse must be used for
converting from output light-linear space to sink electrical space.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-09-28 10:28:28 +00:00