aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-12-13 12:34:46 +0100
committerSimon Zeni <simon@bl4ckb0ne.ca>2022-12-13 19:12:12 +0000
commitea14e9c95f2242b0bfc614cb4622c08d0f1c0489 (patch)
tree36963ebb03198deb00f0b799dbee9dfae3bb1acf
parente59c3602f702275fe6ee9eb7519209ff9c46b6b6 (diff)
backend/drm: update wlr_drm_connnector.crtc in drm_connector_commit_state()
If the commit fails, then our local state becomes out-of-sync with the kernel's. Additionally, when disabling a connector without going through dealloc_crtc(), conn->crtc would still be set. Fix this by updating conn->crtc in drm_connector_commit_state().
-rw-r--r--backend/drm/drm.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index b37ac73c..e1d062b6 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -620,6 +620,13 @@ bool drm_connector_commit_state(struct wlr_drm_connector *conn,
goto out;
}
+ if (!pending.active) {
+ drm_plane_finish_surface(conn->crtc->primary);
+ drm_plane_finish_surface(conn->crtc->cursor);
+
+ conn->cursor_enabled = false;
+ conn->crtc = NULL;
+ }
if (pending.base->committed & WLR_OUTPUT_STATE_MODE) {
struct wlr_output_mode *mode = NULL;
switch (pending.base->mode_type) {
@@ -999,13 +1006,12 @@ static const int32_t subpixel_map[] = {
};
static void dealloc_crtc(struct wlr_drm_connector *conn) {
- struct wlr_drm_backend *drm = conn->backend;
if (conn->crtc == NULL) {
return;
}
- wlr_drm_conn_log(conn, WLR_DEBUG, "De-allocating CRTC %zu",
- conn->crtc - drm->crtcs);
+ wlr_drm_conn_log(conn, WLR_DEBUG, "De-allocating CRTC %" PRIu32,
+ conn->crtc->id);
struct wlr_output_state state = {
.committed = WLR_OUTPUT_STATE_ENABLED,
@@ -1017,12 +1023,6 @@ static void dealloc_crtc(struct wlr_drm_connector *conn) {
wlr_drm_conn_log(conn, WLR_ERROR, "Failed to disable CRTC %"PRIu32,
conn->crtc->id);
}
-
- drm_plane_finish_surface(conn->crtc->primary);
- drm_plane_finish_surface(conn->crtc->cursor);
-
- conn->cursor_enabled = false;
- conn->crtc = NULL;
}
static void realloc_crtcs(struct wlr_drm_backend *drm,