Commit graph

5628 commits

Author SHA1 Message Date
Alexander Orzechowski
5a7c30966c compositor: Remove notion of primary renderer
Uploading textures are done by what outputs intersect the surface,
not an arbitrary renderer. If no outputs intersect the surface, the
source buffer is locked for longer until the surface is shown, at which
point a renderer will be uploaded the buffer.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
fc6fd95e4d wlr_texture: Expose owning renderer 2022-07-03 13:09:22 -04:00
Alexander Orzechowski
43a3cbe6ae Re implement partial texture uploads for surfaces and immediate buffer unlocking 2022-07-03 13:09:22 -04:00
Simon Ser
c71800cf8d buffer: move wlr_shm_client_buffer functions to internal header
These will get used by wlr_compositor in the next commit.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
a193d450ed wlr_scene_buffer: Rework to use wlr_raster 2022-07-03 13:09:22 -04:00
Alexander Orzechowski
605c4aed38 cursor: Move wlr_output_cursor_set_buffer to wlr_raster 2022-07-03 13:09:22 -04:00
Alexander Orzechowski
beaede2df0 wlr_texture: Update wlr_texture_update_from_buffer to use wlr_raster
In the future, these implementations can use compatible texture sources
to do fast blit instead.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
1e2af8665b wlr_texture: Drop wlr_texure_from_buffer
Compositors should be using wlr_raster for texture management.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
33ae408579 wlr_texture: Drop wlr_texture_from_pixels
Keeping the texture version doesn't make too much sense because compositors
should send valid pixel data the first time around meaning they want to
render straight away. wlr_raster_from_pixels should be used instead.

Also drop a few asserts that are impossible because of the data type.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
dae7bd1413 wlr_texture: Drop wlr_texture_from_dmabuf
Compositors should first create a valid dmabuf first, then use normal
apis to use that buffer where needed.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
e594a59036 wlr_linux_dmabuf: Refactor to prevent double dmabuf import
Instead, we'll initialize the buffer just enough so that renderers
can work with it and if the dmabuf import was successful, we continue
initializing the buffer. This will allow the dmabuf texture to addon
itself onto the buffer for further use without another import.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
248a33a026 wlr_renderer: Switch texture rendering functions to take wlr_raster
Implements automatic texture uploading as both wlr_scene and cursor
handling both are simplified as a result.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
45ad3d47ad backend/drm: Report ZERO_COPY hint when direct scanning a client dmabuf.
Since wlr_client_buffer is gone, we are now dealing with client dmabufs
directly.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
ba8230b00a Nuke wlr_client_buffer
This abstraction is incompatible with wlr_raster in every way, let's just
use the client submitted buffers directly. This will regress a couple
of things until wlr_raster has been fully integrated.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
d8def1aa65 wlr_renderer: Introduce wlr_renderer_raster_upload 2022-07-03 13:09:22 -04:00
Alexander Orzechowski
5dd7c00a7c renderer/pixman: Nuke wlr_pixman_texture_get_image
Consumers can just get the image from the wlr_pixman_texture.
Getting rid of this will make the transition to use wlr_raster easier.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
bc53c79048 wlr_raster: Introduce wlr_raster_from_pixels 2022-07-03 13:09:22 -04:00
Alexander Orzechowski
31bc571e98 wlr_raster: Introduce new abstraction 2022-07-03 13:09:22 -04:00
Simon Ser
531f0dfbbc render: replace wlr_texture_write_pixels with update_from_buffer
This lets the renderer handle the wlr_buffer directly, just like it
does in texture_from_buffer. This also allows the renderer to batch
the rectangle updates, and update more than the damage region if
desirable (e.g. too many rects), so can be more efficient.
2022-07-03 13:09:22 -04:00
Alexander Orzechowski
5dc1d4671d wlr_scene: Maintain damage highlight regions per output
The logic doesn't support handling multiple outputs so let's not break
the assumption and handle damages per output much like how damage_ring
is done.
2022-07-03 12:21:52 -04:00
Alexander Orzechowski
fdfdd01a79 wlr_scene: Use direct assignment for damage indicator timestamps 2022-07-03 12:21:39 -04:00
Isaac Freund
ffb53a6103
Document NULL return value of foo_from_wlr_surface() functions
wlr_xdg_surface_from_wlr_surface() for example may return NULL even if
the surface has the xdg surface role if the corresponding xdg surface
has been destroyed.
2022-07-02 13:28:02 +02:00
Kirill Primak
694b8c6683 scene: add missing output damage listener
This is necessary to handle damage coming from the backend and software
cursors.
2022-06-29 21:19:38 +03:00
Kirill Primak
97f0347780 scene: switch to wlr_damage_ring 2022-06-29 18:54:27 +03:00
Kirill Primak
e0accb2d50 types: add wlr_damage_ring
wlr_damage_ring is effectively wlr_output_damage untied from wlr_output.
2022-06-29 18:54:21 +03:00
Simon Ser
10a821a87d output: fix missing buffer when using direct scanout
When using direct scanout back_buffer is NULL. We'd emit a commit
event with WLR_OUTPUT_STATE_BUFFER set but with a NULL buffer field,
which is non-sensical.
2022-06-29 17:42:57 +02:00
Simon Ser
e26c3a02df build: fix enabled GBM when allocators=auto and auto_features=disabled 2022-06-29 11:32:06 +02:00
Simon Zeni
517ea218c6 tinywl: exit on backend, renderer or allocator creation failure 2022-06-28 13:43:36 +00:00
Kenny Levinsen
03dc7e2df5 wlr_{keyboard,pointer,touch}: Update event docs
Events used by our input devices were recently renamed from wlr_event_* to
wlr_*_event, but the documentation and a single point of use was not updated
accordingly.

Regressed by: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3484
2022-06-28 09:50:30 +00:00
Simon Ser
c20468cfa2 render: use internal_features to indicate EGL support
Instead of checking whether the wlr_egl dependencies are available
in the GLES2 code, introduce internal_features['egl'] and check
that field.

When updating the EGL dependency list, we no longer need to update
the GLES2 logic.
2022-06-24 07:20:42 +02:00
Simon Ser
b9d55b8769 render/gles2: check GBM is found
The GLES2 renderer depends on EGL, which depends on GBM for device
selection.
2022-06-24 07:16:41 +02:00
Isaac Freund
91943a68a6 wlr_input_device: remove anon union field
This union is unnecessary since the recent input device refactor and can
now be replaced by wlr_*_from_input_device() functions.
2022-06-21 18:42:07 +00:00
Kirill Primak
5c4384a133 xdg-popup: use configure fields 2022-06-21 15:14:37 +00:00
Kirill Primak
8d2fa15e9d xdg-toplevel: post no memory on strdup() fail 2022-06-21 17:37:45 +03:00
Kirill Primak
ec8b49c93f subcompositor: consider map on creation
wl_subsurface description states:

A sub-surface becomes mapped, when a non-NULL wl_buffer is applied and
the parent surface is mapped.

Note that this doesn't require an explicit commit, which means that a
newly created subsurface with a mapped parent and a buffer already
attached must be mapped immediately. This can happen with the following
sequence of events:

- subcompositor.get_subsurface(subsurface, surface, parent)
- surface.attach(buffer)
- surface.commit()
- subsurface.destroy()
- subcompositor.get_subsurface(subsurface, surface, parent)

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3449
2022-06-21 14:00:48 +03:00
Rouven Czerwinski
2a1d7d40f4 cursor: re-enable NULL buffer for cursor
The previous wlr_output_cursor_set_image() allows setting a NULL buffer for the
cursor to hide it. This functionality was used by sway to hide the cursor,
restore the original semantics by allowing NULL buffers again by avoiding the
wlr_buffer allocation in case we have NULL pixels and handing a NULL wlr_buffer
to wlr_output_cursor_set_buffer().
2022-06-20 10:20:55 +02:00
Simon Ser
1d581656c7 backend/drm: set "max bpc" to the max
"max bpc" is a maximum value, the driver is free to choose a
smaller value depending on the bandwidth available.

Some faulty monitors misbehave with higher bpc values. We'll add
a workaround if users get hit by these in practice.

References: https://gitlab.freedesktop.org/wayland/weston/-/issues/612
2022-06-19 16:55:36 +00:00
Simon Ser
1f1c0275be backend/drm: remove unused CRTC count check
drmIsKMS already checks for this.
2022-06-19 16:48:44 +00:00
Simon Ser
d89285f783 output-management-v1: add wlr_output_head_v1_state_apply()
This function applies a configuration sent by a client on a
struct wlr_output_state.
2022-06-17 21:05:51 +00:00
Simon Ser
29291cb47c render/texture: drop wlr_texture_is_opaque
Whether a texture is opaque or not doesn't depend on the renderer
at all, it just depends on the source buffer. Instead of forcing
all renderers to implement wlr_texture_impl.is_opaque, let's move
this in common code and use the wlr_buffer format to know whether
a texture will be opaque.
2022-06-16 14:43:24 +02:00
Simon Ser
f28c0e2046 gitignore: remove build dir entries
Meson creates a .gitignore file in its build directories [1] so that
they never get added to Git. These entries assume users will pick a
specific build dir name, so they don't work with e.g. "builddir".

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3582#note_1424666
2022-06-14 10:08:54 +02:00
bi4k8
369c6525d7 render/egl: don't leak memory on error return 2022-06-12 06:55:06 +00:00
bi4k8
f295aff762 Add missing & 2022-06-11 20:41:16 +00:00
bi4k8
35d1bcff6f render/vulkan/pixel_format: do not leak props->...
`vulkan_format_props_query` calls `query_modifier_support` which
initializes fields of `props` with allocated memory. this memory is
leaked if `query_modifier_support` does not find a supported format
and shmtex is not supported, as in this case `add_fmt_props` ends
up being false and the allocated fields of `props` are never freed.
2022-06-11 20:25:35 +00:00
Kirill Primak
e7b217efb9 xdg-shell: improve shell version check 2022-06-11 20:22:54 +03:00
Johan Malm
d57d2e0e36 scene/layer_shell_v1.c: fix bug in width/height calculations
...in wlr_scene_layer_surface_v1_configure()

Reproduce bug with waybar by setting `"margin": 5,`
in ~/.config/waybar/config. It will result in the right edge of the panel
extending outside the edge of the output.

The bug can also be reproduced with gtk-layer-demo by anchoring
left/right/top/bottom and setting respective margins

Relates-to: https://github.com/labwc/labwc/issues/382
2022-06-08 20:13:55 +00:00
Simon Ser
96b594110d matrix: remove wlr_matrix_projection()
69477051cc ("matrix: deprecate wlr_matrix_projection") marked it
as deprecated. 1 year later, we can now remove it from our public
API.
2022-06-08 19:27:36 +00:00
Simon Ser
c2e046022f render/gles2: simplify flipped projection
Instead of computing the projection, then flipping, just provide
the correct transform to wlr_matrix_projection().
2022-06-08 19:27:36 +00:00
Simon Ser
c2e4ba1dd0 output: use state setters in wlr_output_set_* 2022-06-08 18:29:58 +02:00
Simon Ser
43a9b0fbb9 output: compare state before commit
Before calling wlr_output_impl.{test,commit}, perform a cheap
comparison between the current and candidate state. Unset any
fields which didn't change.
2022-06-08 18:29:58 +02:00