diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2024-02-25 04:11:00 -0500 |
---|---|---|
committer | Alexander Orzechowski <alex@ozal.ski> | 2024-02-25 04:11:00 -0500 |
commit | 672ff1e14ee63ecb2018c9bafbac6060663e3c22 (patch) | |
tree | 3c5c7796407a755bd0163c711c01d6ae57fec276 /backend | |
parent | 54e1fefd2e29cb00dff7c02801913d793ceab7d6 (diff) |
backend/drm: Init connector after we try to allocate a crtc for it
drm_connect_state_init() will set primary_fd to null if no CRTC is active
for the connector and can crash later if the code expects a CRTC (like
when lighting up an output).
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/drm.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 41a38f6d..b6c43fc9 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -672,26 +672,26 @@ static bool drm_connector_test(struct wlr_output *output, } } - bool ok = false; - struct wlr_drm_connector_state pending = {0}; - drm_connector_state_init(&pending, conn, state); - - if (pending.active) { + if ((state->committed & WLR_OUTPUT_STATE_ENABLED) ? state->enabled : output->enabled) { if ((state->committed & (WLR_OUTPUT_STATE_ENABLED | WLR_OUTPUT_STATE_MODE)) && !(state->committed & WLR_OUTPUT_STATE_BUFFER)) { wlr_drm_conn_log(conn, WLR_DEBUG, "Can't enable an output without a buffer"); - goto out; + return false; } if (!drm_connector_alloc_crtc(conn)) { wlr_drm_conn_log(conn, WLR_DEBUG, "No CRTC available for this connector"); - goto out; + return false; } } + bool ok = false; + struct wlr_drm_connector_state pending = {0}; + drm_connector_state_init(&pending, conn, state); + if ((state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) && state->adaptive_sync_enabled && !drm_connector_supports_vrr(conn)) { |