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).
This commit is contained in:
Simon Ser 2021-07-08 15:56:01 +02:00 committed by Simon Zeni
parent a362d21d6b
commit 017555651b
4 changed files with 24 additions and 14 deletions

View file

@ -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);