Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

output: take a wlr_buffer in set_cursor #2507

Merged
merged 7 commits into from
Jun 2, 2021

Conversation

emersion
Copy link
Member

@emersion emersion commented Dec 2, 2020

We want to remove the rendering bits from the backends. To do so, we need to stop feeding them wlr_texture for cursors.

Switch to wlr_buffer. The common wlr_output code is responsible for allocating and rendering cursor textures.

This will also help with explicit synchronization.

TODO:

  • Fix disappearing cursor when near to output edge on DRM
  • Fix output scaling and transform
  • Multi-GPU

Depends on #2498
Depends on #2556
Depends on #2613
Depends on #2901
Depends on #2947


Breaking change for backends: wlr_output_impl.set_cursor now takes a wlr_buffer. Backends should no longer allocate a swapchain for the cursor. Backends can optionally specify cursor buffer format and size restrictions with get_cursor_formats and get_cursor_size.

@emersion emersion force-pushed the cursor-swapchain branch 5 times, most recently from 72088e9 to 2adb373 Compare December 4, 2020 16:20
@emersion emersion force-pushed the cursor-swapchain branch 3 times, most recently from 085aefa to b6c8d9b Compare December 7, 2020 13:44
@emersion emersion mentioned this pull request Dec 8, 2020
@emersion emersion force-pushed the cursor-swapchain branch 9 times, most recently from fe4edd6 to 90e1aa7 Compare December 18, 2020 17:13
@emersion
Copy link
Member Author

This is now working fine on multi-GPU setups.

@emersion emersion force-pushed the cursor-swapchain branch 3 times, most recently from c126d03 to 1508f60 Compare December 22, 2020 15:04
@emersion emersion marked this pull request as ready for review December 24, 2020 11:40
@emersion emersion force-pushed the cursor-swapchain branch 2 times, most recently from 8349edd to 352e7c1 Compare December 25, 2020 11:57
@emersion emersion force-pushed the cursor-swapchain branch 3 times, most recently from 7662d25 to 1d561c9 Compare January 7, 2021 18:11
@emersion emersion added this to the 0.14.0 milestone Mar 15, 2021
@emersion emersion force-pushed the cursor-swapchain branch 2 times, most recently from 45d2c6c to 661ed4a Compare March 27, 2021 12:41
@emersion emersion force-pushed the cursor-swapchain branch 3 times, most recently from 3951e96 to 10132c1 Compare April 7, 2021 08:18
@emersion emersion force-pushed the cursor-swapchain branch 2 times, most recently from 77dc8e9 to 352b062 Compare April 28, 2021 17:58
@emersion emersion marked this pull request as draft April 29, 2021 12:38
@emersion emersion force-pushed the cursor-swapchain branch from 29c56f7 to 93e21b0 Compare May 22, 2021 08:54
@emersion emersion marked this pull request as ready for review May 22, 2021 08:54
@emersion emersion force-pushed the cursor-swapchain branch 3 times, most recently from eef1157 to e87f3d8 Compare May 31, 2021 19:40
@emersion emersion added the breaking Breaking change in public API label May 31, 2021
@emersion
Copy link
Member Author

This PR has now been updated to work with the Pixman renderer.

emersion added 7 commits May 31, 2021 21:50
This is a new helper function to pick a render format suitable for
a plane.

The next commit will use it to initialize the cursor multi-GPU
surface.
Instead of passing a wlr_texture to the backend, directly pass a
wlr_buffer. Use get_cursor_size and get_cursor_formats to create
a wlr_buffer that can be used as a cursor.

We don't want to pass a wlr_texture because we want to remove as
many rendering bits from the backend as possible.
Doesn't make a lot of sense to split the cursor fields between
wlr_drm_plane and wlr_drm_connector. Let's just move everything to
wlr_drm_connector.
@emersion emersion force-pushed the cursor-swapchain branch from e87f3d8 to c48a1c7 Compare May 31, 2021 19:50
Copy link
Member

@kennylevinsen kennylevinsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -329,7 +331,7 @@ static bool drm_connector_attach_render(struct wlr_output *output,
static void drm_plane_set_committed(struct wlr_drm_plane *plane) {
drm_fb_move(&plane->queued_fb, &plane->pending_fb);

if (plane->queued_fb) {
if (plane->queued_fb && plane->surf.swapchain) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random bugfix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously all planes had a swapchain. Now that the cursor plane swapchain has been moved in common code in wlr_output.c, the cursor plane no longer has a swapchain.

@emersion emersion merged commit b86a0c8 into swaywm:master Jun 2, 2021
@emersion emersion deleted the cursor-swapchain branch June 2, 2021 09:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking Breaking change in public API
Development

Successfully merging this pull request may close these issues.

2 participants