Commit Graph

5940 Commits

Author SHA1 Message Date
Simon Ser 45159f8708 output: check wlr_renderer_begin return value 2022-11-15 15:50:19 +00:00
Simon Ser a541c9510a render: make wlr_renderer_begin return a bool 2022-11-15 15:50:19 +00:00
Simon Ser 23540b5579 render: allow wlr_renderer_impl.begin to fail
Make it return a bool to indicate success/failure. Adapt the
various implementations to check errors.
2022-11-15 15:50:19 +00:00
Simon Ser 4a70172e26 render: make some wlr_renderer fields private 2022-11-15 15:50:19 +00:00
Simon Ser 5451cbd183 render: add docs for wlr_renderer 2022-11-15 15:50:19 +00:00
Simon Ser bf623ec782 content-type-v1: add version param to wlr_content_type_manager_v1_create() 2022-11-15 16:43:04 +01:00
Simon Ser 3ef68a4842 backend/x11: use request_state when window is resized 2022-11-15 15:39:55 +00:00
Simon Ser 756ecf8ee9 backend/wayland: use request_state when toplevel is resized 2022-11-15 15:39:55 +00:00
Simon Ser ff55663906 output: introduce request_state event
This allows backends to request the compositor to change the state
of an output.

References: https://github.com/swaywm/wlroots/issues/2300#issuecomment-761819673
2022-11-15 15:39:55 +00:00
Simon Ser 024627e872 content-type-v1: new protocol implementation
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/150
2022-11-15 15:36:09 +00:00
Simon Ser f863b93c05 backend/drm: only request page-flip if active
It doesn't make sense to request a page-flip for a disabled output.

Fixes: 84e727daae ("backend/drm: request page-flip event on modeset")
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3528
2022-11-15 14:14:18 +00:00
Simon Ser 258bf9be1e compositor: drop wlr_surface.{sx,sy}
The concept of a persistent accumulated surface offset is wrong
from a protocol point-of-view. wl_surface.offset is tied to a
commit, its interpretation depends on the surface role.

For example, with the following sequence:

    wl_surface@1.offset(1, 1)
    wl_surface@1.commit()
    wl_pointer@2.set_cursor(wl_surface@1, 42, 42)

The final cursor hotspot is (42, 42): the commit which happened
before the set_cursor request has no impact on the hotspot
computation.

The wlr_output_cursor logic already uses wlr_surface.current.{dx,dy}.
wlr_scene's drag icon doesn't, update it accordingly.
2022-11-15 13:41:09 +00:00
Simon Ser a40ba16a64 backend/drm: fix FPE when disabling output
Fixes: 65836ce357 ("backend/drm: log modesetting commits")
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3534
2022-11-15 10:06:23 +01:00
zccrs 5b34fe5513 render/vulkan: add wlr_vk_texture_has_alpha
Allow to get whether has alpha channel of the VkImage, it can help an
optimization to disable blending when the texture doesn't have alpha.
Because the VkFormat isn't enough because it's always set to
VK_FORMAT_B8G8R8A8_SRGB or VK_FORMAT_R8G8B8A8_SRGB.
2022-11-15 10:58:45 +08:00
Simon Ser 65836ce357 backend/drm: log modesetting commits 2022-11-14 17:39:39 +00:00
Simon Ser b3da33116e backend/drm: log refresh rate in Hz 2022-11-14 17:39:39 +00:00
Alexander Orzechowski c8a5dfcc87 wlr_scene: Add drag icon helper 2022-11-14 15:44:43 +00:00
Simon Ser 9f793d3503 layer-shell-v1: specify version in constructor
This allows compositors to indicate which features they support,
and is required to eventually make this API stable.

References: https://github.com/swaywm/sway/issues/7260
2022-11-14 09:52:13 +01:00
fakechen 4026da53f8 egl: remove eglQueryWaylandBufferWL define
This define doesn't exist anymore.

Signed-off-by: fakechen <chenzigui@kylinos.cn>
Signed-off-by: sunzhguy <sunzhigang1@kylinos.cn>
2022-11-14 09:22:01 +08:00
Kirill Primak 627a5c5112 xwayland: fix wlr_xwayland_surface_from_wlr_surface() docs
32daa43a45 has removed the asymmetry in
the relationship of a wlr_surface and an unmapped wlr_xwayland_surface,
when wlr_surface.role_data wasn't NULL but wlr_xwayland_surface.surface
was. However, this also means that
wlr_xwayland_surface_from_wlr_surface() now returns NULL if the
wlr_surface is unmapped. Fix the documentation to reflect this.
2022-11-13 01:35:12 +03:00
Simon Ser 2b22a10478 scene: constify region APIs 2022-11-11 23:11:17 +00:00
Simon Ser c5d79bfb26 region: constify 2022-11-11 23:11:17 +00:00
Simon Ser fe4225d5de output: constify damage APIs 2022-11-11 23:11:17 +00:00
Simon Ser 9e10e9af7f output-damage: constify wlr_output_damage_add() 2022-11-11 23:11:17 +00:00
Simon Ser fb7bd920a6 damage-ring: constify wlr_damage_ring_add() 2022-11-11 23:11:17 +00:00
Simon Ser 93597952aa buffer: constify wlr_client_buffer_apply_damage() 2022-11-11 23:11:17 +00:00
Simon Ser 6baf045590 render/texture: constify wlr_texture_update_from_buffer() 2022-11-11 23:11:17 +00:00
Simon Ser 9fd28d1e81 util/region: constify 2022-11-11 23:11:17 +00:00
Simon Ser feb5691240 backend: remove const casts for pixman_region32_t
Pixman 0.42.0 has constified APIs for pixman_region32_t. We no longer
need the casts.
2022-11-11 23:11:17 +00:00
Simon Ser 8bbe8624df build: bump pixman version
The new version offers const pixman_region32_t APIs, which we will
make use of in the following commits.
2022-11-11 23:11:17 +00:00
Simon Ser 6c33e5dc50 build: add subproject fallback for Pixman
Allows users to use a Meson subproject for Pixman.
2022-11-11 23:11:17 +00:00
Simon Ser 1928d1ce9f build: move udev dep to backend/
The DRM, libinput and session use udev. They are all hosted under
backend/.
2022-11-11 23:11:17 +00:00
Simon Zeni f3ba14e491 render/vulkan: remove hardcoded validation layers
Users should use the VK_INSTANCE_LAYERS env var to set layers at runtime
2022-11-11 22:56:37 +00:00
Simon Ser 1c4a625fe3 backend/drm: ensure disconnected outputs are disabled after VT switch
The following situation can be dangerous:

- Output DP-1 is plugged in, compositor enables it.
- User VT switches away.
- User unplugs DP-1.
- User VT switches back.
- scan_drm_connectors() figures out the output is now disconnected,
  uninitializes the struct wlr_output.
- The loop restoring previous output state in handle_session_active()
  accesses the struct wlr_output to figure out what to restore.

By chance, we zero out the struct wlr_output after uninitializing it,
so enabled and current_mode will always be zero. But let's make sure
we handle this case explicitly, to remind future readers that it exists
and make the code less fragile.
2022-11-11 22:44:53 +00:00
Simon Zeni ed71915742 render/egl: fix uninitialized pointers in init_dmabuf_formats
`modifiers` and `external_only` are never initialized, and free'd later. This
commit explicitly initializes them to NULL to prevent segfaults on `free()`
2022-11-11 20:22:23 +00:00
Simon Ser e1ba64c4b7 render/vulkan: use initializer for VkBufferImageCopy
Missed that one it seems.
2022-11-11 19:26:48 +00:00
Simon Ser d112c2d922 render/vulkan: wait for device to become idle in vulkan_destroy()
It's not safe to destroy any resources which might still be in-use
by the GPU. Wait for any asynchronous tasks to complete before
destroying everything.
2022-11-11 19:18:04 +00:00
Simon Ser f4f3c15c1e render/vulkan: always wait for last stage to complete before rendering
When we have multiple command buffers in flight, we need to make
sure we don't start rendering before the previous texture uploads
are complete.
2022-11-11 19:18:04 +00:00
Simon Ser 7fdcb45e66 render/vulkan: use command buffer pool for stage 2022-11-11 19:18:04 +00:00
Simon Ser f1eae0eeeb render/vulkan: add a command buffer pool
Before re-using a VkCommandBuffer, we need to wait for its
operations to complete. Right now we unconditionally wait for
rendering to complete in vulkan_end(), however we have plans to
fix this [1]. To fully avoid blocking, we need to handle multiple
command buffers in flight at the same time (e.g. for multi-output,
or for rendering followed by texture uploads).

Implement a pool of command buffers. When we need to render, we
pick a command buffer from the pool which has completed its
operations. If we don't find one, try to allocate a new command
buffer. If we don't have slots in the pool anymore, block like we
did before.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3574
2022-11-11 19:18:04 +00:00
Simon Ser a8a194d695 render/vulkan: switch to timeline semaphores
Up until now we were using a VkFence for GPU-to-CPU
synchronization. This has some limitations that become a blocker
when trying to have multiple command buffers in flight at once
(e.g. for multi-output). It's desirable to implement a command
buffer pool [1], but VkFence cannot be used to track command buffer
completion for individual subpasses.

Let's just switch to timeline semaphores [2], which fix this issue,
make synchronization a lot more ergonomic and are a core Vulkan 1.2
feature.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3802
[2]: https://www.khronos.org/blog/vulkan-timeline-semaphores
2022-11-11 19:18:04 +00:00
Simon Ser f92d1499cd render/vulkan: add helper to load command function pointer
If NULL is returned by vkGetDeviceProcAddr(), either the driver
is buggy, either the wlroots code is buggy. For a valid device and
command name, drivers are not allowed to return NULL per the spec.

This mirrors what the GLES2 renderer does in load_gl_proc().
2022-11-11 19:18:04 +00:00
Simon Ser 5b23987349 build: bump version to 0.17.0-dev 2022-11-11 18:30:56 +01:00
Simon Ser 1712a7d274 build: bump to version 0.16.0 2022-11-11 18:22:17 +01:00
Alexander Orzechowski c58ad0f171 wlr_scene: Remove duplicate buffer check when submitting a new buffer
wlr_buffer allows mutation during its lifetime. This happens for
wlr_client_buffer which fixes damage tracking issues.
2022-11-11 15:37:22 +00:00
Simon Ser 84e727daae backend/drm: request page-flip event on modeset
The old drm_connector_set_mode() function did that by calling
drm_crtc_page_flip(). We lost this in the refactoring.

Fixes: f216e97983 ("backend/drm: drop drm_connector_set_mode()")
2022-11-11 14:46:51 +00:00
Kirill Primak a707b7b101 output-damage: deprecate 2022-11-11 05:31:10 +00:00
Alexander Orzechowski ea40ba4f6a wlr_scene: Fix texture reuse
Add private interface to ignore a buffer that's locking a client_buffer
for damage tracking. This should eventually be replaced by wlr_raster.
2022-11-11 00:08:04 +00:00
illiliti eec95e3d5e backend/drm: use pnp.ids to fetch EDID data 2022-11-09 00:25:18 +03:00
Simon Ser d75b4d8e86 Revert "backend/drm: fetch EDID manufacturer from udev_hwdb"
This reverts commit e646d882cf.

This commit has added a dependency on udev_hwdb. This API isn't
available on all platforms (e.g. FreeBSD), and further deepens
our udev dependency. A better solution is being worked on in [1].

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3638
2022-11-08 19:08:43 +01:00