Commit graph

8792 commits

Author SHA1 Message Date
Marius Vlad d90533b8ad backend-drm/drm-virtual: Hang off the drm_backend
This is needed by drm_output_fini_egl() to be able to retrieve the
backend out of the drm_output on the shutdown path of the compositor.

Both the remoting plug-in and the pipewire plug-in are users of the
drm-virtual API and as such they would trigger a crash when shutting
down the compositor, as we're not setting up any backend whatsoever.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-20 12:41:03 +02:00
Derek Foreman 583fbcda3b libweston: Use weston_coord in struct weston_pointer
Convert the bare x,y coordinates into struct weston_coord and update all
users.

We keep the surface position in wl_fixed_t for now so it still exactly
matches the position most recently sent to clients.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman 8f33e86cda data-device: convert weston_drag focus functions to weston_coord
More under the hood conversion to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman 3bb09ea3cb input: Use weston_coord for weston_touch functions
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman d07705c7d3 input: use weston_coord for weston_pointer_move_to
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman 84a2a84045 input: Use weston_coord for pointer clamping
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman f7e936ae2a input: Convert weston_pointer_motion_to_abs() to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman b6ec770595 input: Convert weston_view_takes_input_at_point to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman c3cd8306c9 libweston: Pass weston_coords to weston_compositor_pick_view
Continuing to convert things to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Michael Olbrich 39796f88e6 libweston: clear parent_view when the parent view is destroyed
When a view is destroyed then the views of subsurfaces remain until the view
list is rebuilt for the next repaint.
During that time view->parent_view contains an invalid pointer and weston will
crash when it tries to access the view.

This happens for a surface with subsurfaces with views on two different outputs
with the ivi-shell:

When the surface is destroyed then the destroy handler of the ivi-shell
(shell_handle_surface_destroy()) may be called first. It will (indirectly)
destroy the view of the main surface with weston_view_destroy().
Next the surface destroy handler of the subsurfaces
(subsurface_handle_parent_destroy() is called. It will unmap the first view of
the subsurface. Here weston_surface_assign_output() is called which tries to
find the output of the second view and accesses the now invalid
view->parent_view in the process.

There are probably other ways to trigger similar crashes.

To avoid this, clear view->parent_view when the parent view is destroyed.

Fixes 0669d4de4f ("libweston: Skip views without a layer assignment in
      output_mask calculations")

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-16 14:56:10 +01:00
Philipp Zabel 7222171d81 backend-wayland: reuse backend->formats[0] as pixman/cairo/shm pixel format
The pixel format stored in backends->format[0] is effectively looked up
via pixel_format_get_info(DRM_FORMAT_ARGB8888). Reuse that instead of
looking up the same via pixel_format_get_info_by_pixman(PIXMAN_a8r8g8b8)
in multiple places.

There are still two instances of hard-coded CAIRO_FORMAT_ARGB32 in
wayland_output_get_shm_buffer() that currently can not be obtained from
pixel_format_info.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-16 09:48:55 +00:00
Vasyl Vavrychuk 5e1fa146a6 build: fix meson sandbox violation when using wayland-protocols as subproject
When a dependency path is converted to string and dependency is a
subproject, then accessing such file fails in meson with:

    ERROR: Sandbox violation: Tried to grab file ... from a nested subproject.

Use '/' operator as documented in
https://mesonbuild.com/Dependencies.html#dependencies-that-provide-resource-files

Fixes: #715
Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
2023-02-14 13:35:10 +00:00
Leandro Ribeiro 831e36c7d9 Revert "desktop-shell: avoid alternating surface between outputs"
This reverts commit 4eea291512.

There were some details and cases that I've missed when writing this
commit, resulting in some weird behaviors. Trying to cover all of them
became a nightmare, and the function got really hard to read.

So it's better to revert this commit and think about other possible
solutions for the issue.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-02-14 13:09:36 +00:00
Jonas Ådahl 9c511fedba compositor: Don't overwrite offset on attach
If the wl_surface resource has version 5 or newer, we should always
ignore the offset parameters in wl_surface.attach.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-02-14 11:34:50 +02:00
Tran Ba Khang(MS/EMC31-XC) f866dfaa09 hmi-controller: doesn't do a configuring when surface has no content
ivi-shell has allowed to notify a surface configuring when detecting
an unmapping commit. To avoid the commit_change with source_width
and source_height are zero, we should don't do a configuring when
surface has no content.

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-14 11:23:57 +02:00
Tran Ba Khang(MS/EMC31-XC) fe392d23b9 ivi-shell: add commit_current into ivi_layout interface
If a client commits a null buffer, weston will unmap all the views of
the surface and marks it is unmapping. In the case, the client commits
a new valid buffer, then the controller wants to rebuild the views
without applies the pending properties of surfaces and layers.
The ivi_layout_interface should prodive an interface for this.

Suggested-by: Michael Olbrich's avatarMichael Olbrich <m.olbrich@pengutronix.de>
Suggested-by: K J Rajendraprasad's avatarRajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-14 11:23:57 +02:00
Derek Foreman 5e7b4d0c00 input: Use weston_coord in add_border
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 905d16d23b input: Use weston_coord for weston_pointer_motion_to_rel
Use weston_coord for some internal stuff.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman d5132c6516 input: Convert vec2d to weston_coord
No need for two vector structs.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 69908000e3 input: Convert weston_pointer_motion_event to weston_coord
This struct has a lot of members that can be converted to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 8031b9d57f backend: Make input notification functions use weston_coord
Push weston_coord into the notification functions instead of passing
two doubles.

The touch handlers are passed a pointer to a weston_coord, which is
unusual. This is done so we can pass a NULL pointer instead of a
fabricated invalid coordinate when the touch type is TOUCH_UP.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 3ef8bb9935 tests: Don't send real coordinates with WL_TOUCH_UP events
Wayland protocol can't do this, but the way our test protocol handles
touch through a single event can - ensure that we don't by accident.

This will matter more shortly when we add assert()s to prevent having
coordinates with WL_TOUCH_UP events internally later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 4d0ce16669 libweston: replace weston_output_transform_coordinate
This creates a global coordinate from a device coordinate.

Replace it with weston_coord_global_from_output_point() which
does the same thing and returns a weston_coord_global.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 10e70bf23c clipping: Use struct weston_coord in vertex clipping code
Remove the independent x, y floats from the clipping code and replace them
with struct weston_cord. This includes the polygon8 structure as well.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Michael Olbrich f7609553a9 ivi-shell: remove some unnecessary checks
Both functions are callbacks that are added when the ivi_shell_surface is
created and removed when it is destroyed, so get_ivi_shell_surface() will never
return NULL here.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-07 15:43:18 +01:00
Michael Olbrich 2c96bdbdbf ivi-shell: simplify surface creation
The weston_surface passed to surface_create() should never be NULL. And other
code already relies on that anyway, so just remove the check.

Now surface_create() will never fail, so more checks can be removed.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-07 15:43:18 +01:00
Michael Olbrich c4fab1633b ivi-shell: use x*alloc for small allocations
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-07 15:43:18 +01:00
Derek Foreman c7b9625775 input: Don't assert when sending touch motion
If a window is clicked with a mouse while it's being interacted with via
touch input, the assert from 2dc8680d will fire.

This is a leftover from d611ab24

Update the transform before converting the coordinate to fix this.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-07 16:28:25 +02:00
Marius Vlad 27ce9dadd8 backend-drm: Do not overwrite plane's index when creating virtual plane
Starting with commit 4cde507be6 "backend-drm: fix plane sorting" the
plane list will have a descending order of the planes rather than ascending.

This reversed order had the side-effect of exposing the fact that we
don't set-up a plane index when creating the drm_plane using the DRM
virtual API. Without settting a plane index for that drm_plane we
effectively overwrite the plane index which has the 0 (zero) entry.

This wasn't an issue before commit 4cde507be6 "backend-drm: fix
plane sorting" as it seems we never picked up that plane index as
being a suitable one due to the fact that those were assigned to primary
planes, but after that commit, the cursor plane will be one getting
the 0 (zero) plane index.

Finally, this would trip over because we attempt to place a (cursor)
view on a primary plane (where it would've normally be a cursor
plane) and we end up with no framebuffer ref.

This is fixed trivially by assigning a plane index, different than the
ones already created by create_spirtes().

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-07 16:24:07 +02:00
Leandro Ribeiro ba82af938a desktop-shell: do not forget to reset pending config size after resizes
During interactive resizes, we progressively change the size of the
client surface and send config events with these sizes to the client.
After that, the toplevel->pending.size keeps the size of the last config
event that we've sent, i.e. the surface size after the resize is over.

Later, if the client spontaneously resize (by attaching a buffer with a
different size or setting the viewport destination, for instance), their
surface size will change, but toplevel->pending.size continues being
that old size from after the resize. If something happens and Weston
decides to send a config event, clients may re-allocate to that old
size, resulting in a sudden resize.

This does not happen when a client goes from fullscreen/maximized to
windowed mode because in such cases we are resetting
toplevel->pending.size to zero. So in the next config event that clients
receive they are allowed to attach buffers with the size that they
prefer.

So do the same after a resize: set the pending config size to zero.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-02-07 09:59:16 +00:00
Philipp Zabel 7c1492216e backend-x11: split x11_output_get_pixel_format out of x11_output_init_shm
Split x11_output_get_pixel_format() out of x11_output_init_shm() so the
pixel format can already be known when calling pixman->output_create().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-07 09:32:31 +00:00
Derek Foreman 8571b844af libweston: Fix broken paint node list walk
Outputs store nodes on the output_link.

Fixes !1118

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-06 08:23:52 -06:00
Derek Foreman 9d24fb96fb xwm: Be careful with window size when minimizing
If we're minimized from maximized or fullscreen state, we want to leave
the saved size alone, so we can restore it if we clear fullscreen or
maximized state later.

Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
2023-02-03 11:02:51 +02:00
Philipp Zabel 3560da1255 frontend: make x11 backend honor the renderer option
If the --renderer option was given, do not let the x11 backend choose
the renderer on its own.

Fixes: 75b3ecfcc3 ("frontend: Add common --renderer=foo argument")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel a222ce03c7 backend-x11: create renderbuffer when pixman output state already exists
Reorder pixman renderer output state and SHM renderbuffer creation and
removal to make sure the pixman renderbuffer list is empty when the
output state is destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel 918ec64f6a backend-x11: fix pixman output state creation
Pixman output state creation requires a valid pixel format to be set for
weston_output_update_capture_info().

Fixes: c67773bc5c ("pixman-renderer: use pixel_format_info instead of pixman_format_code_t")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel 2914f28fd1 backend-wayland: destroy renderbuffer before renderer output state
Reorder pixman renderer output state and SHM renderbuffer removal to
make sure the pixman renderbuffer list is empty when the output state
is destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel 2a6c1afced backend-wayland: fix pixman output state creation
Pixman output state creation requires a valid pixel format to be set for
weston_output_update_capture_info().

Fixes: c67773bc5c ("pixman-renderer: use pixel_format_info instead of pixman_format_code_t")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Daniel Stone e07be58dc4 gl-renderer: Use highest precision for vertex shaders
Whilst GLSL requires highp for the vertex shader stage, highp is
optional for the fragment shader.

Make sure that we work in highp by default during the vertex shader
stage, using either highp or mediump for the texcoord varying according
to what the fragment shader supports.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-02-02 21:46:06 +00:00
Derek Foreman e471edb33d drm-backend: Enable plane rotations
Search for planes that support the rotation required to properly display
a paint node, and properly set coordinates and rotation properties.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman b0f23dc09d backend-drm: Set rotation property on planes when possible
For now we just always set the plane up to have a "normal" rotation, so
no new features are added with this commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman f89f440735 kms: Add plane rotation property
Add plane rotations to our recognized properties.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman 397ed8cec5 kms: Support bitmasks
From our perspective, a bitmask is pretty much the same as an enum, so
allow it to use the same path.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman e3ec879d11 drm-backend: Cache paint node transform
Instead of calculating this multiple times, just store it in the paint
node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:54 -06:00
Derek Foreman da3d3c7e95 compositor: Add dirty bits to paint nodes
We're pushing more and more mutable state into paint nodes, but this state
has a non-zero cost to rebuild every render.

Let's take care to track when we need to rebuild the state.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 13:49:39 +00:00
Tran Ba Khang(MS/EMC31-XC) 776fafe13a libweston/desktop: committed when transiting from valid to invalid buffer
Every shells have an implementation of weston_desktop_api structures.
It includes some callbacks to listen to xdg_surface signals. Committed callback
is one of them.

Currently, the xdg_shell don't invoke the weston_desktop_api->committed
callback when the xdg_surface is initial stage or no surface content.

In the case: the client attached a null buffer after the valid buffer,
the shell isn't going to invoke to xdg_surface committed, and don't know
the surface is disappeared. If the surface is fullscreen, we will get
a black background on the screen until a new valid frame come. That
should not happen.

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-02 11:05:19 +02:00
Tran Ba Khang(MS/EMC31-XC) 7ba87d7062 libweston: support API to detect an unmapping commit of surface
Add the weston_surface_is_unmapping() api, this will help the shell
to detect the commit of a surface is unmapping or not.

Suggested-by: Morgane Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-02 11:03:10 +02:00
Philipp Zabel 51ef88a7f4 backend-vnc: destroy renderbuffer before renderer output state
Reorder pixman renderer output state and renderbuffer removal to make
sure the pixman renderbuffer list is empty when the output state is
destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-02 10:58:14 +02:00
Derek Foreman 8057f28b98 backend-drm: Support tearing
Allow tearing for clients that request it, provided we can put their
content on a plane.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman 9203d98f8b backend-drm: Check for the atomic tearing capability
Check if our drm device supports atomic async page flips.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00