Skip to content

CTM fallback for color temperature on Apple Silicon (Asahi Linux) #831

@nicksaprigkin

Description

@nicksaprigkin

On Apple Silicon running Asahi Linux, the apple-dcp DRM driver does not expose GAMMA_LUT or GAMMA_LUT_SIZE CRTC properties. Because of this, tools like wlsunset and gammastep silently fail — zwlr_gamma_control_v1 reports success but display color never changes.

The Apple DCP CRTC only exposes:
VRR_ENABLED
CTM (Color Transformation Matrix) — flags=0x10 (blob)

Why zwlr_gamma_control_v1 can't solve this

As discussed in wlroots/wlroots#1078, the gamma-control-v1 protocol uses 3×1D LUTs which cannot be mapped to a 3×3 CTM matrix. So this is not a bug in mwc — it's a fundamental protocol mismatch.

How KWin and Hyprland solved it:

KWin uses CTM directly for its Night Color feature and it works on Apple Silicon:
https://invent.kde.org/plasma/kwin/-/commit/114032d2

Hyprland implemented a custom protocol hyprland-ctm-control-v1 specifically for this:
hyprwm/Hyprland#8023

Proposed solution:

Add a native CTM-based color temperature control to mwc — either as a built-in setting or a custom wayland protocol similar to Hyprland's approach. The math is straightforward:
// ~4500K warm night approximation
r_scale = 1.0
g_scale = 0.83
b_scale = 0.67

// encoded as S31.32 fixed-point in drm_color_ctm blob
matrix[0] = (uint64_t)(r_scale * (1ULL << 32));
matrix[4] = (uint64_t)(g_scale * (1ULL << 32));
matrix[8] = (uint64_t)(b_scale * (1ULL << 32));
// remaining 6 values = 0

This would unblock night light / blue light filtering for all Apple Silicon users on mwc.
Related
#782

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions