Commit Graph

2630 Commits

Author SHA1 Message Date
Simon Ser f36a5915da wl-drm: don't store wlr_renderer
Query the formats at init time, then forget about the renderer.
This will allow wl_drm to be created with a list of formats instead
of a renderer, and will behave better after a GPU reset.
2022-12-02 14:27:07 +00:00
Simon Ser c9b378d21a render/drm-format-set: add wlr_drm_format_set_copy() 2022-12-02 14:27:07 +00:00
Simon Ser 8b9a48c984 render/vulkan: drop "_format" in wlr_vk_format fields
"format" is already in the name, no need to repeat ourselves.
`format->vk_format` sounds a bit redundant.
2022-12-02 10:24:00 +01:00
Simon Ser c8eb24d30e output: drop enable/mode events
The backend no longer changes the output state behind the
compositor's back. Instead, compositors can listen to the "commit"
event and check for WLR_OUTPUT_STATE_ENABLED/WLR_OUTPUT_STATE_MODE.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2300
2022-12-01 20:05:04 +00:00
Simon Ser 19dfe99496 output-damage: stop listening for output mode events
These will go away.
2022-12-01 20:05:04 +00:00
Simon Ser fecbaa2bd6 scene: stop listening for output enable/mode events
These will go away.
2022-12-01 20:05:04 +00:00
Alexander Orzechowski fe891ebd4e output_init_render: Allow re-initialization
This lets the compositor call this function after the fact to replace
the renderer/allocator after a renderer context lost.
2022-12-01 10:01:35 +00:00
Alexander Orzechowski db0e962368 wlr_texture: Expose owning renderer 2022-12-01 04:41:43 -05:00
Simon Ser f103dc74d8 linux-dmabuf-v1: introduce wlr_linux_dmabuf_v1_create()
Some compositors may want to use the linux-dmabuf-v1 implementation
with a completely custom renderer. Add a function to create the
global with a default feedback.
2022-11-30 14:19:46 +01:00
Simon Ser 9c04fd2496 linux-dmabuf-v1: drop wlr_renderer field
This isn't used anymore.
2022-11-30 14:19:46 +01:00
Simon Ser 88493d1f7c linux-dmabuf-v1: don't use wlr_renderer to send legacy format list
The wlr_renderer field will go away in a subsequent commit.

Build the legacy device list from the default feedback instead.
2022-11-30 14:19:46 +01:00
Simon Ser d45cffb865 linux-dmabuf-v1: don't use wlr_renderer to sanity check DMA-BUFs
The wlr_renderer field will go away in a subsequent commit.

Instead of trying to create a texture, try to import the DMA-BUF
into the DRM device FD.
2022-11-30 14:14:07 +01:00
Simon Ser c99c60090c linux-dmabuf-v1: add version arg to create()
To be able to add support for newer versions without breaking
changes.
2022-11-30 14:14:04 +01:00
Simon Ser 444d94ef89 linux-dmabuf-v1: add "_with_renderer" suffix to create() function
Make it clear this is a helper consuming a wlr_renderer. We'll
add a lower-level create() function which doesn't take it in the
next commit.
2022-11-30 14:14:02 +01:00
Simon Ser d2238bf722 render/vulkan: import semaphore to DMA-BUF instead of blocking
Right now the Vulkan renderer blocks until the frame is complete
after rendering. This is necessary because Vulkan doesn't
interoperate well with implicit sync we use everywhere else.

Use the new kernel API to import a sync_file into a DMA-BUF to
avoid blocking.
2022-11-28 23:50:41 +00:00
Simon Ser aaf828d3d2 render/dmabuf: add dmabuf_import_sync_file
References: https://lore.kernel.org/dri-devel/20220506180216.2095060-1-jason@jlekstrand.net/
2022-11-28 23:50:41 +00:00
Simon Ser 10f543d579 render/vulkan: release stage buffers after command buffer completes
We need to wait for the pending command buffer to complete before
re-using stage buffers. Otherwise we'll overwrite the stage buffer
with new contents before the texture is fully uploaded.
2022-11-28 23:50:41 +00:00
Simon Ser 2a414c896e render/vulkan: destroy textures after command buffer completes
We need to wait for any pending command buffer to complete before
we're able to fully destroy a struct wlr_vk_texture: the Vulkan
spec requires the VkDescriptorSet to be kept alive.

So far we've done this in vulkan_end(), after blocking until the
command buffer completes. We'll soon stop blocking, so move this
logic in get_command_buffer(), where we check which commands buffers
have completed in a non-blocking fashion.
2022-11-28 23:50:41 +00:00
Simon Ser 0730552e85 render/vulkan: drop unused fields from wlr_vk_format_modifier_props
export_imported is never used, and dmabuf_flags is already checked
in query_modifier_support().
2022-11-28 10:22:56 +01:00
Simon Ser ab6607b950 build: exclude <wlr/types/wlr_drm_lease_v1.h> without DRM backend
When the DRM backend is disabled, so is the DRM lease protocol.
Prevent the header from being installed in that case.
2022-11-27 10:57:32 +00:00
Manuel Stoeckl c02872e033 render/vulkan: align staging buffers for texture upload
vkCmdCopyBufferToImage requires that the buffer offset be a multiple
of the texel block size, which for single plane uncompressed formats
is the same as the number of bytes per pixel. This commit adds an
alignment parameter to vulkan_get_stage_span which ensures that the
provided span (and the sequence of image copy operations derived which
use it) have this alignment.
2022-11-25 12:29:02 -05:00
Simon Ser f0375eed24 backend/session: make optional
Some compositors are not interested in wlr_session, for instance
nested compositors.

Disabling wlr_session removes the udev dependency.
2022-11-25 16:15:29 +00:00
Simon Ser 769cabbadf util/time: use int64_t return value for get_current_time_msec()
0xFFFFFFFF milliseconds is 4,294,967,295 ms so about 50 days.
A little bit too close for comfort.

Use int64_t instead of uint64_t to avoid C's implicit conversion
footguns in computations.
2022-11-25 16:15:29 +00:00
Simon Ser 76b3687739 shm: add create() function without a wlr_renderer
This allows compositors which don't use wlr_renderer to still use
wlroots' wl_shm implementation.
2022-11-25 15:16:42 +00:00
Manuel Stoeckl 3ed69b4946 render/vulkan: add support for RGB565 texture format
Since this does not have a matching _SRGB-type vulkan format, add a
new shader variant/pipeline to perform the sRGB->linear texture
conversion.
2022-11-25 14:19:27 +00:00
Kirill Primak 060df4c6c0 scene: introduce wlr_scene_buffer.events.outputs_update
This event is useful for e.g. sending the preferred buffer scale to the
client.
2022-11-24 22:28:13 +00:00
Simon Ser 42016fa262 compositor: make renderer optional
This is a first step towards moving texture uploading out of
wlr_compositor.

This commit allows compositors to opt-out of the texture uploading
by passing a NULL wlr_renderer. An immediate user of this is
gamescope, which currently implements a stub wlr_renderer just to
make wlr_compositor happy.
2022-11-24 21:55:24 +00:00
Simon Ser 359df5ef84 compsitor: document wlr_compositor_create() 2022-11-24 21:55:24 +00:00
Simon Ser d47016abb2 backend/multi: stop pulling <wlr/backend/session.h>
Unused.
2022-11-24 21:50:28 +00:00
Simon Ser 0fa5743c26 render/gles2, render/pixman: stop pulling <wlr/backend.h>
No reason why the GLES2/Pixman renderers should depend on the
backend.
2022-11-24 21:50:28 +00:00
Simon Ser b89a050e58 backend: stop pulling <wlr/backend/session.h>
We can just forward-declare the struct instead.
2022-11-24 21:50:28 +00:00
Simon Ser ba13f471ea backend/session: drop unused <libudev.h>
We don't actually need to pull that header here.
2022-11-24 21:50:28 +00:00
Simon Ser 99134c26b8 render: stop pulling <wlr/backend.h>
Let's just forward-declare struct wlr_backend instead.

We need to fixup the Vulkan renderer: it needs makedev(), which
got included by chance via <wlr/backend.h> → <wlr/backend/session.h>
→ <libudev.h>.
2022-11-24 21:50:28 +00:00
Simon Ser 4ff46e6cf9 xwayland/xwm: add support for xwayland-shell-v1 2022-11-18 15:35:20 +00:00
Simon Ser 85b37127a6 xwayland/shell: add wlr_xwayland_shell_v1_surface_from_serial() 2022-11-18 15:35:20 +00:00
Simon Ser d19191ff6b xwayland/server: delay non-lazy startup
This allows users to setup event listeners before the server is
actually started.
2022-11-18 15:35:20 +00:00
Simon Ser 3f40b0031f xwayland/server: add start signal
This can be used to know when wlr_xwayland_server decides to start
a new Xwayland process. At that point the wl_client has already
been created but the Xwayland process hasn't been started yet.
2022-11-18 15:35:20 +00:00
Simon Ser d3b84463f8 xwayland: add wlr_xwayland_shell_v1_destroy() 2022-11-18 15:35:20 +00:00
Simon Ser 44c7e233ff xwayland: add wlr_xwayland_shell_v1_set_client() 2022-11-18 15:35:20 +00:00
Simon Ser 69b0b296a2 xwayland-shell-v1: new protocol implementation
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/163
2022-11-18 15:35:20 +00:00
Kirill Primak 236918d52e Nuke deprecated include/wlr/types/wlr_surface.h
Use wlr_compositor.h and wlr_subcompositor.h instead.
2022-11-17 10:12:06 +00:00
Simon Ser 6c3d6be74b output: drop wlr_output_damage_whole()
This function is not used anymore. Backends have no good reason to
damage outputs.
2022-11-17 09:17:32 +00:00
Simon Ser e7c556fcf6 backend: drop wlr_backend_get_session()
This no longer has purpose.
2022-11-15 21:16:25 +00:00
Simon Ser 41b7acbab7 backend: return wlr_session in wlr_backend_autocreate() call
Up until now, wlr_backend_autocreate() created the wlr_session and
then stuffed it into struct wlr_multi_backend so that compositors
can grab it later.

This is an abuse of wlr_multi_backend and the wlr_backend API:
wlr_backend_get_session() and wlr_multi_backend.session only exist
to accomodate the needs of wlr_backend_autocreate(). What's more,
the DRM and libinput backends don't implement
wlr_backend_impl.get_session.

Instead, return the struct wlr_session to the compositor in the
wlr_backend_autocreate() call. wlr_backend_get_session() will be
removed in the next commit.
2022-11-15 21:16:25 +00:00
Simon Ser 6c277e3c39 buffer: drop wlr_shm_client_buffer
It's been superseded by wlr_shm.
2022-11-15 16:30:00 +00:00
Simon Ser 0ae3c7b1a2 Introduce wlr_shm
This is a re-implementation of wl_shm. The motivations for using
this over the one shipped in libwayland are:

- Properly handle SIGBUS when accessing a wl_buffer's underlying
  data after the wl_buffer protocol object has been destroyed.
  With the current code, we just crash if the client does that
  and then shrinks the backing file.
- No need to fight the wl_shm_buffer API anymore. This was awkward
  because we weren't notified when clients created a wl_shm buffer,
  and this doesn't play well with our wlr_buffer abstraction.
- Access to the underlying FD. This makes it possible to forward
  the wl_shm buffer to a parent compositor with the Wayland/X11
  backends.
- Better stride checks. We can use our format table to ensure that
  the stride is consistent with the bpp and width.
2022-11-15 16:30:00 +00:00
Simon Ser 6e88eeadeb render/pixel_format: import pixel_format_info_check_stride()
We'll use this function from wlr_shm too.

Add some assertions, use int32_t (since the wire protocol uses that,
and we don't want to use 16-bit integers on exotic systems) and
switch the stride check to be overflow-safe.
2022-11-15 16:30:00 +00:00
Kirill Primak 8cfd44980b input-inhibitor: deprecate
The protocol itself has been deprecated.
2022-11-15 16:06:53 +00:00
Simon Ser 165352e32f render/egl: enable EGL_LOSE_CONTEXT_ON_RESET
This allows the GLES2 renderer to figure out when a GPU reset
happens.
2022-11-15 15:50:19 +00:00
Simon Ser 261d6998fb render/gles2: query glGetGraphicsResetStatusKHR
Call glGetGraphicsResetStatusKHR in wlr_renderer_begin to figure
out when a GPU reset occurs. Destroy the renderer when this
happens (the OpenGL context is defunct).
2022-11-15 15:50:19 +00:00
Simon Ser 31ea61b390 render: add wlr_renderer.events.lost 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 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 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
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
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 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
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
Kirill Primak 4152db92ef damage-ring: add missing headers 2022-11-08 17:10:56 +00:00
zccrs 270914d379 render/vulkan: add some interfaces to allow compositors to integrate
Added wlr_vk_renderer_get_* functions to allow get the VkInstance,
VkPhysicalDevice, VkDevice, queue family of a wlr_vk_renderer.

Added wlr_vk_renderer_get_current_image_attribs function to allow get
the VkImage of current renderer buffer to use on compositors.

Added wlr_renderer_is_vk function, it's like the wlr_renderer_is_gles2,
returns true if the wlr_renderer is a wlr_vk_renderer.

Added wlr_vk_image_get_attribs function to get a VkImage and it's
extras information (e.g. a VkImageLayout and VkImageFormat of the
VkImage) from a wlr_texture.
2022-11-08 12:56:38 +01:00
Simon Ser 6c31f3b078 render/vulkan: use wl_array for wlr_vk_shared_buffer.allocs
Avoids the need to open-code the realloc() logic.
2022-11-07 21:22:33 +00:00
Simon Ser ea68506b73 render/vulkan: fix and add missing wl_list comments
In wlroots we add comments near struct wl_list members to indicate
which type it's linked to. The Vulkan renderer had some comments
with mistakes, and some members without a comment.
2022-11-07 14:08:03 +00:00
Kirill Primak 32daa43a45 xwayland/xwm: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak acd5a64fd1 xdg-shell: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak 92fbfda2ca drag-icon: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak 75af6a0a39 input-method: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak bcf6b2bbf8 session-lock: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak 2518ace573 subcompositor: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak 3da2cf3eb3 layer-shell: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak 756260ac05 compositor: introduce wlr_surface_destroy_role_object() 2022-11-06 14:16:05 +03:00
Kirill Primak 1243a855d4 xdg-shell: fix geometry types 2022-11-05 18:30:09 +00:00
Simon Ser 3b75ab97e2 render/vulkan: drop outdated comments 2022-11-04 14:29:54 +01:00
Simon Ser 2ac2835a1f render/vulkan: remove exts arg from vulkan_instance_create() 2022-11-04 14:12:38 +01:00
David96 7a42392da2 render/vulkan: add caching to vulkan_read_pixels 2022-11-04 09:13:48 +00:00
Simon Ser 05454618cd xwayland: split headers
We're about to get one more Xwayland-related thing, and this header
already contains two things.
2022-11-02 19:00:23 +01:00
Simon Ser f83b3809cf render/gles2: remove stale gles2_texture_from_wl_drm() prototype
This function doesn't exist anymore.
2022-10-25 10:19:15 +02:00
Isaac Freund a773231c42 wlr-output-management: implement adaptive sync
Version 4 of the protocol adds support for reporting/setting adaptive
sync state of outputs. Implement these new requests/events in wlroots.
2022-10-24 16:19:25 +00:00
Simon Ser ccf4e04036 output: clarify custom modes warning
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3514
2022-10-20 10:43:50 +00:00
Simon Ser 3a949ea8eb idle-notify-v1: new protocol implementation
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/29
2022-10-14 13:36:15 +00:00
Kirill Primak a049d66dd7 xdg-toplevel: send invalid_parent error 2022-10-14 10:57:49 +00:00
Simon Ser a28caf08e3 backend: use global output name counters
The output names must be globally unique per the Wayland spec, even
if the compositor creates multiple backends of the same kind.
2022-10-13 13:12:43 +02:00
Simon Ser 221ee83d44 render/vulkan: drop wlr_vk_instance.extensions
This was unused. Even if it was, it'd be better to have bool fields
instead.
2022-10-10 14:39:47 +02:00
Simon Ser 5c382f6344 drm-lease-v1: fix error codepath
We were crashing in the error codepath [1] when
wlr_drm_create_lease() fails.

To fix this, delay the creation of the wlr_drm_lease_v1 until the
request is granted. Previously we were allocating that struct early
without populating the drm_lease field. However that means we ended
up with a half-constructed struct in the error codepath which is
annoying to handle.

[1]: https://github.com/swaywm/sway/issues/7204#issuecomment-1269797356
2022-10-07 19:49:28 +00:00
Simon Ser f4cf0a8d86 backend/drm: nuke wlr_drm_connector.desired_enabled
This field becomes stale too easily: for instance, see 6adca4089c
("backend/drm: don't unconditionally set desired_enabled").
Additionally, drm_connector_alloc_crtc() needs to do some weird
dance, restoring its previous value.

Instead, add a connector arg to realloc_crtcs() to indicate a new
connector we want to enable.
2022-10-07 16:28:36 +00:00
Kirill Primak 46a686ce6b output-damage: drop unused pending_attach_render 2022-10-07 18:09:26 +03:00
Kirill Primak dd0665d822 output-damage: drop precommit listener 2022-10-07 17:43:50 +03:00
Simon Ser 6832ae14aa render: drop wlr_renderer_read_pixels() flags
These are unused.
2022-10-04 09:15:19 +02:00
Consolatis e22aa2796c screencopy-v1: make sure wlr_buffer enum is visible
.. by including wlr_buffer.h
2022-10-01 18:53:36 +00:00
Simon Ser e4efb6b601 render/vulkan: use addon for wlr_vk_texture
Avoids having to walk the list of all textures.
2022-09-30 14:02:51 +00:00
Simon Ser 7899b97d20 render/vulkan: use addon for wlr_vk_render_buffer
Avoids having to walk the list containing all of the render buffers.
2022-09-30 14:02:51 +00:00
Simon Ser a0345f2854 output: add wlr_output_state.allow_artifacts
When starting up, the compositor might call wlr_output_set_mode()
with a mode which is already the current one. wlroots will detect
this and make the wlr_output_set_mode() call a no-op. During the
next wlr_output_commit() call, wlroots will perform an atomic
commit without the ALLOW_MODESET flag.

This is an issue, because some drivers need ALLOW_MODESET even if
the mode is the same. For instance, if the FB stride or modifier
changed, some drivers require a modeset.

Add a new flag "allow_artifacts" which is set when the compositor
calls mode-setting functions. Use this flag to figure out whether
we want to perform atomic commits with ALLOW_MODESET.

(The name "allow_artifacts" is picked because ALLOW_MODESET is a
misnomer, see [1].)

[1]: https://patchwork.freedesktop.org/patch/505107/

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3499
2022-09-30 10:58:17 +00:00
Simon Ser c153ae3c5d screencopy-v1: use wlr_buffer APIs
Instead of using low-level wl_shm_buffer and wlr_dmabuf_v1_buffer
APIs, use the unified wlr_buffer APIs. That way it doesn't matter
what the exact wlr_buffer implementation is used, any which provides
the necessary capabilities (data_ptr or dmabuf) would work.

Simplifies the logic a bit, and will make the transition to wlr_shm
easier.
2022-09-22 18:01:52 +00:00
Simon Ser f03da48491 screencopy-v1: rename wlr_screencopy_frame_v1.stride
Make it clear it's only about shm, not about DMA-BUFs.
2022-09-22 18:01:52 +00:00
Simon Ser 77b829e15f screencopy-v1: use DRM format code for shm buffers
Will allow us to simplify common shm/DMA-BUF logic later on.
2022-09-22 18:01:52 +00:00
Simon Ser 4885c08f38 screencopy-v1: rename wlr_screencopy_frame_v1.{format,fourcc}
Make it clear that one is for shm buffers only, and the other is
for DMA-BUF buffers only.
2022-09-22 18:01:52 +00:00
Simon Ser 0cabc83046 backend/drm: pass through mode picture aspect ratio 2022-09-22 09:38:27 +02:00
Simon Ser 2178573b0a output: add wlr_output_mode.picture_aspect_ratio
CTA-861-H defines a picture aspect ratio which may be attached to
each mode. This affects the way the sink will display the image.
See annexes H.1 and H.2 for examples.
2022-09-22 09:36:59 +02:00
Simon Ser 8e8b9a7217 output: fix back buffer checks
The back buffer is no longer set at commit time since 0556aa0c59
("output: rejigger attach/clear for back buffer").

Instead, check whether the buffer belongs to the output swapchain.
This is more robust.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3496
2022-09-21 16:18:16 +02:00
Simon Ser 5206cea566 render/egl: add support for EGL_KHR_display_reference
See the spec at [1]. tl;dr EGL has terrible defaults: eglTerminate()
may have side-effects on completely unrelated EGLDisplay objects.
This extension allows us to opt-in to get the sane behavior:
eglTerminate() only free's our own EGLDisplay without affecting
others.

[1]: https://registry.khronos.org/EGL/extensions/KHR/EGL_KHR_display_reference.txt
2022-09-19 10:04:47 +00:00
Simon Ser 1465d238a4 single-pixel-buffer-v1: fix header guard name
Be consistent with other headers.
2022-09-17 09:18:11 +02:00
Simon Ser 69c47717c2 buffer: split into multiple files
wlr_buffer.c is difficult to read because it contains a mixed bag
of unrelated things: base buffer type, buffer implementations,
buffer resource factory, and client buffer.

Split each of these into their own file.
2022-09-16 18:32:22 +02:00
Kirill Primak 3abedaf211 subcompositor: move+rename subsurface_parent_commit() 2022-09-12 18:44:36 +00:00
Kirill Primak 4cc3abb966 xdg-foreign-v2: s/unmap/destroy
Same as the previous commit.
2022-09-11 09:20:08 +03:00
Kirill Primak ba7bbab3ab xdg-foreign-v1: s/unmap/destroy
dac040f87f mistakenly renamed
xdg_surface_destroy listener, which was listening to *unmap* events, to
xdg_surface_unmap. The actual fix, however, is to listen to destroy
events. This fixes various crashes.
2022-09-11 09:20:08 +03:00
Simon Ser ed018a3ee2 render/vulkan: drop wlr_vk_device.extensions
We don't need to store the list of enabled extensions.

While at it, rename variables to be less confusing.
2022-09-07 14:41:40 +02:00
Simon Ser e19007dede render/vulkan: drop ext params from vulkan_device_create()
These are unused.
2022-09-07 14:39:58 +02:00
Simon Ser f8ae564906 compositor: fix wlr_surface_set_role return value docs
It returns a bool, not an int.
2022-09-05 15:34:19 +02:00
Isaac Freund fd0b0276c9 output: remove unknown adaptive sync state
This was previously used by the X11 backend but is no longer required
since the previous commit.
2022-08-30 17:53:50 +00:00
Simon Ser 8c70245d5f output: fail commits if adaptive sync cannot be enabled
Previously, adaptive sync was just a hint and wouldn't make any
atomic commit fail if the backend didn't support it. The main reason
is wlr_output_test wasn't supported at the time.

Now that we have a way for compositors to test whether a change can
work, let's remove the exception for adaptive sync and convert it to
a regular output state field.
2022-08-30 17:53:50 +00:00
Kirill Primak 7333a4602a util/set: overhaul 2022-08-29 13:48:42 +00:00
Kirill Primak 20c208d46a util/array: unclutter 2022-08-29 13:48:42 +00:00
Alexander Orzechowski 31a9fc1fb6 util: Introduce env helpers 2022-08-22 10:18:00 -04:00
Kenny Levinsen 7c575922c0 wlr_scene: Convert render_list to wl_array
This simplifies some of the growth logic, but uses array_realloc to shrink the
array if needed.
2022-08-19 19:38:33 +02:00
Kenny Levinsen 724aa38fc2 util/array: Add array_realloc for wl_array
array_realloc will grow the array for the target size like wl_insert_add, but
will also shrink the array if the target size is sufficiently smaller than the
current allocation.
2022-08-19 19:38:33 +02:00
Alexander Orzechowski 346e524201 Remove wlr_signal_emit_safe 2022-08-18 07:16:16 -04:00
Alexander Orzechowski 1d08ef234e util/box: Introduce wlr_fbox_equal 2022-08-15 06:14:59 -04:00
Alexander Orzechowski 9f3bd64a33 util/box: Introduce wlr_box_equal 2022-08-15 06:14:28 -04:00
Alexander Orzechowski 59675347e6 wlr_scene: Remove unused typedef 2022-08-14 02:38:51 -04:00
Alexander Orzechowski 919e67da7d wlr_scene: Account for occlusion by other scene nodes when calculating visibility 2022-08-14 02:38:51 -04:00
Alexander Orzechowski 18417026be wlr_scene: Introduce buffer opaque region metadata 2022-08-14 02:38:50 -04:00
Alexander Orzechowski 0a9a941ba3 wlr_scene: Rewrite direct scan out logic to rely on visibility
Also make the regular rendering logic use the introduced
render list.
2022-08-14 02:38:50 -04:00
Alexander Orzechowski 028606512d wlr_scene: Add per scene node visibility 2022-08-14 01:39:20 -04:00
Simon Ser 42d68d7532 surface: add WLR_SURFACE_STATE_OFFSET
This indicates whether the surface offset has changed.
2022-08-12 11:20:44 +02:00
Simon Ser 98cf38601f 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-08-12 08:41:32 +00:00
Simon Ser 8c3c6987db backend/wayland: fix touch device not added on startup
We were firing the new_input signal on backend initialization,
before the compositor had the chance to add a listener for it.

Mimick what's done for wl_keyboard: if the backend hasn't been
started, delay wl_touch initialization.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3473
2022-08-11 09:13:08 +02:00
Simon Ser f244094682 backend/drm: drop enum wlr_drm_connector_status
We can just use libdrm's drmModeConnection enum instead.
2022-08-10 14:19:58 +00:00
Simon Ser 08973d2430 backend/drm: drop WLR_DRM_CONN_NEEDS_MODESET
- Add wlr_output.enabled checks to CONNECTED checks
- Replace NEEDS_MODESET with CONNECTED
2022-08-10 14:19:58 +00:00
Simon Ser 6a5fb22698 backend/drm: remove unused WLR_DRM_CONN_CLEANUP 2022-08-10 14:19:58 +00:00
Alexander Orzechowski f72aeacd6e wlr_scene: Add option to disable direct scanout
Closes: #3405
Supersedes: !3562

Co-authored-by: Xiao YaoBing <xiaoyaobing@qq.com>
2022-08-08 00:40:21 -04:00
Simon Ser b24b50ec0c single-pixel-buffer-v1: new protocol implementation
This implements the single-pixel-buffer-v1 protocol [1], to allow clients
to create 1x1 buffers with a single color.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/104
2022-08-03 10:35:23 +00:00
Simon Ser f1e05a6493 xdg-shell: add support for v5
This version adds a wm_capabilities event.
2022-08-01 18:50:16 +02:00
Simon Ser bd587a7f43 backend/drm: use drmModeGetConnectorTypeName
No need to manually maintain this table now.

The wlroots names and the libdrm (= kernel) names all match.

References: 50f8d51773
2022-07-25 17:28:33 +00:00
José Expósito add44b3e2e seat: support low-resolution clients
When the client doesn't support high-resolution scroll, accumulate
deltas until we can notify a discrete event.

Some mice have a free spinning wheel, making possible to lock the wheel
when the accumulator value is not 0. To avoid synchronization issues
between the mouse wheel and the accumulators, store the last delta and
when the scroll direction changes, reset the accumulator.
2022-07-11 11:01:35 +02:00
José Expósito c6032d6b1c backend/libinput: handle high-res scroll events
On newer versions of libinput, the event LIBINPUT_EVENT_POINTER_AXIS
has been deprecated in favour of LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
LIBINPUT_EVENT_POINTER_SCROLL_FINGER and
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS.

Where new events are provided by the backend, ignore
LIBINPUT_EVENT_POINTER_AXIS, receive high-resolution scroll events from
libinput and emit the appropiate wlr_pointer signal.
2022-07-11 11:01:35 +02:00
José Expósito 65c436407f pointer: transform low-res to high-res axis events
Currently, the "wlr_event_pointer_axis" event stores low-resolution
values in its "delta_discrete" field. Low-resolution values are always
multiples of one, i.e., 1 for one wheel detent, 2 for two wheel
detents, etc.

In order to simplify internal handling of events, always transform in
the backend from the low-resolution value into the high-resolution
value.

The transformation is performed by multiplying by 120. The 120 magic
number is used by the kernel and it is exposed to clients in the
"WLR_POINTER_AXIS_DISCRETE_STEP" constant.
2022-07-11 11:01:35 +02: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
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
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
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
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 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 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 6688a3d9ea output: add output state setters
This ensures compositors don't forget to set the committed flag
or the mode_type when setting a field.
2022-06-08 18:22:32 +02:00
Isaac Freund 0deef6fe44 output: fix leak of empty back buffer lock
This refactors output_ensure_buffer() to not mutate the state passed,
making the previous subtle behavior much more explicit.

Fixes: d483dd2f ("output: add wlr_output_commit_state")
Closes: #3442
2022-06-07 15:30:08 +00:00
Simon Ser 1b27d537d1 backend/drm: unconditionally set "content type" to graphics
CTA-861-G says that "graphics" is used to indicate non-analog (ie,
digital) content. With that bit set, the sink should turn off analog
reconstruction and other related filtering.
2022-06-07 13:21:21 +00:00
Simon Ser e383c1f1db xdg-shell: add support for v4
This adds a configure_bounds event to let the client know of the
preferred maximum window geometry size.
2022-06-01 18:18:54 +02:00
Kirill Primak 0c2eed533e scene/output-layout: improve ownership logic
This commit ensures that outputs that weren't created by the output
layout helper aren't destroyed on the output layout change.

Consider the following piece of logic:

// struct wlr_output *o1, *o2;
// struct wlr_scene *scene;
// struct wlr_output_layout *layout;
wlr_scene_attach_output_layout(scene, layout);
wlr_output_layout_add_auto(layout, o1);
struct wlr_scene_output *so2 = wlr_scene_output_create(scene, o2);
wlr_output_layout_move(layout, o1, 100, 200);
// so2 is invalid now
2022-06-01 09:49:25 +00:00
Kirill Primak d3bc17d5d1 scene: add wlr_scene_output.events.destroy 2022-06-01 09:49:25 +00:00
Kirill Primak ec328ca8cc scene/wlr_scene.h: fix indentation 2022-05-31 20:34:50 +03:00
Simon Ser 638c5cda51 output: drop wlr_output_cursor.events.destroy
Compositors can just listen to wlr_output.events.destroy instead.
2022-05-31 11:40:47 +00:00
Simon Ser 459a642e83 output: introduce wlr_output_cursor_set_buffer
This will supersede wlr_output_cursor_set_image, and then later
also supersede wlr_output_cursor_set_surface.
2022-05-31 11:40:47 +00:00
Alexander Orzechowski 71f8a48d38 wlr_scene: Move children list from wlr_scene_node to wlr_scene_tree 2022-05-31 09:14:28 +00:00
Alexander Orzechowski cb2dbc327e wlr_scene: Inline wlr_scene_node_state
This seems like nothing interesting was done with this. Let's simplify
and allow us some flexibility in the future.
2022-05-31 09:14:28 +00:00
Alexander Orzechowski ccd0f85c2a wlr_scene: Only allow parenting on a wlr_scene_tree 2022-05-31 09:14:28 +00:00
Alexander Orzechowski 9eb71146ae wlr_scene: Refactor wlr_scene (the root element) to encase a wlr_scene_tree
Co-authored-by: Isaac Freund <mail@isaacfreund.com>
2022-05-31 09:14:28 +00:00
Simon Ser bb2946f737 build: make GBM optional
Now that the DRM backend no longer depends on GBM, we can make it
optional. The GLES2 renderer still depends on it because of our EGL
device selection.

This is useful for compositors with their own renderers, and for
compositors using the Vulkan renderer.
2022-05-30 13:30:08 +00:00
Simon Ser d483dd2f4c output: add wlr_output_commit_state
Same as wlr_output_commit, but takes a wlr_output_state.
2022-05-30 11:40:34 +02:00
Simon Ser b21c26a1c9 output: add wlr_output_event_precommit.state 2022-05-30 11:34:57 +02:00
Simon Ser c4253fef9c output: add wlr_output_test_state
Same as wlr_output_test, but takes a wlr_output_state argument.
2022-05-30 11:34:57 +02:00
Simon Ser 9e25d3074d output: pass wlr_output_state to rendering functions
No functional change.
2022-05-30 11:34:57 +02:00
Simon Ser 927661d246 output: pass wlr_output_state to output_pending_resolution 2022-05-30 11:34:57 +02:00
Simon Ser 25dd3cc0cd output: pass wlr_output_state to backend
Groundwork for the following commits. The goal is to allow users
to specify their own wlr_output_state instead of wlr_output.pending.
2022-05-30 11:34:57 +02:00
Kirill Primak 1761c3bbe2 xdg-popup: add reposition support 2022-05-27 13:31:30 +00:00
Kirill Primak 8a0835c59c xdg-positioner: add v3 parameters 2022-05-27 13:31:30 +00:00
Kirill Primak 6f1fce9cb4 xdg-popup: use current/pending state pattern 2022-05-27 13:31:30 +00:00
Kirill Primak 4a968576e4 xdg-popup: add proper configure flow 2022-05-27 13:31:30 +00:00
Simon Ser be86145322 output: turn make/model/serial into char *
This allows the make/model/serial to be NULL when unset, and allows
them to be longer than the hardcoded array length.

This is a breaking change: compositors need to handle the new NULL
case, and we stop setting make/model to useless "headless" or
"wayland" strings.
2022-05-26 13:36:06 +00:00
Simon Ser 1cb6b2cf67 render/egl: document wlr_egl_create_with_context 2022-05-25 18:17:41 +00:00
Simon Ser 4b3e08c8ac render/egl: make wlr_egl_{make,unset,is}_current private
These are trivial wrappers around eglMakeCurrent and
eglGetCurrentContext. Compositors which need to call these
functions will also call other EGL or GL functions anyways. Let's
reduce our API surface a bit by making them private.
2022-05-25 18:17:41 +00:00
Simon Ser f954092f22 render/egl: make wlr_egl struct opaque
Compositors can use wlr_egl_create_with_context if they need a
custom EGL display or context.
2022-05-25 18:17:41 +00:00
Simon Ser 452a8ec940 render/egl: add wlr_egl_get_{context,display}
This allows compositors to integrate with the wlroots GLES2
renderer, if they need to perform custom GL rendering.
2022-05-25 18:17:41 +00:00
Simon Ser 4b77eadf06 render/egl: drop MESA_EGL_NO_X11_HEADERS
This has been superseded by the standard EGL_NO_X11 switch,
supported by Mesa 19.3.0+.
2022-05-25 17:50:39 +02:00
Simon Ser 28d89779af Reformat doc comments
Unify the way we document our APIs. See CONTRIBUTING.md for the
rules.
2022-05-25 14:22:58 +00:00
Simon Ser f91f38b79a backend/drm: remove wlr_drm_surface.{width,height}
This information is stored in wlr_swapchain, no need to duplicate
it.
2022-05-25 15:55:41 +02:00
Simon Ser 078d8dd472 build: bump version to 0.16.0-dev
Same as [1].

[1]: https://github.com/swaywm/sway/pull/6730
2022-05-24 15:04:14 +02:00
Alexander Orzechowski 41124592dd wlr_scene: Hook up HIGHLIGHT logic
This will display red translucent rectangles on the screen regions that
have been damaged. These rectangles will fade out over the span of 250
msecs. If the area is damaged again while the region is fading out,
the timer is reset.

Let's also disable direct scan out when this option is enabled, or else
we won't be able to render the highlight damage regions.
2022-05-23 15:58:49 -04:00
Alexander Orzechowski 17f5414b1a wlr_scene: Parse out WLR_SCENE_DEBUG_DAMAGE 2022-05-23 15:43:18 -04:00
Kirill Primak 4ac19e9f9c util/addon: avoid calling finish() twice
No functional change.
2022-05-23 11:11:38 +00:00
Simon Ser cde3700386 xwayland: use dict to collect supported features 2022-05-23 09:49:58 +02:00
Joshua Ashton 02e648c1b2 xwayland: Add support for -force-xrandr-emulation 2022-05-23 07:30:28 +00:00
Guido Günther 17b2b06633 seat: Allow to cancel touches
After cancelation we destroy the touch points associated with this
surface as the Wayland spec says:

No further events are sent to the clients from that particular gesture.
Touch cancellation applies to all touch points currently active on this
client's surface. The client is responsible for finalizing the touch
points, future touch points on this surface may re-use the touch point
ID.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2999
2022-05-22 09:43:33 +00:00
Alexander Orzechowski dc9bc5683a wlr_scene: Refactor wlr_scene_surface to be a helper on top of wlr_scene_buffer 2022-05-19 14:26:50 -04:00
Alexander Orzechowski 5f43e1732a wlr_scene: Introduce addons to scene nodes 2022-05-19 14:25:34 -04:00
Alexander Orzechowski f2dbcc3358 wlr_scene: Make presentation object public 2022-05-19 14:24:05 -04:00
Alexander Orzechowski 20cc1ce0b9 wlr_scene: Change out surface specific iterator functions
Instead iterate over wlr_scene_buffer
2022-05-19 14:24:05 -04:00
Alexander Orzechowski 5f56246571 wlr_scene: Pull scene_node_get_root into a private header
We will need this for surface emulation on buffers.
2022-05-19 14:24:05 -04:00
Alexander Orzechowski 39c059b70e wlr_scene: Make scene_buffer_from_node public 2022-05-19 14:24:05 -04:00
Alexander Orzechowski 73a656e8ac wlr_scene: Add a function to also specify damage when applying a buffer to wlr_scene_buffer 2022-05-19 14:24:05 -04:00
Alexander Orzechowski 34be5da072 wlr_scene: Add a way to choose when input interactions happen on a buffer 2022-05-19 14:24:05 -04:00
Alexander Orzechowski 09c7fe0f90 wlr_scene: Add frame_done signal for wlr_scene_buffer
Let's also change the name of the function. Motivation [1].

[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3496#note_1357824
2022-05-19 14:23:10 -04:00
Alexander Orzechowski a53eccf2af wlr_scene: Add primary_output property to wlr_scene_buffer 2022-05-19 14:21:22 -04:00
Alexander Orzechowski dfeb1309a8 wlr_scene: Add presentation signal for wlr_scene_buffer 2022-05-19 14:21:21 -04:00
Alexander Orzechowski 7e383c6a6a wlr_scene: Make wlr_scene_render_output private
This function sidesteps damage tracking and output awareness on
buffers/surfaces. This function isn't a great fit for the API.

Let's also inline the function and simplify it.
2022-05-19 14:17:51 -04:00
Alexander Orzechowski 933ff0e60c wlr_scene: Fix missing calls to scene_node_update_outputs
There were a couple places this was missing
 - on mode change of an output. If the resolution changes for example
   nodes may fall out of the view.
 - on commits on an output for scale or transform changes
 - when the transform of a buffer is changed. If the dest size is not
 set, the buffer may have been rotated potentially changing its size
 if the buffer width != height
2022-05-19 14:17:51 -04:00
Alexander Orzechowski c46b53d0b0 wlr_scene: Add output_enter/output_leave signals
When we destroy a scene buffer, let's make sure that we call
output_leave signals before we finish the node which will call destroy
listeners.
2022-05-19 14:17:51 -04:00
Alexander Orzechowski 61dab42c70 wlr_scene: Add setter for buffer of a wlr_scene_buffer 2022-05-19 14:17:51 -04:00
Alexander Orzechowski 039a31df9a wlr_scene: Allow buffer in wlr_scene_buffer to be NULL
This is useful to emulate an unmapped surface.
2022-05-19 14:16:52 -04:00
Simon Ser 8fe3aa29da xdg-shell: specify version in wlr_xdg_shell_create
With protocol additions such as [1], compositors currently have no
way to opt out of the version upgrade. The protocol upgrade will
always be backwards-compatible but may require new compositor
features.

The status quo doesn't make it possible to ship a protocol addition
without breaking the wlroots API. This will be an issue for API
stabilization [2].

To address this, let compositors provide a maximum version in the
function creating the global. We need to support all previous versions
of the interface anyways because of older clients.

This mechanism works the same way as Wayland clients passing a version
in wl_global.bind.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3514
[2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1008

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3397
2022-05-15 15:44:40 +00:00
Simon Ser e646d882cf backend/drm: fetch EDID manufacturer from udev_hwdb
Maintaining our internal table up-to-date is tedious: one needs to
manually go through the PnP ID registry [1] and check whether we're
missing any entry.

udev_hwdb already has an API to fetch a manufacturer name from its
PnP ID. Use that instead.

[1]: https://uefi.org/pnp_id_list
2022-05-11 14:06:11 +00:00
Simon Ser f575e445ec xwayland: terminate when no client is connected
Automatically shutdown Xwayland 10s after all X11 clients have
gone away.
2022-05-07 19:25:44 +00:00
Simon Ser 352064d76d xwayland: add wlr_xwayland_server_options.terminate_delay
This allows users to specify a delay after which the Xwayland process
terminates itself when there are no more X11 clients connected.
2022-05-07 19:25:44 +00:00
Manuel Stoeckl 7ad67e0f1d render/gles: add support for some 16-bpc unsigned shm formats
These formats require EXT_texture_norm16, which in turn needs OpenGL
ES 3.1. The EXT_texture_norm16 extension does not support passing
gl_internalformat = GL_RGBA to glTexImage2D, as can be done for
formats available in OpenGL ES 2.0, so this commit adds a field to
wlr_gles2_pixel_format to provide a more specific internalformat
parameter to glTexImage2D.
2022-05-07 16:25:38 +00:00
John Lindgren 640f3b9f21 Revert "Copy xcb_icccm structs into wlroots"
The original commit introduced a bug by transposing the order of
some of the fields in xcb_size_hints_t.  Since XCB ICCCM support is
required now, we can just eliminate the duplicate structs.

With minor changes:
- Remove #ifdef HAS_XCB_ICCCM guards
- Fix #includes
- Fix references to local size_hints struct

This reverts commit 12b9b1a4bd.
2022-04-17 14:44:52 +00:00
Kirill Primak dec2565f2b xdg-toplevel: don't schedule configures on state requests 2022-04-13 17:00:06 +00:00
Kirill Primak 04aa44b4df xdg-foreign-v2: treat unmapped parents as NULL 2022-04-13 16:48:15 +00:00
Kirill Primak dac040f87f xdg-foreign-v1: treat unmapped parents as NULL 2022-04-13 16:48:15 +00:00
Leonardo Hernández Hernández 4519117a68 seat: take wlr_keyboard in wlr_seat_set_keyboard()
Signed-off-by: Leonardo Hernández Hernández <leohdz172@protonmail.com>
2022-03-23 13:08:41 +00:00
Guido Günther 4cc2a03620 layer-shell: Make wlr_layer_surface_v1_from_resource public
This allows compositors to leverage the `wl_instance_of` based type
check.
2022-03-23 09:19:43 +00:00
Simon Zeni aaf787ee56 types/wlr_touch: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni e732c5c895 types/wlr_tablet_tool: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni d1f543a9d8 types/wlr_tablet_pad: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni 13d7fa2f03 types/wlr_switch: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni 9a17200446 types/wlr_keyboard: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni bd6c000d14 types/wlr_pointer: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni 96ccc50c57 types/wlr_input_device: move width_mm and height_mm fields to wlr_tablet and wlr_touch 2022-03-17 13:44:19 -04:00
Simon Zeni a92e5f8d46 types/wlr_input_device: move output_name field to wlr_pointer and wlr_touch 2022-03-17 13:44:18 -04:00
Simon Zeni 2001441a37 backend/wayland: remove wl_seat_listener from public API 2022-03-17 17:16:47 +00:00
Simon Zeni b7e9ad7989 backend/wayland: remove wlr_wl_input_device 2022-03-17 17:16:47 +00:00
Simon Zeni 56f7c000b5 backend/wayland/tablet_v2: give wlr_tablet_* ownership to wlr_wl_seat 2022-03-17 17:16:47 +00:00
Simon Zeni d3fb44314c backend/wayland: give wlr_touch ownership to wlr_wl_seat 2022-03-17 17:16:47 +00:00
Simon Zeni be8527bd36 backend/wayland: give wlr_pointer ownership to wlr_wl_seat
All the code logic related to the pointer has been moved to its own file.

The seat is responsible for the lifetime of its wlr_wl_pointer(s), and assigning
them to the relevant wlr_wl_output. The wlr_wl_pointer becomes a simple helper
to manager the wlr_pointer associated to the seat's wl_pointer and its lifetime.
2022-03-17 17:16:47 +00:00
Simon Zeni f9b6aa3079 backend/wayland: give wlr_keyboard ownership to wlr_wl_seat 2022-03-17 17:16:47 +00:00
Alexander Orzechowski 74381f3bc3 types/wlr_output: Handle subpixel hints through output commits 2022-03-16 18:41:49 +00:00