backend/drm: atomically reset state after VT switch

Allows the KMS driver to parallelize the modesets, so should be
faster than going through each CRTC one by one.
This commit is contained in:
Simon Ser 2024-02-14 18:54:01 +01:00
parent 836cb820d0
commit 505175e56f
5 changed files with 61 additions and 14 deletions

View file

@ -227,6 +227,20 @@ bool drm_legacy_crtc_set_gamma(struct wlr_drm_backend *drm,
return true;
}
static bool legacy_reset(struct wlr_drm_backend *drm) {
bool ok = true;
for (size_t i = 0; i < drm->num_crtcs; i++) {
struct wlr_drm_crtc *crtc = &drm->crtcs[i];
if (drmModeSetCrtc(drm->fd, crtc->id, 0, 0, 0, NULL, 0, NULL) != 0) {
wlr_log_errno(WLR_ERROR, "Failed to disable CRTC %"PRIu32,
crtc->id);
ok = false;
}
}
return ok;
}
const struct wlr_drm_interface legacy_iface = {
.crtc_commit = legacy_crtc_commit,
.reset = legacy_reset,
};