-
Notifications
You must be signed in to change notification settings - Fork 341
[WIP] linux-explicit-synchronization-v1: new protocol implementation #2070
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be hooked up with EGL or otherwise paying attention to the fence status in order to be a correct implementation.
#894
Yeah, see the updated PR description. |
972cadf
to
aa22e40
Compare
This PR has been updated and is now functional. I'd like to hear some feedback before tackling the last remaining TODOs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks fine to me. About what I expect from this type of implementation.
I would prefer to go with the "better" way of implementing this, but that's probably not going to happen in the near future.
backend/drm/atomic.c
Outdated
@@ -129,6 +133,12 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm, | |||
} | |||
atomic_add(&atom, crtc->id, crtc->props.mode_id, crtc->mode_id); | |||
atomic_add(&atom, crtc->id, crtc->props.active, 1); | |||
if (crtc->props.out_fence_ptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this property is guranteed for atomic drivers.
a19f603
to
4c90509
Compare
The goal of this PR is to implement the "easy" way first. Then we can build on top of it to implement the "better" way. Doing all in one go would result in a massive PR. |
This commit adds support for IN_FENCE_FD and OUT_FENCE_PTR.
This patch adds support for the linux-explicit-synchronization-unstable-v1 protocol. To test, run weston-simple-dmabuf-egl.
A possible issue with the approach taken in this PR is that we bolt the sync fences onto the |
Apparently |
wlroots has migrated to gitlab.freedesktop.org. This pull request has been moved to: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2070 |
This patch adds support for the linux-explicit-synchronization-unstable-v1 protocol.
No support has been added for sync fences yet. The protocol is already useful as-is because it offers per-commit release events (wl_buffer.release is global state).We still need to actually use the fences provided by clients before exposing the protocol. We also need to send our fences to clients if we use the GL renderer, otherwise clients might start re-using buffers before our rendering is complete.More information about explicit sync: https://lwn.net/Articles/814587/
To test, run
weston-simple-dmabuf-egl -m
.Sway PR: swaywm/sway#5113
Since
wlr_client_buffer
are created atwl_surface.commit
time, there's no need for any additional per-commitwlr_surface
state. We'll need that once we try waiting for client buffer fences before starting rendering.Here's the new sync fence API:
zwp_linux_surface_synchronization_v1.set_acquire_fence
callswlr_buffer_set_in_fence
wlr_buffer.in_fence_fd
. After rendering, it creates anEGLSyncKHR
and exposes it viawlr_renderer_get_out_fence
.wlr_buffer_add_out_fence
is called with this FD.IN_FENCE_FD
property to the FD provided viawlr_renderer_get_out_fence
(if rendering) or viawlr_buffer.in_fence_fd
(if direct scan-out). After commit, it exposes the FD retrieved fromOUT_FENCE_PTR
viawlr_output_get_out_fence
. If direct scan-out is used,wlr_buffer_add_out_fence
is called with this FD.zwp_linux_buffer_release.fenced_release
withwlr_buffer.out_fence_fd
.TODO:
Follow-up issues: