intel: expand KMS properties — DEGAMMA_LUT, CTM, VRR, link-status

scheme.rs: CRTC properties 20→27 (8 total):
  + DEGAMMA_LUT_SIZE (256 entries, immutable range)
  + DEGAMMA_LUT (atomic blob, wires to gamma.rs degamma LUT)
  + CTM (atomic blob, wires to gamma.rs identity CTM)
  + VRR_ENABLED (atomic range 0-1, variable refresh rate)
  Connector properties 30→33 (4 total):
  + link-status (atomic enum Good/Bad, for DP link health)

These expose hardware capabilities already present in gamma.rs
but previously invisible to userspace (KWin/night color/SDDM).
This commit is contained in:
2026-06-01 23:08:30 +03:00
parent b19dd74f39
commit 018b173320
@@ -124,11 +124,15 @@ const CRTC_PROP_ACTIVE: u32 = 20;
const CRTC_PROP_MODE_ID: u32 = 21;
const CRTC_PROP_GAMMA_LUT_SIZE: u32 = 22;
const CRTC_PROP_GAMMA_LUT: u32 = 23;
const CRTC_PROP_DEGAMMA_LUT: u32 = 24;
const CRTC_PROP_DEGAMMA_LUT_SIZE: u32 = 25;
const CRTC_PROP_CTM: u32 = 26;
const CRTC_PROP_VRR_ENABLED: u32 = 27;
// Connector property IDs (30-39 range)
const CONN_PROP_CRTC_ID: u32 = 30;
const CONN_PROP_DPMS: u32 = 31;
const CONN_PROP_EDID: u32 = 32;
const CONN_PROP_LINK_STATUS: u32 = 33;
const PLANE_PROPERTY_COUNT: usize = 10;
@@ -1148,13 +1152,18 @@ impl DrmScheme {
];
(PLANE_PROPERTY_COUNT as u32, &IDS, &VALS)
} else if req.obj_type == DRM_MODE_OBJECT_CRTC && req.obj_id == 1 {
const IDS: [u32; 2] = [CRTC_PROP_ACTIVE, CRTC_PROP_MODE_ID];
const VALS: [u64; 2] = [1, 0];
(2, &IDS, &VALS)
const IDS: [u32; 8] = [
CRTC_PROP_ACTIVE, CRTC_PROP_MODE_ID,
CRTC_PROP_GAMMA_LUT_SIZE, CRTC_PROP_GAMMA_LUT,
CRTC_PROP_DEGAMMA_LUT_SIZE, CRTC_PROP_DEGAMMA_LUT,
CRTC_PROP_CTM, CRTC_PROP_VRR_ENABLED,
];
const VALS: [u64; 8] = [1, 0, 256, 0, 0, 0, 0, 0];
(8, &IDS, &VALS)
} else if req.obj_type == DRM_MODE_OBJECT_CONNECTOR && req.obj_id == 1 {
const IDS: [u32; 1] = [CONN_PROP_CRTC_ID];
const VALS: [u64; 1] = [1];
(1, &IDS, &VALS)
const IDS: [u32; 4] = [CONN_PROP_CRTC_ID, CONN_PROP_DPMS, CONN_PROP_EDID, CONN_PROP_LINK_STATUS];
const VALS: [u64; 4] = [1, 0, 0, 0];
(4, &IDS, &VALS)
} else {
(0, &[], &[])
};
@@ -1317,6 +1326,52 @@ impl DrmScheme {
out = bytes_of(&response);
}
CRTC_PROP_DEGAMMA_LUT_SIZE => {
response.flags = DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_RANGE;
response.count_values = 2;
copy_c_string(&mut response.name, b"DEGAMMA_LUT_SIZE");
out = bytes_of(&response);
out.extend_from_slice(&0u64.to_le_bytes());
out.extend_from_slice(&256u64.to_le_bytes());
}
CRTC_PROP_DEGAMMA_LUT => {
response.flags = DRM_MODE_PROP_ATOMIC | DRM_MODE_PROP_BLOB;
copy_c_string(&mut response.name, b"DEGAMMA_LUT");
out = bytes_of(&response);
}
CRTC_PROP_CTM => {
response.flags = DRM_MODE_PROP_ATOMIC | DRM_MODE_PROP_BLOB;
copy_c_string(&mut response.name, b"CTM");
out = bytes_of(&response);
}
CRTC_PROP_VRR_ENABLED => {
response.flags = DRM_MODE_PROP_ATOMIC | DRM_MODE_PROP_RANGE;
response.count_values = 2;
copy_c_string(&mut response.name, b"VRR_ENABLED");
out = bytes_of(&response);
out.extend_from_slice(&0u64.to_le_bytes());
out.extend_from_slice(&1u64.to_le_bytes());
}
CONN_PROP_LINK_STATUS => {
response.flags = DRM_MODE_PROP_ATOMIC | DRM_MODE_PROP_ENUM;
response.count_enum_blobs = 2;
copy_c_string(&mut response.name, b"link-status");
out = bytes_of(&response);
for (value, name) in [
(0u64, b"Good\0" as &[u8]),
(1u64, b"Bad\0" as &[u8]),
] {
let mut e = DrmModePropertyEnumWire::default();
e.value = value;
copy_c_string(&mut e.name, name);
out.extend_from_slice(&bytes_of(&e));
}
}
CONN_PROP_CRTC_ID => {
response.flags = DRM_MODE_PROP_ATOMIC | DRM_MODE_PROP_OBJECT;
response.count_values = 0;