backend/drm: allow committing a buffer and a mode together

Set the plane's pending FB before calling drm_connector_set_mode.
This commit is contained in:
Simon Ser 2021-04-06 18:23:35 +02:00 committed by Kenny Levinsen
parent e89cf5f047
commit 63f891e393
1 changed files with 8 additions and 7 deletions

View File

@ -437,7 +437,7 @@ static bool drm_connector_test(struct wlr_output *output) {
return true; 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) { const struct wlr_output_state *state) {
struct wlr_drm_backend *drm = conn->backend; struct wlr_drm_backend *drm = conn->backend;
@ -464,10 +464,6 @@ static bool drm_connector_commit_buffer(struct wlr_drm_connector *conn,
break; break;
} }
if (!drm_crtc_page_flip(conn, state)) {
return false;
}
return true; return true;
} }
@ -509,6 +505,12 @@ bool drm_connector_commit_state(struct wlr_drm_connector *conn,
return false; 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 | WLR_OUTPUT_STATE_ENABLED)) {
if ((state.committed & WLR_OUTPUT_STATE_MODE) && if ((state.committed & WLR_OUTPUT_STATE_MODE) &&
state.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM) { state.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM) {
@ -526,8 +528,7 @@ bool drm_connector_commit_state(struct wlr_drm_connector *conn,
return false; return false;
} }
} else if (state.committed & WLR_OUTPUT_STATE_BUFFER) { } else if (state.committed & WLR_OUTPUT_STATE_BUFFER) {
// TODO: support modesetting with a buffer if (!drm_crtc_page_flip(conn, &state)) {
if (!drm_connector_commit_buffer(conn, &state)) {
return false; return false;
} }
} else if (state.committed & (WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED | } else if (state.committed & (WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED |