mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
backend/drm: add libliftoff composition layer
This will be useful for implementing the output layers API.
This commit is contained in:
parent
9d43e7e4d6
commit
2398621b8b
2 changed files with 17 additions and 9 deletions
|
@ -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");
|
||||
|
|
|
@ -40,6 +40,7 @@ struct wlr_drm_crtc {
|
|||
uint32_t id;
|
||||
struct wlr_drm_lease *lease;
|
||||
struct liftoff_output *liftoff;
|
||||
struct liftoff_layer *liftoff_composition_layer;
|
||||
|
||||
// Atomic modesetting only
|
||||
uint32_t mode_id;
|
||||
|
|
Loading…
Reference in a new issue