backend/drm: track layer FBs in wlr_drm_connector_state

This commit is contained in:
Simon Ser 2024-03-04 12:20:37 +01:00
parent 4939a81ab4
commit 6a2bf37bd9
3 changed files with 45 additions and 72 deletions

View file

@ -180,8 +180,8 @@ static uint64_t to_fp16(double v) {
}
static bool set_layer_props(struct wlr_drm_backend *drm,
const struct wlr_output_layer_state *state, uint64_t zpos,
struct wl_array *fb_damage_clips_arr) {
const struct wlr_output_layer_state *state, struct wlr_drm_fb *fb,
uint64_t zpos, struct wl_array *fb_damage_clips_arr) {
struct wlr_drm_layer *layer = get_drm_layer(drm, state->layer);
uint32_t width = 0, height = 0;
@ -190,7 +190,6 @@ static bool set_layer_props(struct wlr_drm_backend *drm,
height = state->buffer->height;
}
struct wlr_drm_fb *fb = layer->pending_fb;
int ret = 0;
if (state->buffer == NULL) {
ret = liftoff_layer_set_property(layer->liftoff, "FB_ID", 0);
@ -350,12 +349,10 @@ static bool add_connector(drmModeAtomicReq *req,
(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];
ok = ok && set_layer_props(drm, layer_state, i + 1,
fb_damage_clips_arr);
}
for (size_t i = 0; i < state->base->layers_len; i++) {
const struct wlr_output_layer_state *layer_state = &state->base->layers[i];
ok = ok && set_layer_props(drm, layer_state,
state->layer_fbs[i], i + 1, fb_damage_clips_arr);
}
if (crtc->cursor) {