summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/arm/malidp_drv.c
diff options
context:
space:
mode:
authorMihail Atanassov2017-02-13 13:49:03 +0100
committerLiviu Dudau2017-04-24 11:45:34 +0200
commit6954f24588ebddc2e3c840103f02d1fe7e65a2d6 (patch)
tree2699bd1b9e39adc819d43307f67bc6c56605315a /drivers/gpu/drm/arm/malidp_drv.c
parentdrm: mali-dp: enable gamma support (diff)
downloadkernel-qcow2-linux-6954f24588ebddc2e3c840103f02d1fe7e65a2d6.tar.gz
kernel-qcow2-linux-6954f24588ebddc2e3c840103f02d1fe7e65a2d6.tar.xz
kernel-qcow2-linux-6954f24588ebddc2e3c840103f02d1fe7e65a2d6.zip
drm: mali-dp: Add CTM support
All DPs have a COLORADJ matrix which is applied prior to output gamma. Attach that to the CTM property. Also, ensure the input CTM's coefficients can fit in the DP registers' Q3.12 format. Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com> Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Diffstat (limited to 'drivers/gpu/drm/arm/malidp_drv.c')
-rw-r--r--drivers/gpu/drm/arm/malidp_drv.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 1eb6bbc5118a..eae41e26b819 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -79,6 +79,37 @@ static void malidp_atomic_commit_update_gamma(struct drm_crtc *crtc,
}
}
+static
+void malidp_atomic_commit_update_coloradj(struct drm_crtc *crtc,
+ struct drm_crtc_state *old_state)
+{
+ struct malidp_drm *malidp = crtc_to_malidp_device(crtc);
+ struct malidp_hw_device *hwdev = malidp->dev;
+ int i;
+
+ if (!crtc->state->color_mgmt_changed)
+ return;
+
+ if (!crtc->state->ctm) {
+ malidp_hw_clearbits(hwdev, MALIDP_DISP_FUNC_CADJ,
+ MALIDP_DE_DISPLAY_FUNC);
+ } else {
+ struct malidp_crtc_state *mc =
+ to_malidp_crtc_state(crtc->state);
+
+ if (!old_state->ctm || (crtc->state->ctm->base.id !=
+ old_state->ctm->base.id))
+ for (i = 0; i < MALIDP_COLORADJ_NUM_COEFFS; ++i)
+ malidp_hw_write(hwdev,
+ mc->coloradj_coeffs[i],
+ hwdev->map.coeffs_base +
+ MALIDP_COLOR_ADJ_COEF + 4 * i);
+
+ malidp_hw_setbits(hwdev, MALIDP_DISP_FUNC_CADJ,
+ MALIDP_DE_DISPLAY_FUNC);
+ }
+}
+
/*
* set the "config valid" bit and wait until the hardware acts on it
*/
@@ -145,8 +176,10 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
drm_atomic_helper_commit_modeset_disables(drm, state);
- for_each_crtc_in_state(state, crtc, old_crtc_state, i)
+ for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
malidp_atomic_commit_update_gamma(crtc, old_crtc_state);
+ malidp_atomic_commit_update_coloradj(crtc, old_crtc_state);
+ }
drm_atomic_helper_commit_planes(drm, state, 0);