Commit Graph

1672 Commits

Author SHA1 Message Date
Joan Torres a266c5fff5 clients: Add color
Add a client that creates a surface with one color using single pixel buffer.

Set to that surface an image_description created with the parametric creator of
the color management protocol.

This client can get as params:
  1. Width and height
  2. Color channels R, G, B, A
  3. The name of primaries
  4. The name of a transfer function
  5. The min, max, ref luminance levels

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-09-09 13:51:51 +00:00
Joan Torres 53419eb991 clients/window: Allow rendering frame wihout shadow
Rendering the shadow currently renders some dark color near the border inside
the inner content.

Altough the content is on top of it, if the content has some transparency,
that dark color appears and this might be unwanted.

Add an option to not render the shadow to avoid that problem.

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-09-09 13:51:51 +00:00
Joan Torres 1b793b7acd color: update color-management protocol to xx-v4
The main differences is the split of cm_surface functionality with
cm_surface and cm_feedback_surface.

There can only be one cm_surface to set, unset image descriptions. When
cm_surface is destroyed, the image description is automatically unset.

There can be multiple feedback_surfaces for one surface though.
Now the "preferred_changed" signal can be an initial event.

Creator params now have a new request: set_luminances.

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-08-07 13:36:49 +00:00
Loïc Molinari d1ee47361c helpers: Add FALLTHROUGH macro
Use gcc and clang's 'fallthrough' attribute instead of a comment to
fall through switch statements. This allows to request fall through
inside a block and prevents issues with preprocessed files.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-04 14:15:04 +00:00
Loïc Molinari 0729ffbdb8 build: Add generic compiler builtins support
Wrap compiler builtins into shared functions with proper generic
implementations. __builtin_clz() isn't wrapped for now because its use
by screenshooter is pretty specific. It will be properly wrapped in
the next commit which needs a round up to the next power of 2
function.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-06-27 20:40:37 +00:00
Louis-Francis Ratté-Boulianne 1703d76822 clients: add support for surface compression in simple-egl
When option "-c <bpc>" is specified, the application uses
EGL_EXT_surface_compression extension to compress the window
surface to the given bitrate (bits per component).

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
2024-06-20 07:57:38 +00:00
Derek Foreman 2819cb51c6 clients/constraints: Fix up buffer handling
Clear the selected buffer pointer immediately before the array walk to
pick a new buffer so we don't accidentally re-use the attached buffer
when it's already in use.

Set the buffer used bit only when we attach and commit a buffer - this way
we don't accidentally consume all our buffers with no way to have them
released.

Clean up buffers based on wl_buffer presence instead of used at end of
run.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-06-18 16:43:33 +00:00
Leandro Ribeiro 5e84f9167c clients/image: log some information only if verbose mode is set
This patch adds a new CLI option to weston-image: verbose.

It uses that to decide if we should log some info when the image
contains an ICC file embedded.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:42 -03:00
Leandro Ribeiro 5933af7a1d clients/image: allow clients to choose rendering intent
Commit "clients/image: use embedded ICC profile to present image" added
the support to present images with embedded ICC profiles being taken
into account. But the rendering intent was hardcoded to perceptual.

In this patch we allow end users to choose other rendering intents
through command line options.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:42 -03:00
Leandro Ribeiro d76643ee47 clients/image: print program usage
Add function to print program usage. For now this is kind of useless,
but in the next commit we'll add more functionalities to clients/image
command line options.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:42 -03:00
Leandro Ribeiro 576680c780 clients/image: use embedded ICC profile to present image
For image files that have an embedded ICC profile, use the CM&HDR
protocol extension to present taking that into account.

We use the CM&HDR extension to create an image description based on the
ICC profile. Also through the CM&HDR extension we take this image
description and set it to be the surface image description of the
surface in which we present the image.

For now, the rendering intent is hardcoded to be perceptual. In the next
commits we'll allow end users to choose the rendering intent through
command line options.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:42 -03:00
Leandro Ribeiro dbdcae9801 clients: add widget_set_image_description_icc()
This function takes an ICC fd, creates an image description for that and
sets the widget surface image description to this one.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-11 10:15:40 -03:00
Daniel Martinez 2bce726992 clients: fix surface viewport memory leak
Signed-off-by: Daniel Martinez <danielmartinez@cock.li>
2024-06-11 09:33:31 +00:00
Leandro Ribeiro 2ac5777316 clients: make main event loop more robust
This makes the toytoolkit event loop more robust. Now it uses the
canonical wl_display_prepare_read(), read() and cancel().

Also, it allows functions that run before the event loop to create
Wayland queues and dispatch events related to such queue. Before our
changes, this would cause issues, because of how the loop was written
and also because dispatch_queue() reads the display fd and queue them on
the appropriate event queues, it doesn't read only the events related to
the queue we are interested.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-05 10:25:27 +00:00
Jeffy Chen 523a2b75f1 clients/desktop-shell: Reset panel clock timer everytime
In case of the system time changed in between.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2024-05-30 09:22:23 +00:00
Alexandros Frantzis 8988c9436b clients/simple-egl: Allow translucent 16-bit surfaces
This allows users to get r5g5b5a1 configs which currently (in Mesa) interact
badly with EGL_EXT_present_opaque, and act as a good test case for the EGL
implementation.

Users can still get a 16-bit surface without alpha by using the "-o" flag.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2024-05-28 12:22:38 +03:00
Alexandros Frantzis e59eca5187 clients/simple-egl: Add option to use EGL_EXT_present_opaque
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2024-05-28 12:22:38 +03:00
Alexandros Frantzis 479a0247c9 clients/simple-egl: Display RGBA information for selected EGL config
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2024-05-28 12:22:38 +03:00
Marius Vlad f6294962fd clients/simple-damage: Remove zwp_fullscreen support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Marius Vlad 5d78f418a1 clients/dmabuf-v4l: Remove zwp_fullscreen support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Marius Vlad e2c6568dd6 clients/dmabuf-egl: Remove zwp_fullscreen support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Marius Vlad 68214419e9 clients/simple-shm: Remove zwp_fullscreen support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Marius Vlad 50a6411bb6 clients/fullscreen: Remove zwp_fullscreen client support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Jonas Ådahl 6975cf4265 terminal: Avoid too large character grid when resized
When resizing the terminal, the row/columns would end up potentially too tall
and/or wide, meaning the widget would grow each time the window was configured
with a size.

Fix this by making sure the calculated rows and columns don't loose too much
precision, and if they do, shrink instead of grow, as that is expected by the
xdg_toplevel configure event.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2024-05-27 16:28:48 +00:00
Loïc Molinari d4fe0a42fd gl-renderer: Assume axis alignment using node's valid_transform
Assume axis alignment using node's valid_transform boolean instead of
relying on the transform flags of the weston_view struct. This is more
reliable since matrix flags could erroneously hang around after a
series of transforms. Additionally, nodes with standard output
transforms like translations, flips and rotations by 90° can now take
the fast axis aligned path.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-05-27 16:21:21 +00:00
Chirag Khurana 287b3f1758 clients: simple-im: handle proper destruction of objects
Add signal handler for SIGINT to enable graceful exit and
release allocated memory. This resolves the memory leak
observed with Valgrind:

  LEAK SUMMARY:
    definitely lost: 2,520 bytes in 2 blocks
    indirectly lost: 16,820 bytes in 11 blocks
      possibly lost: 0 bytes in 0 blocks
    still reachable: 0 bytes in 0 blocks
         suppressed: 0 bytes in 0 blocks

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

Signed-off-by: Chirag Khurana <quic_ckhurana@quicinc.com>
2024-05-27 13:30:21 +00:00
Leandro Ribeiro 13f09a549d clients/image: do not leak filename
Do not forget to destroy the filename.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro 8af763fb7d clients/image: do not leak cairo surface
Do not forget to destroy the cairo surface.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro ca01b1ff8d clients/image: move a few functions on the file
Cosmetic changes. Move the image_widget handlers closer to each other.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro cfc886fcb3 clients/image: display image in a subsurface
In the next commits we'll add support to extract the ICC information
from the images and use the CM&HDR protocol extension to present them
with the ICC data.

Currently the decorations, background and the image content are
presented on the same surface. As we want to apply the ICC only on the
image content, move it to a subsurface.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro c427ae5a49 clients/image: use widget variable directly
Cosmetic change. Instead of accessing image->frame_widget on the widget
handlers, use the parameter widget.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro c9e76869c4 clients/image: rename widget to frame_widget
In the next commits we'll add another widget to the code, so rename this
one to frame_widget.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
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