From 63f891e393ca5256ad5b6847291d88c098321ed6 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 6 Apr 2021 18:23:35 +0200 Subject: [PATCH] backend/drm: allow committing a buffer and a mode together Set the plane's pending FB before calling drm_connector_set_mode. --- backend/drm/drm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 466736b4..578944d2 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -437,7 +437,7 @@ static bool drm_connector_test(struct wlr_output *output) { return true; } -static bool drm_connector_commit_buffer(struct wlr_drm_connector *conn, +static bool drm_connector_set_pending_fb(struct wlr_drm_connector *conn, const struct wlr_output_state *state) { struct wlr_drm_backend *drm = conn->backend; @@ -464,10 +464,6 @@ static bool drm_connector_commit_buffer(struct wlr_drm_connector *conn, break; } - if (!drm_crtc_page_flip(conn, state)) { - return false; - } - return true; } @@ -509,6 +505,12 @@ bool drm_connector_commit_state(struct wlr_drm_connector *conn, return false; } + if (state.committed & WLR_OUTPUT_STATE_BUFFER) { + if (!drm_connector_set_pending_fb(conn, &state)) { + return false; + } + } + if (state.committed & (WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_ENABLED)) { if ((state.committed & WLR_OUTPUT_STATE_MODE) && state.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM) { @@ -526,8 +528,7 @@ bool drm_connector_commit_state(struct wlr_drm_connector *conn, return false; } } else if (state.committed & WLR_OUTPUT_STATE_BUFFER) { - // TODO: support modesetting with a buffer - if (!drm_connector_commit_buffer(conn, &state)) { + if (!drm_crtc_page_flip(conn, &state)) { return false; } } else if (state.committed & (WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED |