Commit Graph

897 Commits

Author SHA1 Message Date
Victor Brekenfeld 3530ac7335 egl: stop egl spamming nclassified messages 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 359c060e0f space: apply transform for output_geometry 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 64c535464a swapchain: Keep buffers on reset and wipe metadata
We make no guarantees about the buffer contents after a fresh allocation
in smithay anyway, so to avoid expensive recreation of a bunch of
resources, try to keep the buffers on reset and just wipe all its
metadata (most importantly the age).
2022-01-04 12:50:39 +01:00
Victor Brekenfeld 8536fa90a1 desktop: streamline custom elements logic 2022-01-04 12:50:39 +01:00
Victor Brekenfeld bb1e68c916 space: Add support for drawing custom elements 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 5b85333eaf desktop: clamp damage to bbox 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 827a3c8c2a desktop: Fixup intersection calls 2022-01-04 12:50:39 +01:00
Victor Brekenfeld a948ff8829 space: commit does not need mutable self 2022-01-04 12:50:39 +01:00
Victor Brekenfeld a20fd0c65d window: cache bbox 2022-01-04 12:50:39 +01:00
Victor Brekenfeld d84a66e053 desktop: api cleanups 2022-01-04 12:50:39 +01:00
Victor Brekenfeld d7350d18ee desktop: fix negative damage values 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 94968e2d0f desktop: track damage per space/output 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 3b39d780fe desktop: layer-shell support 2022-01-04 12:50:39 +01:00
Victor Brekenfeld cea88fdde0 desktop: Various cleanups 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 31b308836f renderer: Use fine grained damage for rendering
Up until now we always redrew the whole windows, which worked
fine - except for some transparency issues - but left performance
on the table.

So now we use instancing to render only the actually damaged regions
inside the window, which also fixes our few rendering issues.

We also use a shader now for clearing the screen to use instancing as
well and lower the amount of draw calls at the begin of a frame for
clearing parts of it.

And while we are add it we remove the last rendering artifacts
by optimizing the damage vector by deduplicating and merging rectangles.
2022-01-04 12:50:39 +01:00
Victor Brekenfeld f55f1bbbe0 desktop: handle xdg-popups 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 90f7d53a3a space: fixup miscalculations 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 25b74e2eaa space: change output_for_window to return Vec 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 7578fab9cf desktop: map_window remove unnecessary Result and activate 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 2c0ae025de desktop: Track surface enter/leave for outputs 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 44829d8fba desktop: Only render surface damage, if window was not moved 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 98906555f5 desktop: Add new desktop abstractions module
Adds a new `Window` and `Space` abstraction to make it easier
to handle windows of various shells and their positions in a
compositor space.
2022-01-04 12:50:39 +01:00
Victor Brekenfeld 76787fb7df renderer: Account for OpenGLs coordinate system in the Gles2Renderer 2022-01-04 12:50:39 +01:00
Victor Brekenfeld eccdd5221c renderer: Make Transform::transform_size use a Size instead of u32 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 57f45d9941 renderer: Allow clear calls on specific regions 2022-01-04 12:50:39 +01:00
Victor Brekenfeld 55ec6dc7cb output: Add userdata to wayland output object
Anvil's output map has a wrapper type `Output`, that largely stores
information of the wayland `Output` type, that is just not accessible.
Lets change that and make it possible to associate userdata with the
output to remove the need to use another wrapper type.
2022-01-04 12:50:39 +01:00
Victoria Brekenfeld 06704fb3be seat: Export KeysymHandle 2022-01-01 23:45:42 +01:00
Victor Berger c232b5c108 backend: Make SwapBuffersError Send+Sync
This makes using anyhow with Smithay easier.
2021-12-29 16:34:53 +01:00
dragonn 5ce5a8abcc call resize after applying new pending model 2021-12-23 17:49:39 +01:00
dragonn 9a7cd23093 make use_mode use the new mode size on test_buffer 2021-12-23 17:47:12 +01:00
Victor Brekenfeld 6d51d1dea0 x11: Don't use modifiers on old dri3 versions
Older dri3 versions (< 1.2) do only support dmabufs with one plane.
Lets limit the modifiers early, if we detect that, so we do not end
up allocating buffers the interface does not accept.
2021-12-22 21:08:44 +01:00
Victor Brekenfeld 94b3ce8e6f x11: Add virtual Device{Added, Removed} events 2021-12-22 19:33:33 +01:00
Victor Brekenfeld cc6225ce21 x11: Move window from Metadata into events
Some events (especially from xinput) cannot be cleanly mapped to a window.
Instead of requiring every event to come with a `Window` reference, move
the window into those events, that have one.
2021-12-22 19:33:33 +01:00
Victoria Brekenfeld 0afebf5fdb
Merge pull request #437 from i509VCB/x11/fix-error-drop 2021-12-21 02:18:59 +01:00
Victor Brekenfeld 5d8ac82688 geometry: Don't compute intersection for non-overlapping rects 2021-12-20 20:10:09 +01:00
i509VCB ed105528de
x11: emit errors when presentation fails 2021-12-17 19:14:14 -06:00
i509VCB d6051a873f
x11: move X11Surface to submodule to reexport and reorganize internal functions 2021-12-17 16:54:18 -06:00
Victoria Brekenfeld c0b9ecbcdf
Merge pull request #434 from Smithay/feature/geometry_additions
Geometry additions
2021-12-17 22:35:44 +01:00
i509VCB 22204f2845
x11: internal window to send close backend event to 2021-12-17 12:06:30 -06:00
Victor Brekenfeld 8022a60089 utils: documentation fixup 2021-12-17 14:47:53 +01:00
Victor Brekenfeld 7ad5edd6a3 utils: make all geometry operations saturating 2021-12-17 14:47:53 +01:00
Victor Brekenfeld 4628fc6bcc utils: Add intersection to Rectangle 2021-12-17 14:47:53 +01:00
Victor Brekenfeld 1a7027eefc utils: overlap support on-the-fly rect conversion 2021-12-17 14:47:43 +01:00
Victor Brekenfeld ee5c14e673 utils: use stable memory layout for Point/Size/Rectangle 2021-12-17 14:47:43 +01:00
Victor Brekenfeld 2f683112a7 utils: Add min/max to Coordinate 2021-12-17 14:47:43 +01:00
Victor Brekenfeld 95b915d429 utils: Make Coordinate public 2021-12-17 14:47:43 +01:00
Victor Brekenfeld 37adc1174c utils: Add Rectangle::contains_rect 2021-12-17 14:47:43 +01:00
Victor Brekenfeld 3c7bbf65c4 utils: Add Rectangle::to_i32_* variants 2021-12-17 14:47:43 +01:00
i509VCB b80281dcc8
x11: fix window drop not destroying 2021-12-15 20:04:53 -06:00
i509VCB 09ce3da742 x11: Do not hold lock when dispatching events 2021-12-06 16:39:02 -06:00
Christian Meissl 6b1788d002 rewind the keymap file before
passing it to clients
2021-12-05 17:40:47 +01:00
i509VCB e4e964c869 x11: rework impl to allow multiple windows 2021-12-03 11:03:51 -06:00
i509VCB 4f26641f8c x11: require wrapping gbm device in an Arc<Mutex<_>> 2021-12-03 11:03:51 -06:00
i509VCB 210ab8fb21 allocator: general impls for Arc<Mutex<_>> and Rc<RefCell<_>> 2021-12-03 11:03:51 -06:00
i509VCB 7358d8c9cb resolve new clippy lints 2021-12-02 18:18:39 -06:00
Victor Brekenfeld bd305dc7ee x11: fixup buffer age
The current code always acquires the buffer it just submitted,
which results in always rendering to a buffer with age "1", although
its contents are older, because the currently held buffer is already
submitted, just not to the swapchain. When it finally is submitted
its age is again set to 1, the other gets its correct age (but too late)
and the circle is repeated again. So lets fix that.
2021-11-29 15:55:27 +01:00
Victor Brekenfeld 485aa2a9c7 swapchain: Do not increase the age of 0-age slots
Slots with an age of 0 were never rendered to. This means
we should not increase their age, when others are submitted
or the renderer might wrongfully assume usuable contents are
available in the buffer.
2021-11-29 15:36:53 +01:00
Victoria Brekenfeld 8a5d030a98 x11: Use swapchain and expose age
Refactors the `X11Surface` to use the `Swapchain` internally,
which gives us a buffer age implemenation, which we can then use
to change the `Present` struct of the X11 backend to provide age
values to the user.

This change also merged the `Present` struct into the surface
because submits should now happen explicitly via a new `submit`-call
instead of being submitted implicitly on drop.
This allows the buffer to be discarded if rendering fails.
2021-11-26 22:24:12 +01:00
Victoria Brekenfeld 6b3a00fc06
Merge pull request #420 from i509VCB/x11/egl-drm
Rework X11 backend to use EGL for finding gbm device and associated commits
2021-11-26 13:43:49 +01:00
Victor Brekenfeld a4f2729608 gbm: expose buffer age 2021-11-24 18:57:51 +01:00
Victor Brekenfeld 6c57e27e5e swapchain: Support buffer age 2021-11-24 18:57:51 +01:00
Victor Brekenfeld 643ff5395d gbm: Refactor: remove internal `Buffers` struct 2021-11-24 18:57:51 +01:00
Victor Brekenfeld 9584219ffa swapchain: Use `UserDataMap` instead of generic parameter 2021-11-24 18:57:49 +01:00
Victoria Brekenfeld a4fab6633c
Merge pull request #406 from i509VCB/input/remove-dispatch-new
input: remove `InputBackend::dispatch_new_events`
2021-11-24 18:57:01 +01:00
i509VCB 5506c7e1c5 apply cargo fmt and clippy 2021-11-24 18:43:37 +01:00
i509VCB 86716f9c9f x11: allocate buffers using gbm with modifiers 2021-11-24 18:42:24 +01:00
i509VCB 53d43905ac x11: store dmabufs in buffer object userdata 2021-11-24 18:11:27 +01:00
Victor Brekenfeld 42b646a152 x11: Initialize via egl instead of dri3 if possible 2021-11-24 18:11:26 +01:00
Christian Meissl c34a0dd4a5 fix xdg doc link 2021-11-24 16:57:04 +01:00
Christian Meissl 81f1e8b84d fix doc comment 2021-11-24 16:57:04 +01:00
Christian Meissl 2123760c9e make attributes state functions public in xdg shell 2021-11-24 16:57:04 +01:00
Christian Meissl 4f36e03266 allow xdg_role macro configure without braces 2021-11-24 16:57:04 +01:00
Christian Meissl a22b211e29 move the duplicate xdg state handling to...
...the base macro implementation
2021-11-24 16:57:04 +01:00
Christian Meissl 4849ae3b4a use the last configured decoration mode...
...to check for decoration mode changes instead
of the current decoration mode
2021-11-24 16:57:04 +01:00
Christian Meissl 29010d93a4 use the last pending server state...
...or last acked if available instead of the current state
2021-11-24 16:57:04 +01:00
i509VCB e4891b0c9e
egl: Introduce EGLDevice
More specifically, this introduces a way to query the available EGL devices on a system, `EGLDevices::enumerate`.
Also this introduces a way to get the `EGLDevice` used by an `EGLDisplay`, `EGLDevice::device_for_display`

Co-authored-by: Drakulix <github@drakulix.de>
2021-11-23 10:52:02 -06:00
Victor Brekenfeld 8bf7d91f98
backend/drm: Do not open new file descriptors in `DrmNode`
`DrmNode` was made to manage open drm nodes (including render nodes)
without having to create a `DrmDevice`. Even if opening render nodes
*should* work in general on most systems, the user should be in charge
of opening device, because they *may* want to use a `Session` or
something else. Therefor remove all `open` calls from drm/node.

The X11-backend, which tries to optain a render node, now opens the
render node itself, if getting a path proves to be successful.
2021-11-23 10:09:48 -06:00
i509VCB 7b1c0501f3 clean up warnings from github 2021-11-23 14:45:38 +01:00
i509VCB d1fae4ba4e
Merge branch 'master' into input/remove-dispatch-new 2021-11-22 18:19:46 +00:00
Victor Brekenfeld 87069f26e9 renderer: rename function parameters for clearer purpose 2021-11-22 16:38:31 +01:00
Victor Brekenfeld 011a7da665 renderer: Remove render_texture from Frame 2021-11-22 16:38:31 +01:00
Victor Brekenfeld 7a7f1217d8 renderer: Allow to set texture filtering methods 2021-11-22 16:38:31 +01:00
Christian Duerr 076f824431 Add version method to ToplevelSurface
Currently the `shell_surface` is not accessible to the outside, meaning
there is no way to query for the XDG shell protocol version supported by
the client.

Adding a `version` method fixes that problem, which allows compositors
to act differently based on the supported protocol version. As an
example this allows setting the state to `State::Maximized` if the
tiling states are not available.
2021-11-22 15:28:09 +01:00
Adrien 4dec5f7fa2 Fixed a typo in the lib.rs docs. 2021-11-22 15:27:57 +01:00
i509VCB d00197052c x11: add option to make extensions optional 2021-11-22 15:26:52 +01:00
Christian Duerr 0d2c3acdc7 Add debug assertion 2021-11-22 15:25:47 +01:00
Christian Duerr d46be20d6e Add SubAssign for Size 2021-11-22 15:25:47 +01:00
Victor Brekenfeld cf6f7a0726 gbm: use Xrgb8888, if alpha variant is not available 2021-11-04 19:13:57 +01:00
i509VCB 8ca5d1f301 input: remove `InputBackend::dispatch_new_events` 2021-10-28 15:37:02 -05:00
i509VCB 3283010d2c Add Forward/Back mouse buttons 2021-10-27 12:23:12 -05:00
i509VCB e1400a1926 Mention where keyboard key code constants may be found 2021-10-27 12:23:07 -05:00
Poly 63f9a713ce Clippy fixes 2021-10-27 14:18:52 +02:00
Poly 10aee60b87 wayland.xdg-decor: Implement XDG Decoration protocol 2021-10-27 14:18:52 +02:00
i509VCB 77c970e197 winit: rework around `WinitEvent` vs `InputEvent<Special = WinitEvent>` 2021-10-27 14:16:19 +02:00
Victor Brekenfeld 3dde8d70ef Update to input-rs 0.7 2021-10-23 22:49:32 +02:00
Victor Brekenfeld 2aedeead7d Fix clippy needless_return 2021-10-23 15:34:50 +02:00
Victor Brekenfeld af8863578e Fix trailing_semicolon on egl macro 2021-10-23 15:24:55 +02:00
Victor Berger 121014a9eb compositor.cache: fix MultiCache::has() 2021-10-18 19:33:49 +02:00
i509VCB 2e68cfda5a X11 backend 2021-10-17 13:46:15 -05:00
i509VCB 953d9ce158 Implement `Hash` on some enums in `backend::input` 2021-10-17 13:46:07 -05:00