From 0bedf72d3ecdf6ec17b5b5f01d458f1f75676c18 Mon Sep 17 00:00:00 2001 From: Thomas Glanzmann Date: Fri, 18 Sep 2026 14:37:19 +0200 Subject: [PATCH] Fix output enable when the DRM CRTC has no gamma LUT wlr_scene re-requests a gamma LUT apply whenever an output is enabled, even when no client has set a LUT. This queues a no-op color transform reset. On CRTCs which expose neither a GAMMA_LUT property nor a legacy gamma size (e.g. apple-dcp), backend/drm's legacy gamma fallback then fails and aborts the whole atomic commit, so the output never turns back on. In practice `output * power off` followed by `power on` leaves the display off on Apple Silicon, while it works on drivers which expose GAMMA_LUT. Only re-apply the gamma LUT when a client actually has one set, and treat a gamma reset on a CRTC without any gamma support as a successful no-op instead of failing the commit. --- backend/drm/legacy.c | 4 +++- types/scene/wlr_scene.c | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c index 714addb5..0da6399a 100644 --- a/backend/drm/legacy.c +++ b/backend/drm/legacy.c @@ -255,7 +255,9 @@ bool drm_legacy_crtc_set_gamma(struct wlr_drm_backend *drm, // The legacy interface doesn't offer a way to reset the gamma LUT size = drm_crtc_get_gamma_lut_size(drm, crtc); if (size == 0) { - return false; + // The CRTC doesn't support gamma at all, so there is nothing to + // reset. + return true; } linear_lut = malloc(3 * size * sizeof(uint16_t)); diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 542f21e6..7d59e5e4 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1702,10 +1702,12 @@ static void scene_output_handle_commit(struct wl_listener *listener, void *data) wlr_output_schedule_frame(scene_output->output); } - // Next time the output is enabled, try to re-apply the gamma LUT + // Next time the output is enabled, try to re-apply the gamma LUT. There is + // nothing to re-apply if no client has set one. if (scene_output->scene->gamma_control_manager_v1 && (state->committed & WLR_OUTPUT_STATE_ENABLED) && - !scene_output->output->enabled) { + !scene_output->output->enabled && + scene_output->gamma_lut != NULL) { scene_output->gamma_lut_changed = true; } } -- 2.55.0