Commit graph

3563 commits

Author SHA1 Message Date
Christian Meissl
858816b2be bench: add benchmark for opaque regions 2024-06-11 20:05:07 +02:00
Christian Meissl
0a94657100 gles: reduce time spent in uploading damage rects 2024-06-11 20:05:07 +02:00
Christian Meissl
1859d4d28e renderer: forward element opaque regions
this allows to optimize drawing textures in a renderer
2024-06-11 19:48:15 +02:00
Christian Meissl
6fb7f339fd anvil: document supported env variables 2024-06-11 19:48:15 +02:00
Christian Meissl
73aaffc080 anvil: allow to disable direct scan-out 2024-06-11 19:48:15 +02:00
Christian Meissl
30efb435fb anvil: allow to disable color transform 2024-06-11 19:48:15 +02:00
PolyMeilex
e89fc8a2fb Move pointer protocol extensions logic to their corresponding modules 2024-06-11 13:15:15 +02:00
Victoria Brekenfeld
f4327306f9 xwayland: Make hook implementation-detail 2024-06-11 12:57:35 +02:00
Ivan Molodetskikh
fce66ea784 Refactor fractional-scale to store state persistently
In my compositor I always set scale for every surface as it changes
outputs and such. It is therefore convenient if the fractional scale is
always stored in Smithay and automatically sent to newly-bound
fractional scale objects. This way, I don't need to recompute it
whenever a new fractional scale object is created.
2024-06-11 12:57:05 +02:00
PolyMeilex
ae0d737926 Additional float getters for alpha_multiplier 2024-06-10 20:58:37 +02:00
Ian Douglas Scott
24e36e97a1
Multiply alpha modifier with alpha in WaylandSurfaceRenderElement (#1448)
Previously the alpha modifier was not used anywhere within Smithay. The
compositor possibly could handle the alpha value itself, but it's not
clear how to do that when using `render_elements_from_surface_tree`. Nor
is there an obvious reason not to handle this in Smithay.

The protocol leaves the exact blending space undefined. But multiplying
here seems like a correct implementation.
2024-06-07 19:03:20 +02:00
PapyElGringo
d6da83baf2
Add the wayland surface to XwaylandShell::surface_associated 2024-06-05 12:20:40 +02:00
kenoss
dfc610a65f style: Use AnvilState<BackendData> everywhere
Before this patch, `AnvilState<BackendData>`,
`AnvilState<Backend: crate::state::Backend>`, and `AnvilState<B>` are
mixed up. This patch uses `AnvilState<BackendData>` for consistency.
2024-06-04 20:19:26 +02:00
Bartłomiej Maryńczak
96af9cb50f
Implement XDG Dialog protocol (#1389)
* xdg-dialog: Implement the protocol
2024-06-03 18:41:31 +02:00
Bartłomiej Maryńczak
1696a99533
Implement wp alpha modifier v1 (#1426)
wayland.alpha_modifier: Implement v1 of alpha_modifier protocols=
2024-06-03 18:41:07 +02:00
Ian Douglas Scott
0afc33267e Check if focus is unchanged in set_data_device_focus/set_primary_focus
I wanted to change where these are called in `cosmic-comp` to workaround
an issue. But by not just calling it when keyboard focus changes, it
created a flood of `offer` events.

It would be possible to add a getter for the focus, but it seems
reasonable just to add a test here to check if it has changed. I assume
there's no problem doing noting if the focus is the same as the current
one.
2024-06-01 12:59:20 +02:00
Ian Douglas Scott
12bcefc200
Update wayland-protocols-* (#1441) 2024-05-31 19:03:27 +02:00
Ian Douglas Scott
fb44b240ea compositor: Disable IN_FENCE_FD on Nvidia
Atomic commits fail if this is set on the Nvidia driver, it seems:
https://github.com/NVIDIA/open-gpu-kernel-modules/issues/622

Kwin also has a check for this
https://invent.kde.org/plasma/kwin/-/merge_requests/4770.

This fixes Anvil and cosmic-comp on the Nvidia 555 beta driver. (I'm not
sure why it only started to be a problem; `EGL_ANDROID_native_fence_sync`
is present in the 550 driver, etc.)
2024-05-22 22:08:40 +02:00
Victoria Brekenfeld
8f132ecded
xwm: Fix missing map_window_notify callback (#1436) 2024-05-21 19:01:11 +02:00
Ottatop
900b938970 session_lock: Verify BufferAssignment is NewBuffer in attached buffer check 2024-05-17 13:47:16 +02:00
Nadjib Ferhat
271fbc0209
element: make PixelShaderElement::alpha return self.alpha (#1421)
element: make `PixelShaderElement::alpha` returns `self.alpha`
2024-05-16 22:51:45 +02:00
Christian Meissl
23417c6fbb Revert "Call wl_buffer::release only in drop impl of renderer::utils::Buffer"
This reverts commit f25bcd892e.
2024-05-16 22:32:38 +02:00
Victoria Brekenfeld
d763452a08 gbm: Force implicit modifiers for old api
Buffers created via `gbm_bo_create` might return (errornous or actual) modifiers, which can then lead to errors trying to attach them to drm or exporting in dmabuf, which will then suddenly have modifiers.

So lets track if the creation method allows for modifiers or not.
2024-05-16 15:01:42 +02:00
Ian Douglas Scott
ba2e43ccf4 Add shape/orientation to TouchHandle and TouchGrab
The event structs were already defined and used in `TouchTarget`, but
there was no way to actually send them.

I would also add backend support for getting these events from libinput,
but apparently that still doesn't exist:
https://gitlab.freedesktop.org/libinput/libinput/-/issues/746.
2024-05-16 14:51:18 +02:00
Ian Douglas Scott
f25bcd892e Call wl_buffer::release only in drop impl of renderer::utils::Buffer
The protocol says a buffer that is attached but then replaced without
being committed should not get `release`. So there shouldn't be any
reason to call `release` in `merge_into` or `cleanup`.

Once the surface is comitted, `RenderSurfaceState::update_buffer` will
create a `Buffer`. So it seems everything should be correct to ensure a
buffer is released once and only once, when there are no references.
2024-05-16 10:59:13 +02:00
Christian Meissl
cd456d45ee drm: reduce allocations for element visible area check 2024-05-16 10:58:27 +02:00
Christian Meissl
d3d5d3381f utils: get rid of duplicate overlaps check
Rectangle::intersection already calls Rectangle::overlaps,
so there is no need to do a pre-check with Rectangle::overlaps
2024-05-16 10:58:27 +02:00
Christian Meissl
f2faab3223 damage: get rid of the linear scan for elements gone
we already track the state per element in a hashmap,
so use it instead of scanning the whole vec per element
2024-05-16 10:58:27 +02:00
Christian Meissl
9483aa9a5f drm: simplify planes assignment check 2024-05-16 10:58:27 +02:00
Christian Meissl
3f0e9fdb9f drm: get rid of double indexmap for plane element ids 2024-05-16 10:58:27 +02:00
Christian Meissl
7a39f6bc98 drm: store the per element fb cache in a vec
in most cases the set of alive fb per element is pretty low,
so there is no point in using a hashmap.

while at it return a reference to the stored fb instead of cloning
2024-05-16 10:58:27 +02:00
Christian Meissl
fdae17646e drm: replace the planes hashmap with an array
the actual amount of planes per CRTC is pretty low ( < 10),
so there is no point in using a hashmap
2024-05-16 10:58:27 +02:00
Christian Meissl
1372bbbfa1 drm: replace internal Arc with Rc 2024-05-16 10:58:27 +02:00
Christian Meissl
dff0bd32a8 drm: only check commit counter on cursor plane
we don't use the actual damage anyway, so just check if the counter
changed in the rendering check
2024-05-16 10:58:27 +02:00
Christian Meissl
4108459eb3 drm: remove temporary hashmap
building a hashmap each render cycle for such
a small set actually hurts performance
2024-05-16 10:58:27 +02:00
Christian Meissl
10ad01d257 drm: add can_add_framebuffer to pre-test and skip...
...unnecessary calls to add_framebuffer
2024-05-16 10:58:27 +02:00
Christian Meissl
659ceebc97 wayland: return a reference to the stored Dmabuf
this reduces unnecessary clones during scan-out
2024-05-16 10:58:27 +02:00
Christian Meissl
8c3847c07a renderer: return a reference to the underlying storage
this avoid some unnecessary clones when retrieving
the underlying storage of an element
2024-05-16 10:58:27 +02:00
Christian Meissl
382615de35 renderer: refactor memory element 2024-05-16 10:58:27 +02:00
Christian Meissl
7e295363ed renderer: get rid of unnecessary Options in wayland element 2024-05-16 10:58:27 +02:00
Christian Meissl
f354e8c1dd renderer: introduce OpaqueRegions in RenderElement
this aims to further reduce allocations during rendering
2024-05-16 10:58:27 +02:00
Christian Meissl
ece3cdaea2 drm: don't cache the bo for an fb
this is not required and might delay destruction
of the bo to the drop handler of the fb making
cleanup less predictable
2024-05-16 10:58:27 +02:00
Christian Meissl
cd2f967779 drm: wrap the raw bo into a GbmBuffer
this allows caching of some commonly used gbm properties
which would otherwise always require upgrading a weak device
and calling into gbm.
2024-05-16 10:58:27 +02:00
Christian Meissl
581c750ae9 use Cow<WlSurface> for focus handling
this reduces unnecessary clones significantly
2024-05-16 10:58:27 +02:00
Christian Meissl
60d5dfade9 pixman: do not unnecessarily upgrade cached dmabuf
for checking liveness we can use is_gone, upgrading
will increase and decrease the strong ref count unnecessarily.
2024-05-16 10:58:27 +02:00
Christian Meissl
92c508677f avoid upgrading Weak<T> for liveness tests 2024-05-16 10:58:27 +02:00
Christian Meissl
6fbdc07428 output: introduce WeakOutput::is_alive
this allows checking liveness without requiring to
increase the strong count temporarily
2024-05-16 10:58:27 +02:00
Christian Meissl
f5aeb514a2 inline hints for common operations 2024-05-16 10:58:27 +02:00
Christian Meissl
d4780c59d5 inline hint for otherwise derived operations
the automatic derived implementations would
set the inline hint anyway
2024-05-16 10:58:27 +02:00
Christian Meissl
a29890a9df x11: do not unnecessarily upgrade connection
testing the strong count is enough for testing liveness
and does not create a strong ref which is again dropped
immediately
2024-05-16 10:58:27 +02:00