aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-02-22 16:42:30 -0500
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-02-28 07:58:23 -0500
commitdb61d160b3ed36b9fc2f65b416e02cc453043fef (patch)
tree84321afc47e3132a8926dc3530481f63c8fbd973
parentf074037a2eb1ff21e258a27a6270bae126ded062 (diff)
drm/i915: Remove the pointless 1:1 matrix copy
If we don't have to frob with the user provided ctm matrix there's no point in copying it over. Just point at the user ctm directly. Also the matrix gets fully populated by ctm_mult_by_limited() so no need to zero initialize it. Cc: Johnson Lin <johnson.lin@intel.com> Cc: Uma Shankar <uma.shankar@intel.com> Cc: Shashank Sharma <shashank.sharma@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180222214232.6064-2-ville.syrjala@linux.intel.com Reviewed-by: Uma Shankar <uma.shankar@intel.com>
-rw-r--r--drivers/gpu/drm/i915/intel_color.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index a383d993b844..c9af260be113 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -86,7 +86,7 @@ static bool crtc_state_is_legacy_gamma(struct drm_crtc_state *state)
86 * When using limited range, multiply the matrix given by userspace by 86 * When using limited range, multiply the matrix given by userspace by
87 * the matrix that we would use for the limited range. 87 * the matrix that we would use for the limited range.
88 */ 88 */
89static void ctm_mult_by_limited(u64 *result, const u64 *input) 89static u64 *ctm_mult_by_limited(u64 *result, const u64 *input)
90{ 90{
91 int i; 91 int i;
92 92
@@ -104,6 +104,8 @@ static void ctm_mult_by_limited(u64 *result, const u64 *input)
104 result[i] = mul_u32_u32(limited_coeff, abs_coeff) >> 30; 104 result[i] = mul_u32_u32(limited_coeff, abs_coeff) >> 30;
105 result[i] |= user_coeff & CTM_COEFF_SIGN; 105 result[i] |= user_coeff & CTM_COEFF_SIGN;
106 } 106 }
107
108 return result;
107} 109}
108 110
109static void i9xx_load_ycbcr_conversion_matrix(struct intel_crtc *intel_crtc) 111static void i9xx_load_ycbcr_conversion_matrix(struct intel_crtc *intel_crtc)
@@ -146,14 +148,13 @@ static void i9xx_load_csc_matrix(struct drm_crtc_state *crtc_state)
146 } else if (crtc_state->ctm) { 148 } else if (crtc_state->ctm) {
147 struct drm_color_ctm *ctm = 149 struct drm_color_ctm *ctm =
148 (struct drm_color_ctm *)crtc_state->ctm->data; 150 (struct drm_color_ctm *)crtc_state->ctm->data;
149 uint64_t input[9] = { 0, }; 151 const u64 *input;
152 u64 temp[9];
150 153
151 if (intel_crtc_state->limited_color_range) { 154 if (intel_crtc_state->limited_color_range)
152 ctm_mult_by_limited(input, ctm->matrix); 155 input = ctm_mult_by_limited(temp, ctm->matrix);
153 } else { 156 else
154 for (i = 0; i < ARRAY_SIZE(input); i++) 157 input = ctm->matrix;
155 input[i] = ctm->matrix[i];
156 }
157 158
158 /* 159 /*
159 * Convert fixed point S31.32 input to format supported by the 160 * Convert fixed point S31.32 input to format supported by the