diff options
author | Simon Ser <contact@emersion.fr> | 2021-07-08 15:56:01 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-07-09 15:31:19 -0400 |
commit | 017555651b01a2e4fbdda9d59b29c847094d57b7 (patch) | |
tree | bf823ca3013b373ad87f7f41608a474ada174e2e /backend/drm/atomic.c | |
parent | a362d21d6b2191ce0101657629ae01841189cae5 (diff) |
backend/drm: add test_only arg to wlr_drm_interface.crtc_commit
Right now callers of drm_crtc_commit need to check whether the
interface is legacy or atomic before passing the TEST_ONLY flag.
Additionally, the fallbacks for legacy are in-place in the common
code.
Add a test_only arg to the crtc_commit hook. This way, there's no
risk to pass atomic-only flags to the legacy function (add an assert
to ensure this) and all of the legacy-specific logic can be put back
into legacy.c (done in next commit).
Diffstat (limited to 'backend/drm/atomic.c')
-rw-r--r-- | backend/drm/atomic.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index c7b630d6..23f9d60f 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -168,7 +168,7 @@ error: static bool atomic_crtc_commit(struct wlr_drm_backend *drm, struct wlr_drm_connector *conn, const struct wlr_output_state *state, - uint32_t flags) { + uint32_t flags, bool test_only) { struct wlr_output *output = &conn->output; struct wlr_drm_crtc *crtc = conn->crtc; @@ -209,9 +209,12 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm, vrr_enabled = state->adaptive_sync_enabled; } + if (test_only) { + flags |= DRM_MODE_ATOMIC_TEST_ONLY; + } if (modeset) { flags |= DRM_MODE_ATOMIC_ALLOW_MODESET; - } else if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { + } else if (!test_only) { flags |= DRM_MODE_ATOMIC_NONBLOCK; } @@ -250,7 +253,7 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm, bool ok = atomic_commit(&atom, conn, flags); atomic_finish(&atom); - if (ok && !(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { + if (ok && !test_only) { commit_blob(drm, &crtc->mode_id, mode_id); commit_blob(drm, &crtc->gamma_lut, gamma_lut); |