diff options
author | Simon Ser <contact@emersion.fr> | 2022-08-18 19:27:42 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-02-20 18:38:57 +0100 |
commit | 2398621b8bd33f0e21590f88c363fd4ed7905e0f (patch) | |
tree | 8c5a6461011c79557a0d974dab821208efafd6be /backend/drm | |
parent | 9d43e7e4d67d4076c8b20ee2715eadec86a83e73 (diff) |
backend/drm: add libliftoff composition layer
This will be useful for implementing the output layers API.
Diffstat (limited to 'backend/drm')
-rw-r--r-- | backend/drm/libliftoff.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/backend/drm/libliftoff.c b/backend/drm/libliftoff.c index c6322c73..2b8cb124 100644 --- a/backend/drm/libliftoff.c +++ b/backend/drm/libliftoff.c @@ -45,6 +45,14 @@ static bool init(struct wlr_drm_backend *drm) { return false; } + crtc->liftoff_composition_layer = liftoff_layer_create(crtc->liftoff); + if (!crtc->liftoff_composition_layer) { + wlr_log(WLR_ERROR, "Failed to create liftoff composition layer"); + return false; + } + liftoff_output_set_composition_layer(crtc->liftoff, + crtc->liftoff_composition_layer); + if (crtc->primary) { crtc->primary->liftoff_layer = liftoff_layer_create(crtc->liftoff); if (!crtc->primary->liftoff_layer) { @@ -96,6 +104,7 @@ static void finish(struct wlr_drm_backend *drm) { liftoff_layer_destroy(crtc->cursor->liftoff_layer); } + liftoff_layer_destroy(crtc->liftoff_composition_layer); liftoff_output_destroy(crtc->liftoff); } @@ -133,7 +142,7 @@ static void rollback_blob(struct wlr_drm_backend *drm, } static bool set_plane_props(struct wlr_drm_plane *plane, - int32_t x, int32_t y, uint64_t zpos) { + struct liftoff_layer *layer, int32_t x, int32_t y, uint64_t zpos) { struct wlr_drm_fb *fb = plane_get_next_fb(plane); if (fb == NULL) { wlr_log(WLR_ERROR, "Failed to acquire FB"); @@ -144,7 +153,6 @@ static bool set_plane_props(struct wlr_drm_plane *plane, uint32_t height = fb->wlr_buf->height; // The SRC_* properties are in 16.16 fixed point - struct liftoff_layer *layer = plane->liftoff_layer; return liftoff_layer_set_property(layer, "zpos", zpos) == 0 && liftoff_layer_set_property(layer, "SRC_X", 0) == 0 && liftoff_layer_set_property(layer, "SRC_Y", 0) == 0 && @@ -263,12 +271,16 @@ static bool crtc_commit(struct wlr_drm_connector *conn, if (crtc->props.vrr_enabled != 0) { ok = ok && add_prop(req, crtc->id, crtc->props.vrr_enabled, vrr_enabled); } - ok = ok && set_plane_props(crtc->primary, 0, 0, 0); + ok = ok && + set_plane_props(crtc->primary, crtc->primary->liftoff_layer, 0, 0, 0) && + set_plane_props(crtc->primary, crtc->liftoff_composition_layer, 0, 0, 0); liftoff_layer_set_property(crtc->primary->liftoff_layer, "FB_DAMAGE_CLIPS", fb_damage_clips); + liftoff_layer_set_property(crtc->liftoff_composition_layer, + "FB_DAMAGE_CLIPS", fb_damage_clips); if (crtc->cursor) { if (drm_connector_is_cursor_visible(conn)) { - ok = ok && set_plane_props(crtc->cursor, + ok = ok && set_plane_props(crtc->cursor, crtc->cursor->liftoff_layer, conn->cursor_x, conn->cursor_y, 1); } else { ok = ok && disable_plane(crtc->cursor); @@ -293,11 +305,6 @@ static bool crtc_commit(struct wlr_drm_connector *conn, goto out; } - if (liftoff_layer_needs_composition(crtc->primary->liftoff_layer)) { - wlr_drm_conn_log(conn, WLR_DEBUG, "Failed to scan-out primary plane"); - ok = false; - goto out; - } if (crtc->cursor && liftoff_layer_needs_composition(crtc->cursor->liftoff_layer)) { wlr_drm_conn_log(conn, WLR_DEBUG, "Failed to scan-out cursor plane"); |