Commit Graph

9312 Commits

Author SHA1 Message Date
Chao Guo
8e0e75999e compositor: improve viewport source validity check
If client changes the buffer transform or size and re-commit the surface
before surface dirtys buffer (weston_surface_attach), the viewport
source validity check may fail. Because the width_from_buffer and
height_from_buffer cannot be updated based on new buffer transform.

Therefore, add the situation of size dirty (WESTON_SURFACE_DIRTY_SIZE) to
source validity check, width_from_buffer and height_from_buffer can be
updated in time when the buffer transform and scale change.

Signed-off-by: Chao Guo <chao.guo@nxp.com>
2024-01-12 13:44:03 +00:00
Zhou Liang
b288e662d6 backend-drm: fix deinit unexpected connector
The `drm_output_deinit` should use the drm device passed by the
function, should not use the `b->drm` device.

Signed-off-by: Zhou Liang <174381115@qq.com>
2024-01-12 12:11:45 +00:00
Zhou Liang
66aaa41074 backend-drm: fix drm add connector to unexpected drm device
If both the head and writeback are not found, then we should add
connectors to the drm device passed by the function, not the b->drm
device.

Signed-off-by: Zhou Liang <174381115@qq.com>
2024-01-12 12:11:45 +00:00
Zhou Liang
8b3becf524 backend-drm: fix drm find wrong connector
In a multi-GPU environment, different cards may contain connectors with the
same ID, and drm_head_find_by_connector just use the connector_id to find
the connector, it may find the wrong connector.
Fix this by find the connector based on the drm device and connector id.

Signed-off-by: Zhou Liang <174381115@qq.com>
2024-01-12 12:11:45 +00:00
Robert Mader
5a2509ffb1 backend-drm: Don't force non-opaque overlays to primary plane
If a view is non-opaque - such as an overlay over a video - we shouldn't
force it to be on the primary plane, as that's where the underlying
content should be placed, such as the video view.

dc0de9ee already mentioned: "This check should be changed in future to
only filter for opaque views, but that's for another time."

Adding "Fixes" at this is arguably a bug fix:
Fixes: dc0de9ee (backend-drm: Move overlay vs. primary plane check earlier)
Fixes: 2538aacc (backend-drm: Construct a zpos candidate list of planes)

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2024-01-11 15:57:09 +01:00
Derek Foreman
2abe4efcf7 libweston/backends: Move damage flush into backends
Currently we flush damage for the "primary plane" every repaint, but this
is folly.

The drm backend may skip rendering entirely if using an all-planes
composition. This could leave the renderer plane in a messy state if a
surface on an overlay plane disappears.

Instead, let the backends flush the primary plane damage when they know
they need to render.

Fixes #864

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-01-10 14:13:09 -06:00
Marius Vlad
04d9f7e738 libweston/animation: Remove weston_fade_run unused argument
And with it, bump libweston to next major version, 14. We seems like
we never used that argument so better just removed it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-01-09 13:15:16 +02:00
Jeffy Chen
b074186836 libweston: Avoid double-destroy of animations
The idle_animation_destroy task should be removed when destroying
animations by the other callers such as handle_animation_view_destroy().

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2024-01-05 09:08:03 +08:00
Michael Olbrich
d6681cedee ivi-shell: clear seat focus if necessary when a surface is destroyed
Otherwise shseat->focused_ivisurf can point to deleted memory.
This does not happen with the hmi-controller because it explicitly assigns a new
focused surface. But the ivi-shell should not relay on the controller here.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-12-18 21:39:24 +00:00
Khem Raj
dbd134ca5a libweston,tools: Include libgen.h for basename signature
Latest musl has removed the declaration from string.h [1] as it only
implements POSIX version alone and string.h in glibc implements GNU
version of basename. This now results in compile errors on musl.

This might be a warning with older compilers but it is error with
Clang-17+ as it treats -Wimplicit-function-declaration as error

Switch the use in backlight_init function to use POSIX version

[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2023-12-18 21:13:52 +00:00
Pekka Paalanen
336f7fabec Rename compositor/ to frontend/
"Frontend" is a much more descriptive name for the code that is in the
directory called "compositor".

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-12-18 15:34:26 +00:00
Pekka Paalanen
c36bbad8e2 tests: remove unnecessary weston.h includes
Looks like these don't actually need it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-12-18 15:34:26 +00:00
Pekka Paalanen
b84ad9e34c libweston: drop weston_output_init() test workaround
This was added in 4def21c196.

0c1ab2ad76 removed all uses of NULL
weston_compositor, making the workaround unnecessary.

Drop the workaround, it's dead code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-12-15 14:15:22 +02:00
Philipp Zabel
b72785e1f6 libweston-desktop: Work around crash when opening popup menu
Fix a crash when right-clicking on a weston-terminal, where
weston_desktop_seat_popup_grab_add_surface() is called with
seat->popup_grab.keyboard.keyboard == NULL in case there is
no keyboard connected.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-12-11 16:58:01 +01: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
Daniel Stone
a5c5702112 touch-calibrator: Regularise surface/view mapping
Manually mark the surface as mapped exactly once - in the committed
handler where we have our content, and assert that it's correct when we
want to use the surface by instantiating a view.

The view handling can be made much more simple by simply using the new
view helpers.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
61c7afd520 fullscreen-shell: Don't leak outputs
Fixes a memory leak.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
f6a9c3e69c fullscreen-shell: Properly map surfaces
Surfaces are mapped when they have content, and not when they don't. Try
to apply this rule consistently.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
16825359c7 input: Use surface/view helpers for drag surfaces
Use the helpers we have to map and position drag icons.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
6a44272d01 kiosk-shell: Remove unnecessary is_mapped assignment
Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
7f62fe817a input: Use surface/view helpers to map
Use the helpers to map a weston_surface and weston_view, rather than
manually manipulating the internals.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
1f9e0ce9ad input: Use helpers to map surfaces/views
When working on tablet tools, use the weston_surface and weston_view
helpers to manipulate their cursors, instead of manually setting various
members.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Philipp Zabel
ddf4327116 man: Document VNC --address argument
Add missing documentation for the --address command-line argument
that lets the VNC backend listen only on a specified IP address.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-12-06 10:19:32 +01:00
Loïc Molinari
309a546165 gl-renderer: Improve clipper documentation
Add clipper_clip() documentation and improve comments a tiny bit.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2023-12-05 10:54:39 +00: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
f74c5a4102 gl-renderer: Replace clip_transformed() context with a clipping box
Simplify clip_transformed() by replacing its context parameter with a
clipping box parameter. The context struct is still used internally to
pass data around.

Since clip_transformed() doesn't take a context anymore, the clipping
boxes are now declared per test and stored along with the other vertex
data. That prepares the ground to add new tests using different boxes.

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
Loïc Molinari
aac11c8884 gl-renderer: Remove clip_simple() from clipper
clip_simple() isn't used anymore outside of the clipper. This commit
removes it to simplify the clipper API. Its implementation is moved
straight to the axis-aligned quad clipping path of clip_transformed().

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2023-12-05 10:54:39 +00:00
He Yong
903b6b9336 libweston: remove wlr_signal_emit_safe
Signed-off-by: He Yong <hyyoxhk@163.com>
2023-12-04 11:37:22 +02:00
He Yong
98606d6a03 replace weston_signal_emit_mutable with wl_signal_emit_mutable
wayland upstream has introduced wl_signal_emit_mutable
now we can use it

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/208

Signed-off-by: He Yong <hyyoxhk@163.com>
2023-12-04 11:37:17 +02: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
Arnaud Vrac
03fa71f153 desktop-shell: set proper curtain size when no output is created yet
In this case the curtain width and height would be calculated using
uninitialized values, triggering warnings in pixman calls.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2023-12-01 12:43:27 +01:00
Arnaud Vrac
14e0fff19a desktop-shell: clamp view alpha correctly
Clamping of the alpha value is not done properly since the introduction of the
weston_view_set_alpha() helper.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2023-12-01 12:43:27 +01:00
Arnaud Vrac
9c637d70eb gl-renderer: do not use glTexImage3D directly
Resolve the function through eglGetProcAddress instead as it's only defined
starting with OpenGLES 3.0.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2023-11-29 15:13:49 +00:00
Marius Vlad
feec513166 meson.build: reopen main for regular development
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-11-27 20:25:28 +02:00
Marius Vlad
712cdc56ab build: bump to version 13.0.0 for the official release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-11-27 20:01:53 +02:00
Marius Vlad
544618d3c6 build: bump to version 12.0.95 for the RC3 release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-11-21 22:27:38 +02: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
Daniel Stone
bd8a6da2f0 desktop-shell: Map input panel exactly once
When the input panel surface gets something committed to it, we have
content and thus the surface has become mapped. Do this from within the
input-panel surface committed handler.

When we want to show the input panel, this is when we map the view. Do
this exactly once as well, and make sure that we don't attempt to map
the view with an unmapped surface.

This regularises the logic to be the same as almost all the other
special surface users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-11-21 13:30:50 +00:00
Marius Vlad
93e4f4e01f backend-x11: Fix error shutdown path for x11
Another fix for 14c52a942b, 'backend-x11: enable multi-backend support'.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-11-20 16:31:26 +02:00
Marius Vlad
7d7ce84cc6 build: bump to version 12.0.94 for the RC2 release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-11-13 23:08:30 +02: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
Derek Foreman
78657c5ff3 drm-backend: Fix cursor updates with overlapping heads
We can't use the surface damage to determine when to upload new cursor
images because when heads overlap the first repainted head will accumulate
that damage as plane damage.

We can't easily use plane damage either because the plane isn't really
assigned until after an atomic test, which requires the cursor fb to be
current.

Untangle this mess a little by always testing with the first cursor fb,
which is identical to the second in all ways, then replace with the correct
fb in repaint.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-11-10 09:38:41 -06:00
Derek Foreman
bbaba601c8 vnc: Fix cursor updates
Now that overlapping outputs are a thing, we have a problem with vnc
cursors.

The surface->damage used to update the vnc cursor might actually be
flushed by a previous output's repaint cycle, leading to a missing cursor
update to the vnc client.

Instead we should use the damage accumulated on the cursor plane to choose
when to update the cursor. This damage is in output coordinates, so let's
be lazy and just use the presence of damage as an indicator that the
cursor needs an update.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-11-10 09:38:35 -06:00
Derek Foreman
0def955a48 libweston: Don't set VISIBILITY_DIRTY on non-primary planes
VISIBILITY_DIRTY is used to apply damage to the plane, but that doesn't
make sense for non-primary planes.

For example, we don't want moving the cursor to result in damage being
registered on the cursor plane.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-11-10 09:37:43 -06:00
Derek Foreman
79212ba9ad libweston: Don't clip damage to paint node visible region
When an output repaints, it calculates visibility for its paint nodes,
accumulates damage for all paint nodes across all outputs, and then
paints.

This means that when it's accumulating damage for all paint nodes in
paint_node_add_damage(), it may be accumulating damage to nodes on other
outputs that haven't had their visible regions updates yet.

This leads to clipping with a stale visibility region, and losing damage.

Let's just drop the clip here for now - there are already other places
where paint nodes have to carry damage outside their visible regions.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-11-10 09:37:43 -06:00
Derek Foreman
8b7597d40f vnc: Remove scanout plane optimization
This is a revert of 72e2da24

The VNC backend will place a single fullscreen surface on a virtual
scanout plane, and send the entire contents of this plane every repaint.

This saves a renderer pass, but moving the mouse over the fullscreen
client results in full screen damage for every mouse motion, similarly
client surfact damage is ignored and every repaint pushes the entire
window content down into Neat VNC.

Due to the way this is implemented, by pushing the scanout plane content
from assign_planes(), the primary plane could post damage and corrupt
the display.

Ideally we could fix this optimization to respect plane damage and do the
scanout plane push from the repaint callback, but since a release is
coming soon let's just strip it out for now.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-11-09 11:23:22 -06:00