aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-07-13backend/wayland: properly cleanup wlr_wl_pointerSimon Ser
We were missing destroy calls for gestures, and we were only destroying the relative pointer on output destroy.
2021-07-12output: remove wlr_output_impl.export_dmabufSimon Ser
No backend is using it anymore.
2021-07-12backend/drm: remove wlr_output_impl.export_dmabufSimon Ser
This is now provided by the generic wlr_output implementation.
2021-07-12backend/headless: remove wlr_output_impl.export_dmabufSimon Ser
This is now provided by the generic wlr_output implementation.
2021-07-12output: add generic wlr_output_export_dmabuf implementationSimon Ser
When wlr_output manages its own swap-chain, there's no need to hook into the backend to grab DMA-BUFs. Instead, maintain a wlr_output.front_buffer field with the latest committed buffer.
2021-07-12buffer: drop resource arg from wlr_client_buffer_createSimon Ser
This function doesn't need the wl_resource anymore. In the failure paths, wlr_buffer_unlock in surface_apply_damage will take care of sending wl_buffer.release.
2021-07-12render/gles2: disable blending opportunisticallySimon Ser
We don't always need to enable blending: when the texture doesn't have alpha or when the color is opaque, we can disable it.
2021-07-12render/gles2: set has_alpha for DMA-BUFsSimon Ser
Use our internal pixel format table to figure out whether an imported DMA-BUF has alpha.
2021-07-12render/gles2: rename wlr_egl.exts to better match KhronosSimon Ser
Khronos refers to extensions with their namespace as a prefix in uppercase. Change our naming to align with Khronos conventions. This also makes grepping easier.
2021-07-12render/egl: rename wlr_egl.exts to better match KhronosSimon Ser
Khronos refers to extensions with their namespace as a prefix in uppercase. Change our naming to align with Khronos conventions. This also makes grepping easier.
2021-07-09buffer: drop wlr_client_buffer.resourceSimon Ser
2021-07-09buffer: stop using resource in client_buffer_get_dmabufSimon Ser
Instead, delegate to the source wlr_buffer.
2021-07-09buffer: add wlr_client_buffer.sourceSimon Ser
This stores a weak reference to the source buffer.
2021-07-09buffer: stop using source resource in wlr_client_buffer_apply_damageSimon Ser
This is the first step towards dropping wlr_client_buffer.resource.
2021-07-09buffer: rename wlr_client_buffer variables to client_bufferSimon Ser
We often juggle between wlr_buffer and wlr_client_buffer variables. Use a consistent naming: "buffer" for wlr_buffer and "client_buffer" for wlr_client_buffer.
2021-07-09types/wlr_buffer: remove wlr_resource_get_buffer_sizeSimon Zeni
2021-07-09types/wlr_surface: get buffer size from wlr_buffer_importSimon Zeni
2021-07-09types/wlr_buffer: split wlr_client_buffer_import functionSimon Zeni
`wlr_client_buffer_import` is splitted in two distincts function: - wlr_buffer_from_resource, which transforms a wl_resource into a wlr_buffer - wlr_client_buffer_create, which creates a wlr_client_buffer from a wlr_buffer by creating a texture from it and copying its wl_resource
2021-07-09backend/drm: remove backend arg from wlr_drm_interface.crtc_commitSimon Ser
The callee can just get it from the wlr_drm_connector.
2021-07-09backend/drm: move legacy-specific checks to legacy.cSimon Ser
Now that we have a test_only arg in crtc_commit, we can move the legacy checks to legacy.c.
2021-07-09backend/drm: add test_only arg to wlr_drm_interface.crtc_commitSimon Ser
Right now callers of drm_crtc_commit need to check whether the interface is legacy or atomic before passing the TEST_ONLY flag. Additionally, the fallbacks for legacy are in-place in the common code. Add a test_only arg to the crtc_commit hook. This way, there's no risk to pass atomic-only flags to the legacy function (add an assert to ensure this) and all of the legacy-specific logic can be put back into legacy.c (done in next commit).
2021-07-09render/pixman: fix texture_is_opaque()Vyivel
A texture is opaque when it does *not* have alpha. Fixes https://github.com/swaywm/wlroots/issues/2907
2021-07-08backend/drm: stop using drm_surface_make_current in drm_surface_blitSimon Ser
drm_surface_make_current and drm_surface_unset_current set implicit state and are an unnecessary mid-layer. Prefer to use directly wlr_renderer_begin_with_buffer, which automatically unsets the back buffer on wlr_renderer_end. I'd like to get rid of drm_surface_make_current once we stop using it for the primary swapchain.
2021-07-08backend/drm: force linear layout for multi-GPU buffersSimon Ser
Some buffers need to be copied across GPUs. Such buffers need to be allocated with a format and modifier suitable for both the source and the destination. When explicit modifiers aren't supported, we were forcing the buffers to be allocated with a linear layout, because implicit modifiers aren't portable across GPUs. All is well with this case. When explicit modifiers are supported, we were advertising the whole list of destination modifiers, in the hope that the source might have some in common and might be able to allocate a buffer with a more optimized layout. This works well if the source supports explicit modifiers. However, if the source doesn't, then wlr_drm_format_intersect will fallback to implicit modifiers, and everything goes boom: the source uses a GPU-specific tiling and the destination interprets it as linear. To avoid this, just force linear unconditionally. We'll be able to revert this once we have a good way to indicate that an implicit modifier isn't supported in wlr_drm_format_set, see [1]. [1]: https://github.com/swaywm/wlroots/pull/2815 Closes: https://github.com/swaywm/wlroots/issues/3030
2021-07-08Fix invalid uses of wl_array_for_eachSimon Ser
[1] and [2] have introduced new wl_array usage in wlroots, but contains a mistake: wl_array_for_each iterates over pointers to the wl_array entries, not over entries themselves. Fix all wl_array_for_each call sites. Name the variables "ptr" to avoid confusion. Found via ASan: ==148752==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x602000214111 in thread T0 #0 0x7f6ff2235f19 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:127 #1 0x7f6ff1c04004 in wlr_tablet_destroy ../subprojects/wlroots/types/wlr_tablet_tool.c:24 #2 0x7f6ff1b8463c in wlr_input_device_destroy ../subprojects/wlroots/types/wlr_input_device.c:51 #3 0x7f6ff1ab9941 in backend_destroy ../subprojects/wlroots/backend/wayland/backend.c:306 #4 0x7f6ff1a68323 in wlr_backend_destroy ../subprojects/wlroots/backend/backend.c:57 #5 0x7f6ff1ab36b4 in multi_backend_destroy ../subprojects/wlroots/backend/multi/backend.c:57 #6 0x7f6ff1ab417c in handle_display_destroy ../subprojects/wlroots/backend/multi/backend.c:124 #7 0x7f6ff106184e in wl_display_destroy (/usr/lib/libwayland-server.so.0+0x884e) #8 0x55cd1a77c9e5 in server_fini ../sway/server.c:218 #9 0x55cd1a77893f in main ../sway/main.c:400 #10 0x7f6ff04bdb24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24) #11 0x55cd1a73a7ad in _start (/home/simon/src/sway/build/sway/sway+0x33a7ad) 0x602000214111 is located 1 bytes inside of 16-byte region [0x602000214110,0x602000214120) freed by thread T0 here: #0 0x7f6ff2235f19 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:127 #1 0x7f6ff1c04004 in wlr_tablet_destroy ../subprojects/wlroots/types/wlr_tablet_tool.c:24 #2 0x7f6ff1b8463c in wlr_input_device_destroy ../subprojects/wlroots/types/wlr_input_device.c:51 #3 0x7f6ff1ab9941 in backend_destroy ../subprojects/wlroots/backend/wayland/backend.c:306 #4 0x7f6ff1a68323 in wlr_backend_destroy ../subprojects/wlroots/backend/backend.c:57 #5 0x7f6ff1ab36b4 in multi_backend_destroy ../subprojects/wlroots/backend/multi/backend.c:57 #6 0x7f6ff1ab417c in handle_display_destroy ../subprojects/wlroots/backend/multi/backend.c:124 #7 0x7f6ff106184e in wl_display_destroy (/usr/lib/libwayland-server.so.0+0x884e) previously allocated by thread T0 here: #0 0x7f6ff2236279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7f6ff1066d03 in wl_array_add (/usr/lib/libwayland-server.so.0+0xdd03) [1]: https://github.com/swaywm/wlroots/pull/3002 [2]: https://github.com/swaywm/wlroots/pull/3004
2021-07-08seat: add wlr_seat_touch_{send,notify}_frameSimon Ser
The wl_touch.frame event is used to group multiple touch events together. Instead of sending it immediately after each touch event, rely on the backend to send it (and on the compositor to relay it). This is a breaking change because compositors now need to manually send touch frame events instead of relying on wlr_seat to do it.
2021-07-08cursor: add touch frame eventSimon Ser
2021-07-08backend/x11: send touch frame eventsSimon Ser
2021-07-08backend/wayland: send touch frame eventsSimon Ser
2021-07-08backend/libinput: send touch frame eventsSimon Ser
2021-07-08touch: add frame eventSimon Ser
2021-07-07output-damage: fix output swapchain handlingSimon Ser
When wlr_output.swapchain is used instead of the backend's, the buffer_type will be set to SCANOUT even if wlr_output_attach_render has been called. This tricks wlr_output_damage into thinking the whole output needs to be repainted. Workaround this issue by forcing buffer_type to RENDER when the output has a back-buffer set. Will clean all of that up when removing the precommit event handler altogether. This commit fixes damage tracking on the Wayland, X11 and headless backends.
2021-07-07output: detach buffer from renderer before commitSimon Ser
Right now we rely entirely on implicit sync for synchronizing access to GPU buffers. Implicit sync works by setting synchronization points on the buffer in writers, and letting readers wait on these sync points before accessing the buffer. With OpenGL, sync points are created using functions such as eglSwapBuffers or glFlush. If none of these special functions are called, no sync point will be created and readers will potentially access a buffer that hasn't finished rendering yet. In the context of wlroots, OpenGL is the writer and the backend (KMS or parent Wayland/X11 session) is the reader. After we're done rendering a frame, and before passing that frame to the backend, we need to call glFlush. glFlush is called when the buffer is detached from the renderer. This is a task done by output_clear_back_buffer. So let's call this function before invoking the impl->commit hook, instead of calling it after. All of this is maybe a little tricky to get right with the current renderer_bind_buffer API. The new wlr_renderer_begin_with_buffer API is much better, because glFlush is called on wlr_renderer_end, so it's more intuitive. Closes: https://github.com/swaywm/wlroots/issues/3020
2021-07-06util/box: stabilize interfaceSimon Zeni
2021-07-06move wlr_box from /types to /utilSimon Zeni
2021-07-06types/wlr_box: remove unused wlr_box_from_pixman_box32 and ↵Simon Zeni
wlr_box_rotated_bounds functions
2021-07-05buffer: unify texture creation in wlr_client_buffer_importSimon Ser
All code-paths now invoke wlr_texture_from_buffer. De-duplicate the calls.
2021-07-05buffer: stop sending wl_buffer.release events from wlr_client_bufferSimon Ser
The specialized client buffer implementations take care of this.
2021-07-05buffer: remove renderer param from wlr_resource_get_buffer_sizeSimon Ser
The only reason we had this was because of EGL_WL_bind_wayland_display support, which has been dropped.
2021-07-05render/egl: remove EGL_WL_bind_wayland_display supportSimon Ser
Our GLES2 renderer doesn't use it anymore, so we can drop it.
2021-07-05render: remove wl_drm support from wlr_rendererSimon Ser
Everything needs to go through the unified wlr_buffer interface now. If necessary, there are two ways support for EGL_WL_bind_wayland_display could be restored by compositors: - Either by using GBM to convert back EGL Wayland buffers to DMA-BUFs, then wrap the DMA-BUF into a wlr_buffer. - Or by wrapping the EGL Wayland buffer into a special wlr_buffer that doesn't implement any wlr_buffer_impl hook, and special-case that buffer type in the renderer.
2021-07-05render/gles2: use wlr_drm for wl_drm implementationSimon Ser
This allows use to remove all of our special wl_drm support code.
2021-07-05buffer: handle wl_drm buffersSimon Ser
This allows renderers to choose between implementing the old wlr_renderer_impl.texture_from_wl_drm hook, or opt for the new wlr_drm stub. The stub has the advantage of not requiring any special support code: stubbed wl_drm buffers look exactly like DMA-BUFs from linux-dmabuf-unstable-v1.
2021-07-05drm: add support for DMA-BUFsSimon Ser
Mesa's Vulkan WSI still uses wl_drm when modifiers aren't supported. This has been fixed in [1] but will take some time to be propagated to users. In the meantime, add a fallback. [1]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4942
2021-07-05Add a stub wl_drm implementationSimon Ser
This will allow us to remove all of our EGL wl_drm support code and remove some weird stuff we need just for wl_drm support. In particular, wl_drm buffers coming from the EGL implementation can't easily be wrapped into a wlr_buffer properly.
2021-07-05xcursor: improve documentationSimon Ser
2021-07-05backend/drm: don't clear pending cursor FB on failed commitSimon Ser
The previous fix tried to side-step cursor->pending_fb completely. However that messes up our buffer locking mechanism. Instead, stop clearing the pending cursor FB on a failed commit. The pending cursor FB will remain for the next commit. Fixes: 6c3d080e25e5 ("backend/drm: populate cursor plane's current_fb")
2021-07-05Revert "backend/drm: populate cursor plane's current_fb"Simon Ser
This reverts commit 6c3d080e25e56404228ad7704eed43e40fa0c623. Populating wlr_drm_plane.current_fb messes up the buffer's locking. The previous buffer is released while it's still being displayed on-screen.
2021-07-05region: drop leftover reference to the mailing listSimon Ser
As per [1], the mailing list isn't used anymore. [1]: https://github.com/swaywm/wlroots/pull/3016 Fixes: 82af6e720870 ("region: stabilize interface")
2021-07-05region: stabilize interfaceSimon Ser
References: https://github.com/swaywm/wlroots/issues/1008