[PATCH 5/8] drm/i915/display: Extract ilk_read_luts()
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Sat Mar 20 12:53:14 UTC 2021
For ilk, add hw read out to create hw blob of ctm coeff values.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
drivers/gpu/drm/i915/display/intel_color.c | 51 ++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 90c744687adf..f3ef08d7522c 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -321,6 +321,54 @@ static void ilk_load_csc_matrix(const struct intel_crtc_state *crtc_state)
crtc_state->csc_mode);
}
+static struct drm_property_blob *ilk_read_csc_matrix(struct intel_crtc *crtc)
+{
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
+ enum pipe pipe = crtc->pipe;
+ struct drm_property_blob *blob;
+ struct drm_color_ctm *ctm;
+ u32 temp;
+
+ blob = drm_property_create_blob(&dev_priv->drm,
+ sizeof(struct drm_color_ctm),
+ NULL);
+ if (IS_ERR(blob))
+ return NULL;
+
+ ctm = blob->data;
+
+ temp = intel_de_read(dev_priv, PIPE_CSC_COEFF_RY_GY(pipe));
+ ctm->matrix[0] = (temp >> 16) & 0xffff;
+ ctm->matrix[1] = temp & 0xffff;
+
+ temp = intel_de_read(dev_priv, PIPE_CSC_COEFF_BY(pipe));
+ ctm->matrix[2] = (temp >> 16) & 0xffff;
+
+ temp = intel_de_read(dev_priv, PIPE_CSC_COEFF_RU_GU(pipe));
+ ctm->matrix[3] = (temp >> 16) & 0xffff;
+ ctm->matrix[4] = temp & 0xffff;
+
+ temp = intel_de_read(dev_priv, PIPE_CSC_COEFF_BU(pipe));
+ ctm->matrix[5] = (temp >> 16) & 0xffff;
+
+ temp = intel_de_read(dev_priv, PIPE_CSC_COEFF_RV_GV(pipe));
+ ctm->matrix[6] = (temp >> 16) & 0xffff;
+ ctm->matrix[7] = temp & 0xffff;
+
+ temp = intel_de_read(dev_priv, PIPE_CSC_COEFF_BV(pipe));
+ ctm->matrix[8] = (temp >> 16) & 0xffff;
+
+ return blob;
+}
+
+static void ilk_read_csc(struct intel_crtc_state *crtc_state)
+{
+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+ if (crtc_state->csc_enable && crtc_state->csc_mode)
+ crtc_state->hw.ctm = ilk_read_csc_matrix(crtc);
+}
+
static void icl_load_csc_matrix(const struct intel_crtc_state *crtc_state)
{
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -2228,11 +2276,14 @@ void intel_color_init(struct intel_crtc *crtc)
dev_priv->display.read_luts = glk_read_luts;
} else if (INTEL_GEN(dev_priv) >= 8) {
dev_priv->display.load_luts = bdw_load_luts;
+ dev_priv->display.read_csc = ilk_read_csc;
} else if (INTEL_GEN(dev_priv) >= 7) {
dev_priv->display.load_luts = ivb_load_luts;
+ dev_priv->display.read_csc = ilk_read_csc;
} else {
dev_priv->display.load_luts = ilk_load_luts;
dev_priv->display.read_luts = ilk_read_luts;
+ dev_priv->display.read_csc = ilk_read_csc;
}
}
--
2.20.1
More information about the Intel-gfx-trybot
mailing list