diff options
author | Simon Ser <contact@emersion.fr> | 2021-04-06 16:32:01 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2021-04-29 19:51:57 +0200 |
commit | 8f90d7f8f51f5d501e3f70ebdab8abfdbfa007b9 (patch) | |
tree | 709b3b1918ab20bddbb62f051b15047f72f790c1 /backend/drm | |
parent | 69d4cf19b54e81111ef68ff46cfe2e23ff122a80 (diff) |
backend/drm: take wlr_output_state as arg in crtc_commit
Stop assuming that the state to be applied is in output->pending in
crtc_commit. This will allow us to remove ephemeral fields in
wlr_drm_crtc, which are used scratch fields to stash temporary
per-commit data.
Diffstat (limited to 'backend/drm')
-rw-r--r-- | backend/drm/atomic.c | 17 | ||||
-rw-r--r-- | backend/drm/drm.c | 2 | ||||
-rw-r--r-- | backend/drm/legacy.c | 15 |
3 files changed, 18 insertions, 16 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index 4cfd5566..4a33d358 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -164,7 +164,8 @@ error: } static bool atomic_crtc_commit(struct wlr_drm_backend *drm, - struct wlr_drm_connector *conn, uint32_t flags) { + struct wlr_drm_connector *conn, const struct wlr_output_state *state, + uint32_t flags) { struct wlr_output *output = &conn->output; struct wlr_drm_crtc *crtc = conn->crtc; @@ -176,19 +177,19 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm, } uint32_t gamma_lut = crtc->gamma_lut; - if (output->pending.committed & WLR_OUTPUT_STATE_GAMMA_LUT) { + if (state->committed & WLR_OUTPUT_STATE_GAMMA_LUT) { // Fallback to legacy gamma interface when gamma properties are not // available (can happen on older Intel GPUs that support gamma but not // degamma). if (crtc->props.gamma_lut == 0) { if (!drm_legacy_crtc_set_gamma(drm, crtc, - output->pending.gamma_lut_size, - output->pending.gamma_lut)) { + state->gamma_lut_size, + state->gamma_lut)) { return false; } } else { - if (!create_gamma_lut_blob(drm, output->pending.gamma_lut_size, - output->pending.gamma_lut, &gamma_lut)) { + if (!create_gamma_lut_blob(drm, state->gamma_lut_size, + state->gamma_lut, &gamma_lut)) { return false; } } @@ -197,9 +198,9 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm, bool prev_vrr_enabled = output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED; bool vrr_enabled = prev_vrr_enabled; - if ((output->pending.committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) && + if ((state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) && drm_connector_supports_vrr(conn)) { - vrr_enabled = output->pending.adaptive_sync_enabled; + vrr_enabled = state->adaptive_sync_enabled; } if (crtc->pending_modeset) { diff --git a/backend/drm/drm.c b/backend/drm/drm.c index e2b4bb3e..df31752d 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -330,7 +330,7 @@ static void drm_plane_set_committed(struct wlr_drm_plane *plane) { static bool drm_crtc_commit(struct wlr_drm_connector *conn, uint32_t flags) { struct wlr_drm_backend *drm = conn->backend; struct wlr_drm_crtc *crtc = conn->crtc; - bool ok = drm->iface->crtc_commit(drm, conn, flags); + bool ok = drm->iface->crtc_commit(drm, conn, &conn->output.pending, flags); if (ok && !(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { memcpy(&crtc->current, &crtc->pending, sizeof(struct wlr_drm_crtc_state)); drm_plane_set_committed(crtc->primary); diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c index da2e0d9f..61b92558 100644 --- a/backend/drm/legacy.c +++ b/backend/drm/legacy.c @@ -9,7 +9,8 @@ #include "backend/drm/util.h" static bool legacy_crtc_commit(struct wlr_drm_backend *drm, - struct wlr_drm_connector *conn, uint32_t flags) { + struct wlr_drm_connector *conn, const struct wlr_output_state *state, + uint32_t flags) { struct wlr_output *output = &conn->output; struct wlr_drm_crtc *crtc = conn->crtc; struct wlr_drm_plane *cursor = crtc->cursor; @@ -51,27 +52,27 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm, } } - if (output->pending.committed & WLR_OUTPUT_STATE_GAMMA_LUT) { + if (state->committed & WLR_OUTPUT_STATE_GAMMA_LUT) { if (!drm_legacy_crtc_set_gamma(drm, crtc, - output->pending.gamma_lut_size, output->pending.gamma_lut)) { + state->gamma_lut_size, state->gamma_lut)) { return false; } } - if ((output->pending.committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) && + if ((state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) && drm_connector_supports_vrr(conn)) { if (drmModeObjectSetProperty(drm->fd, crtc->id, DRM_MODE_OBJECT_CRTC, crtc->props.vrr_enabled, - output->pending.adaptive_sync_enabled) != 0) { + state->adaptive_sync_enabled) != 0) { wlr_drm_conn_log_errno(conn, WLR_ERROR, "drmModeObjectSetProperty(VRR_ENABLED) failed"); return false; } - output->adaptive_sync_status = output->pending.adaptive_sync_enabled ? + output->adaptive_sync_status = state->adaptive_sync_enabled ? WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED : WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED; wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s", - output->pending.adaptive_sync_enabled ? "enabled" : "disabled"); + state->adaptive_sync_enabled ? "enabled" : "disabled"); } if (cursor != NULL && drm_connector_is_cursor_visible(conn)) { |