backend/drm: store pending FB in state

Instead of having a pending_fb field on the struct wlr_drm_plane,
move it to struct wlr_drm_connector_state. That way, there's no
risk having a stale pending FB around: the state doesn't survive
across tests and commits.

The cursor is a special case because it's disconnected from the
atomic state: the wlr_backend_impl.set_cursor hook sets the cursor
for the next commit. Move the field to
wlr_drm_connector.cursor_pending_fb.
This commit is contained in:
Simon Ser 2022-12-06 17:39:23 +01:00
parent ae61cd6bfb
commit 037b21647b
6 changed files with 70 additions and 51 deletions

View file

@ -38,7 +38,7 @@ static bool legacy_crtc_test(struct wlr_drm_connector *conn,
struct wlr_drm_crtc *crtc = conn->crtc;
if ((state->base->committed & WLR_OUTPUT_STATE_BUFFER) && !state->modeset) {
struct wlr_drm_fb *pending_fb = crtc->primary->pending_fb;
struct wlr_drm_fb *pending_fb = state->primary_fb;
struct wlr_drm_fb *prev_fb = crtc->primary->queued_fb;
if (!prev_fb) {
@ -74,13 +74,12 @@ static bool legacy_crtc_commit(struct wlr_drm_connector *conn,
uint32_t fb_id = 0;
if (state->active) {
struct wlr_drm_fb *fb = plane_get_next_fb(crtc->primary);
if (fb == NULL) {
if (state->primary_fb == NULL) {
wlr_log(WLR_ERROR, "%s: failed to acquire primary FB",
conn->output.name);
return false;
}
fb_id = fb->id;
fb_id = state->primary_fb->id;
}
if (state->modeset) {