Skip to content

Commit c6b994c

Browse files
chadmedjannau
authored andcommitted
drm: apple: Explicitly set identity matrix when CTM blob is not set
Unset CTM means a unit/pass-thru matrix should be used. Since we were checking for a valid CTM blob, this was resulting in a misconfigured colour management pipeline. This was most noticeable when using kwin's Night Light feature, specifically when waking the display after the morning transition was supposed to happen. Despite triggering a colour management change on CRTC enable, kwin clearing the CTM blob meant that there was nothing for us to passs in to IOMFB to set DCP's internal CTM. Explicitly pass the identity matrix to IOMFB if we have a pending colour management change and no CTM blob. Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Signed-off-by: Janne Grunau <j@jannau.net> --- - simplify after refactoring and fix value for 1 (S31.32 sign-magnitude) - adjusted commit message to documented DRM KMS behaviour
1 parent 954529a commit c6b994c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/gpu/drm/apple/iomfb_template.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,12 +1406,18 @@ void DCP_FW_NAME(iomfb_flush)(struct apple_dcp *dcp, struct drm_crtc *crtc, stru
14061406
dcp->brightness.update = false;
14071407
}
14081408

1409-
if (crtc_state->color_mgmt_changed && crtc_state->ctm) {
1410-
struct drm_color_ctm *ctm = (struct drm_color_ctm *)crtc_state->ctm->data;
1409+
if (crtc_state->color_mgmt_changed) {
14111410
struct iomfb_set_matrix_req mat = {
14121411
.location = 9,
14131412
};
1414-
memcpy(mat.matrix, ctm->matrix, sizeof(mat.matrix));
1413+
1414+
if (crtc_state->ctm) {
1415+
struct drm_color_ctm *ctm = (struct drm_color_ctm *)crtc_state->ctm->data;
1416+
memcpy(mat.matrix, ctm->matrix, sizeof(mat.matrix));
1417+
} else {
1418+
mat.matrix[0] = mat.matrix[4] = mat.matrix[8] = 1LLU << 32;
1419+
}
1420+
14151421
iomfb_set_matrix(dcp, false, &mat, do_swap, NULL);
14161422
} else
14171423
do_swap(dcp, NULL, NULL);

0 commit comments

Comments
 (0)