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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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")
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>
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>
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>
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>
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>