aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/drm/atomic.c8
-rw-r--r--backend/drm/drm.c12
-rw-r--r--backend/drm/legacy.c2
-rw-r--r--include/backend/drm/drm.h3
4 files changed, 14 insertions, 11 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c
index 4a33d358..ac586bb5 100644
--- a/backend/drm/atomic.c
+++ b/backend/drm/atomic.c
@@ -169,8 +169,10 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm,
struct wlr_output *output = &conn->output;
struct wlr_drm_crtc *crtc = conn->crtc;
+ bool modeset = drm_connector_state_is_modeset(state);
+
uint32_t mode_id = crtc->mode_id;
- if (crtc->pending_modeset) {
+ if (modeset) {
if (!create_mode_blob(drm, crtc, &mode_id)) {
return false;
}
@@ -203,7 +205,7 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm,
vrr_enabled = state->adaptive_sync_enabled;
}
- if (crtc->pending_modeset) {
+ if (modeset) {
flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
} else if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) {
flags |= DRM_MODE_ATOMIC_NONBLOCK;
@@ -213,7 +215,7 @@ static bool atomic_crtc_commit(struct wlr_drm_backend *drm,
atomic_begin(&atom);
atomic_add(&atom, conn->id, conn->props.crtc_id,
crtc->pending.active ? crtc->id : 0);
- if (crtc->pending_modeset && crtc->pending.active &&
+ if (modeset && crtc->pending.active &&
conn->props.link_status != 0) {
atomic_add(&atom, conn->id, conn->props.link_status,
DRM_MODE_LINK_STATUS_GOOD);
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index e2a78de8..08a55857 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -345,7 +345,6 @@ static bool drm_crtc_commit(struct wlr_drm_connector *conn,
drm_fb_clear(&crtc->cursor->pending_fb);
}
}
- crtc->pending_modeset = false;
return ok;
}
@@ -358,7 +357,7 @@ static bool drm_crtc_page_flip(struct wlr_drm_connector *conn,
// page-flip, either a blocking modeset. When performing a blocking modeset
// we'll wait for all queued page-flips to complete, so we don't need this
// safeguard.
- if (conn->pending_page_flip_crtc && !crtc->pending_modeset) {
+ if (conn->pending_page_flip_crtc && !drm_connector_state_is_modeset(state)) {
wlr_drm_conn_log(conn, WLR_ERROR, "Failed to page-flip output: "
"a page-flip is already pending");
return false;
@@ -681,7 +680,6 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn,
}
struct wlr_drm_plane *plane = crtc->primary;
- crtc->pending_modeset = true;
crtc->pending.active = true;
crtc->pending.mode = mode;
@@ -705,7 +703,6 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn,
"retrying without modifiers");
modifiers = false;
- crtc->pending_modeset = true;
crtc->pending.active = true;
crtc->pending.mode = mode;
@@ -755,7 +752,6 @@ bool drm_connector_set_mode(struct wlr_drm_connector *conn,
if (wlr_mode == NULL) {
if (conn->crtc != NULL) {
- conn->crtc->pending_modeset = true;
conn->crtc->pending.active = false;
if (!drm_crtc_commit(conn, state, 0)) {
return false;
@@ -1041,6 +1037,11 @@ uint32_t wlr_drm_connector_get_id(struct wlr_output *output) {
return conn->id;
}
+bool drm_connector_state_is_modeset(const struct wlr_output_state *state) {
+ return state->committed &
+ (WLR_OUTPUT_STATE_ENABLED | WLR_OUTPUT_STATE_MODE);
+}
+
static const int32_t subpixel_map[] = {
[DRM_MODE_SUBPIXEL_UNKNOWN] = WL_OUTPUT_SUBPIXEL_UNKNOWN,
[DRM_MODE_SUBPIXEL_HORIZONTAL_RGB] = WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB,
@@ -1059,7 +1060,6 @@ static void dealloc_crtc(struct wlr_drm_connector *conn) {
wlr_drm_conn_log(conn, WLR_DEBUG, "De-allocating CRTC %zu",
conn->crtc - drm->crtcs);
- conn->crtc->pending_modeset = true;
conn->crtc->pending.active = false;
struct wlr_output_state state = {
.committed = WLR_OUTPUT_STATE_ENABLED,
diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c
index 61b92558..2f573899 100644
--- a/backend/drm/legacy.c
+++ b/backend/drm/legacy.c
@@ -26,7 +26,7 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
fb_id = fb->id;
}
- if (crtc->pending_modeset) {
+ if (drm_connector_state_is_modeset(state)) {
uint32_t *conns = NULL;
size_t conns_len = 0;
drmModeModeInfo *mode = NULL;
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index bc33e5c1..b6446653 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -49,7 +49,6 @@ struct wlr_drm_crtc_state {
struct wlr_drm_crtc {
uint32_t id;
- bool pending_modeset;
struct wlr_drm_crtc_state pending, current;
// Atomic modesetting only
@@ -160,6 +159,8 @@ size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm,
struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane);
+bool drm_connector_state_is_modeset(const struct wlr_output_state *state);
+
#define wlr_drm_conn_log(conn, verb, fmt, ...) \
wlr_log(verb, "connector %s: " fmt, conn->name, ##__VA_ARGS__)
#define wlr_drm_conn_log_errno(conn, verb, fmt, ...) \