Re: [PATCH 2/4] drm/i915: Remove the pointless 1:1 matrix copy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




>-----Original Message-----
>From: Ville Syrjala [mailto:ville.syrjala@xxxxxxxxxxxxxxx]
>Sent: Friday, February 23, 2018 3:13 AM
>To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>Cc: Lin, Johnson <johnson.lin@xxxxxxxxx>; Shankar, Uma
><uma.shankar@xxxxxxxxx>; Sharma, Shashank <shashank.sharma@xxxxxxxxx>
>Subject: [PATCH 2/4] drm/i915: Remove the pointless 1:1 matrix copy
>
>From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>
>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.
>

Looks ok to me.
Reviewed-by: Uma Shankar <uma.shankar@xxxxxxxxx>

>Cc: Johnson Lin <johnson.lin@xxxxxxxxx>
>Cc: Uma Shankar <uma.shankar@xxxxxxxxx>
>Cc: Shashank Sharma <shashank.sharma@xxxxxxxxx>
>Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>---
> drivers/gpu/drm/i915/intel_color.c | 17 +++++++++--------
> 1 file 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)
>  * When using limited range, multiply the matrix given by userspace by
>  * the matrix that we would use for the limited range.
>  */
>-static void ctm_mult_by_limited(u64 *result, const u64 *input)
>+static u64 *ctm_mult_by_limited(u64 *result, const u64 *input)
> {
> 	int i;
>
>@@ -104,6 +104,8 @@ static void ctm_mult_by_limited(u64 *result, const u64
>*input)
> 		result[i] = mul_u32_u32(limited_coeff, abs_coeff) >> 30;
> 		result[i] |= user_coeff & CTM_COEFF_SIGN;
> 	}
>+
>+	return result;
> }
>
> static 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)
> 	} else if (crtc_state->ctm) {
> 		struct drm_color_ctm *ctm =
> 			(struct drm_color_ctm *)crtc_state->ctm->data;
>-		uint64_t input[9] = { 0, };
>+		const u64 *input;
>+		u64 temp[9];
>
>-		if (intel_crtc_state->limited_color_range) {
>-			ctm_mult_by_limited(input, ctm->matrix);
>-		} else {
>-			for (i = 0; i < ARRAY_SIZE(input); i++)
>-				input[i] = ctm->matrix[i];
>-		}
>+		if (intel_crtc_state->limited_color_range)
>+			input = ctm_mult_by_limited(temp, ctm->matrix);
>+		else
>+			input = ctm->matrix;
>
> 		/*
> 		 * Convert fixed point S31.32 input to format supported by the
>--
>2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux