From 0d6284eb62703ae2fdfb8d816455a0d3505f9d66 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 6 Aug 2024 19:55:37 +0200 Subject: [PATCH] backend/drm: add explicit sync support to libliftoff interface --- backend/drm/drm.c | 3 +-- backend/drm/libliftoff.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index c81517a4..1a1af309 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1646,8 +1646,7 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn, output->non_desktop = non_desktop; } - // TODO: support sync timelines with libliftoff - output->timeline = drm->iface == &atomic_iface; + output->timeline = drm->iface != &legacy_iface; if (drm->parent) { output->timeline = output->timeline && drm->mgpu_renderer.wlr_rend->features.timeline; } diff --git a/backend/drm/libliftoff.c b/backend/drm/libliftoff.c index 85054476..a87a4826 100644 --- a/backend/drm/libliftoff.c +++ b/backend/drm/libliftoff.c @@ -339,6 +339,17 @@ static bool add_connector(drmModeAtomicReq *req, liftoff_layer_set_property(crtc->liftoff_composition_layer, "FB_DAMAGE_CLIPS", state->fb_damage_clips); + if (state->primary_in_fence_fd >= 0) { + liftoff_layer_set_property(crtc->primary->liftoff_layer, + "IN_FENCE_FD", state->primary_in_fence_fd); + liftoff_layer_set_property(crtc->liftoff_composition_layer, + "IN_FENCE_FD", state->primary_in_fence_fd); + } + if (state->base->committed & WLR_OUTPUT_STATE_SIGNAL_TIMELINE) { + ok = ok && add_prop(req, crtc->id, crtc->props.out_fence_ptr, + (uintptr_t)&state->out_fence_fd); + } + if (state->base->committed & WLR_OUTPUT_STATE_LAYERS) { for (size_t i = 0; i < state->base->layers_len; i++) { const struct wlr_output_layer_state *layer_state = &state->base->layers[i];