Commit Graph

1640 Commits

Author SHA1 Message Date
Loïc Molinari 946bb51a2a gl-renderer: Test axis alignment once per paint node
The axis alignment test is part of the damage transformation routine
executed for each damage rect. Extract it in order to compute it once
per paint node.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-03-05 11:48:17 +00:00
Diego Nieto 4261892d77 clients/simple-damage: fix exiting message
Signed-off-by: Diego Nieto <diego.nieto.m@outlook.com>
2024-02-20 10:04:57 +00:00
Pierre Le Marre 8aa14f0d39 simple-im: Fix modifiers
There is a typo in the call to `zwp_input_method_context_v1_modifiers`:
the `mods_latched` and `mods_locked` arguments have wrong values.

Fixed by forwarding the correct masks.

Signed-off-by: Pierre Le Marre <dev@wismill.eu>
2024-01-30 17:29:39 +00:00
Dylan Aïssi 884b4a8c9a clients: fix typo: intialized -> initialized
Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
2024-01-25 21:41:34 +01:00
Colin Kinloch 3f919e3d92 clients/stacking: Fix widget user_data cast type
This used to not be a problem as both `struct stacking` and `struct
window` start with a pointer to `struct display`.

Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2024-01-15 13:57:08 +02:00
Colin Kinloch 785f904142 clients/stacking: Allow windows to be closed
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2023-12-08 17:36:20 +02:00
Derek Foreman 128a461b8f clients/simple-egl: Allow setting the swapinterval
eglSwapInterval() is intended to allow capping the frame rate to a divisor
of the display rate. This may not work if the GL library simple-egl is
using doesn't support it well.

It's still useful to test, so add a way to set it.

Signed-off-by: Derek Foreman <derekf.foreman@collabora.com>
2023-12-06 11:27:03 -06:00
Loïc Molinari 42205628bf gl-renderer: Prefix clipper API
Prefix and slightly rename the clipper structs and funcs:

  - struct clip_vertex -> struct clipper_vertex
  - struct gl_quad     -> struct clipper_quad
  - clip_transformed() -> clipper_clip()
  - init_quad()        -> clipper_quad_init()
  - clip_quad()        -> clipper_quad_clip()
  - clip_quad_box32()  -> clipper_quad_clip_box32()
  - float_difference() -> clipper_float_difference()

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2023-12-05 10:54:39 +00:00
Loïc Molinari 2d0d0175d2 gl-renderer: Add init_quad() to clipper
Extract quad bounding box initialization from the GL renderer and move
it to a dedicated initialization function in the clipper. It's used by
both the renderer and the clipping test client, which further reduces
code duplication.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2023-12-05 10:54:39 +00:00
Loïc Molinari bf222f1897 gl-renderer: Use clip_vertex struct for boxes in clipper API
Carry on the common vertex representation front by making boxes use
the clip_vertex struct.

A new function clip_quad_box32() is added to clearly separate the main
function taking a clip_vertex struct from the utility function taking
a pixman_box32 struct.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2023-12-05 10:54:39 +00:00
Loïc Molinari b8063dbb13 gl-renderer: Remove polygon8 struct from clipper API
Pass a clip_vertex struct and a size to clip_transformed() instead of
a polygon8 struct to simplify the clipper API by sticking to a common
vertex representation.

Simmplify vertex-clip test since clip_transformed() now works on a
copy of the polygon (commit edd5d1cc09).

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2023-12-05 10:54:39 +00:00
Arnaud Vrac 59207a7c7c clients/desktop-shell: fix crash on init when panel is disabled
The same output might be inited twice on init when the shell panel is disabled,
depending on the order the weston_desktop_shell and wl_output globals are
advertised. This triggers a protocol error as only one background can be created
per output.

Since initializing the output requires the weston_desktop_shell global (to
create the background and panel on this output), the output init call is done
conditionally in two places: in the global registry handler (to handle output
hotplug) and after the initial wl_display_roundtrip call to handle the case
where the weston_desktop_shell global was notified after the outputs.

We now check the output has already been initialized correctly by checking if
the background has been created, instead of the panel which is not always
created.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2023-12-01 12:44:24 +01:00
Daniel Stone 9ced4a4f3a weston-keyboard: Create input_panel_surface earlier
If we only create the input_panel_surface after we've already created
the window and tried to get some content for it, then we're never going
to enter the input_panel_surface committed handler, so we'll never get
the chance to properly map the surface.

Follow the other surface types by creating the input-panel surface
before we try to attach anything to it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: bdf2019e ("desktop-shell: Map input panel surfaces before views")
2023-11-21 13:30:51 +00:00
Aske Bækdal Møller 33ec3898d0 clients: keyboard: fix delete before cursor
When editing a text field in chromium deleting the surrounding text with
backspace fails with `The selection range for surrounding text is invalid`

It seems like `(start - keyboard->surrounding_text) - keyboard->surrounding_cursor` evaluates to -1.

As far as i can tell `start - keyboard->surrounding_text` evaluates to
the index in the surrounding_text char arrays that should be deleted.

Signed-off-by: Aske Bækdal Møller <aske@geanix.com>
2023-11-13 17:03:47 +02:00
Tomohito Esaki 608e1ee86d ivi-shell-user-interface: change timing to create the launcher surface
Since hmi-controller adds surfaces to layers when creating ivi surfaces,
the launcher will appear on startup. As before, the launcher surface is
created before the background surface so that the background will appear
on startup.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-10-16 16:24:19 +00:00
Derek Foreman 4f60fd9394 clients: Add opaque region setting to simple-damage
There aren't a lot of great opaque region tests, and this one is simple
to extend.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-09-16 08:46:03 +03:00
Robert Mader 68e2a606c0 clients/simple-dmabuf-v4l: Add pointer support
To make the app a little bit more pleasant to work with and, crucially,
makes the cursor hide in fullscreen mode. This is useful when testing
hardware planes on devices with no cursor plane / a single primary plane.

Also add an option to keep the cursor around in fullscreen mode.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-08-31 21:32:36 +00:00
Robert Mader 6cee95af37 client/simple-dmabuf-v4l: Add fullscreen support
Effectively making the app behave very similar to a simple video player.
It was useful to me for testing hardware plane YUV support, so it's
likely worth upstreaming.

If available, wp_viewporter is used to scale up the image. The width to
height ratio is kept, allowing to further test black bars in fullscreen
mode.

For now scaling is only applied if xdg-shell is used.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-08-31 21:32:36 +00:00
Robert Mader bf209e3985 clients/simple-dmabuf-v4l: Use interface name variables
It's good practice nowadays, so let's be a good example.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-08-31 21:32:36 +00:00
Robert Mader d5753805b7 clients/simple-egl: Use interface name variables
It's good practice nowadays, so let's be a good example.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-08-31 21:32:36 +00:00
Tomohito Esaki d31ab9163d clients/simple-dmabuf-egl: Drop support libgbm older than 21.1.1
Since clients using dmabuf require libgbm 21.1.1, there is no need to
support the old libgbm which does not support modifiers.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-08-09 21:45:42 +03:00
Tomohito Esaki fef8410866 clients/meson.build: Require libgbm 21.1.1 for clients using dmabuf
Since drm-backend requires libgbm 21.1.1, client samples using dmabuf
should be similar to drm-backend.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-08-09 21:45:42 +03:00
Tomohito Esaki 1ffd387d0e clients/simple-dmabuf-feedback: Drop support libgbm older than 21.1.1
Since simple-dmabuf-feedback requires libgbm 21.1.1, there is no need to
support the old libgbm which does not support modifiers.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-08-09 21:45:42 +03:00
Marius Vlad 5b1207a425 Revert "clients/window: Update min_allocation for smaller widths/heights"
This seems to break interactive resize, giving invalid/0/negative values
to pending allocations.

This reverts commit 9555118095.

Fixes: #780
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-07-19 14:40:03 +03:00
Simon Ser 8c4128df5d clients/simple-dmabuf-feedback: do not block until rendering completes
glFinish() blocks until all commands have finished. This is
unnecessary: we can use glFlush() and rely on implicit sync
instead.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-07-14 10:49:44 +00:00
Simon Ser 0349f15269 clients/simple-dmabuf-egl: do not block until rendering completes
glFinish() blocks until all commands have finished. This is
unnecessary: we can use glFlush() and rely on implicit sync
instead.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-07-14 10:49:44 +00:00
Marius Vlad 9555118095 clients/window: Update min_allocation for smaller widths/heights
This makes sure we update min_allocation in situations where the
width and height passed is smaller than the one set previously
(obviously except for the first time). This has the side effect of
not overwriting pending_allocations such that we correctly resize when
passed a width/height smaller the ones set-up in the past.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-07-05 21:28:16 +03:00
Derek Foreman f0196739ae toy-toolkit: Fix rotations
Ever since commit 3012934 some rotations have been broken. This is because
I transposed xy and yx in the cairo_matrix_init() call.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-27 11:41:35 +00:00
Sergio Gómez 03aeb4bd83 clients: Replace 'confine' client to showcase pointer constraints in general
The 'confine' client is used to showcase the behavior of pointer confinement
through the interface zwp_confined_pointer_v1.

Since zwp_confined_pointer_v1 is part of pointer constraints in general, which
includes pointer locking, it makes sense to augment the scope of the client so
it can serve as a showcase for this category of interfaces through
zwp_pointer_constraints_v1.

Currently 'confine' relies on, and is designed around the limitations of, the
toytoolkit. Adapting the toytoolkit for the new requirements proved
unproductive, especially since we wish to add support for pointer constraints in
sub-surfaces. Hence the solution adopted was to write a new client that would
replace the previous one.

This patch introduces the new client, 'constraints.c', replacing 'confine.c'.

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-06-14 16:26:34 -05:00
Loïc Molinari fff8dbd9b8 gl-renderer: Move clip_quad() to clipper
clip_quad() is a dedicated clipping function for quads that doesn't
depend on any GL renderer internal structures. It can be moved out to
the clipper to be called by both the renderer and the clipping test
client without having to duplicate code.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari 3d94f943a6 gl-renderer: Update HTTP links to vertex clipping resources
Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari 39fee794b5 gl-renderer: Get rid of axis-aligned bbox check in simple clipper
Since both the surface rect and the transformed quad are axis-aligned
in the simple clipping path, non-zero area detection can more
efficiently be checked post-clipping by comparing opposite edges.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari d34f35c904 gl-renderer: Use simple clipper on translated and/or scaled nodes
Add a basic check to let the clipper take the simple axis-aligned path
when nodes are solely transformed with a translation and/or a scaling.
That makes some nodes like sub-surfaces (which always have their
transform enabled) take the fast path in the common case.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari 49053a2aa2 gl-renderer: Store clipped vertices directly into the vertex buffer
Move vertex clipper back to single-precision floating point
intermediates. Since positions are sent down the graphics hardware as
single-precision values, this prevents useless conversions between
single and double precision values and lets compilers fit twice as
much data into vector registers. It also removes a copy by letting the
clipper store vertices directly into the vertex buffer.

This is mostly reverting the conversion to double-precision that
happened along with the switch to the weston_coord struct for vertex
coordinates (commit 10e70bf23c).

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari a4d31fa8bd gl-renderer: Decouple coord space transformation from clipper
The clipper transforms dirty rects to surface space before clipping.
Each dirty rect is transformed by the same matrix for each surface
rect. This change decouples the transformation and the clipping code
to transform and compute the bounding box of dirty rects just once.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari 54bce80c73 gl-renderer: Clip and dispatch vertices in surface coord space
Clip dirty rects to surface rects in surface coordinate space.
Dispatch vertices in surface coordinates and let the graphics hardware
handle the transformations. Clipping in global coordinate space
implies a useless roundtrip on the CPU to get the clipped polygons
back in surface coordinates for the buffer transformation. Clipping in
surface coordinate space prevents that.

This might seem counter-intuitive at first because in surface space
it's the dirty rects that are clipped to axis-aligned surface rects,
while it's the opposite in global space.

The projection matrix now combines the view and the output transforms.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Simon Ser fe49534488 clients/scaler: check viewporter availability
I just got bitten by this: I thought my compositor was dropping
the viewport somehow, but it just didn't expose the viewporter
global.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-05-02 18:02:33 +03:00
Sebastian Wick 34400d7d16 clients/simple-dmabuf-feedback: get buffer size from configure events
instead of the output mode. The mode doesn't say anything about the
actual output geometry which could lead to buffers extending the output
region on rotated monitors. This now also works with moving the window
to different monitors.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-04-20 11:42:15 +00:00
Sebastian Wick 6c27f0b87c clients/simple-dmabuf-feedback: create buffers on demand
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-04-20 11:42:15 +00:00
Sebastian Wick 62d7a46ba2 clients/simple-dmabuf-feedback: fullscreen surface from the start
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-04-20 11:42:15 +00:00
Sebastian Wick 57cba6afb4 clients/simple-dmabuf-feedback: fix dangling pointers
to presentation feedback objects.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-04-20 11:42:15 +00:00
Bram Stolk 26de6e35a9 simple-dmabuf-v4l: Add support to NV12 devices that combine planes
There are V4L2 devices that will output NV12 but will do so using one dma
buffer. To support this, we need to add the same dma buffer twice but with
a different offset for the chrominance plane.
Also supports situations of 3 planes (e.g. YU12) inside a single dma buffer.

Fixes: #712
Signed-off-by: Bram Stolk (b.stolk@gmail.com)
2023-04-18 10:57:55 +00:00
marius vlad 1446d9cb3c client-shm: Add basic keyboard support
And use it to exit with using the KEY_ESC, similar to simple-egl.
This was ripped from simple-egl ad litteram.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-04-12 14:40:38 +03:00
marius vlad 2e0b67e5be simple-shm: Add maximized/fullscreen support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-04-12 14:40:38 +03:00
marius vlad cd634c34ed simple-shm: Use buffers as a list
Rather than having them as an array. This would simplify handling of
maximized and fullscreen and make things easier to reason with.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-04-12 14:40:38 +03:00
Marius Vlad 76f689e370 simple-touch: Add maximized/fullscreen states
Helpful to have other states like maximized or fullscreen for
the simple-touch client.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-04-12 14:40:38 +03:00
Michael Olbrich 14fc87cc42 clients/window: dismiss window on tablet tool up events
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Lyude Paul 0b0c6e7ad7 clients: Add demo application for tablets
Note that this application does not follow best practices for handling tablet
events. The events are grouped by frame, all processing should be done in the
frame instead of the respective handler.

A good toolkit would accumulate the data in the events and provide them as one
event to the actual client once the frame is received. toytoolkit just hooks
up the handler one-by-one, so we're doing this here as well.

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Bastian Farkas <bfarkas@de.adit-jv.com>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Lyude Paul 017eac1a6b clients/desktop-shell: Add tablet support to the top panel of the desktop shell
Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Bastian Farkas <bfarkas@de.adit-jv.com>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Lyude Paul 6a06669b58 clients: Add support for tablet cursor motion to window frames in libtoytoolkit
When it comes to a window frame, a tablet tool and cursor act almost
identical; they click things, drag things, etc. The tool type and extra
axes don't serve any use in the context of a window frame, so tablet
pointers share the frame_pointer structures used for the mouse pointer.

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Bastian Farkas <bfarkas@de.adit-jv.com>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00