All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Johnson Lin <johnson.lin@intel.com>
Subject: [PATCH 2/4] drm/i915: Remove the pointless 1:1 matrix copy
Date: Thu, 22 Feb 2018 23:42:30 +0200	[thread overview]
Message-ID: <20180222214232.6064-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20180222214232.6064-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-02-22 21:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22 21:42 [PATCH 1/4] drm/uapi: The ctm matrix uses sign-magnitude representation Ville Syrjala
2018-02-22 21:42 ` Ville Syrjala [this message]
2018-02-23 12:44   ` [PATCH 2/4] drm/i915: Remove the pointless 1:1 matrix copy Shankar, Uma
2018-02-22 21:42 ` [PATCH 3/4] drm/i915: Rename pipe CSC to use ilk_ prefix Ville Syrjala
2018-02-23 13:05   ` Shankar, Uma
2018-02-28 13:05     ` Ville Syrjälä
2018-02-22 21:42 ` [PATCH 4/4] drm/i915: Don't mangle the CTM on pre-HSW Ville Syrjala
2018-02-23 13:33   ` Shankar, Uma
2018-02-23 13:52     ` Ville Syrjälä
2018-02-28 13:11       ` Shankar, Uma
2018-02-28 13:19         ` Ville Syrjälä
2018-02-22 22:17 ` ✓ Fi.CI.BAT: success for series starting with [1/4] drm/uapi: The ctm matrix uses sign-magnitude representation Patchwork
2018-02-23  5:55 ` ✗ Fi.CI.IGT: warning " Patchwork
2018-02-23 12:39 ` [PATCH 1/4] " Shankar, Uma
2018-02-23 13:52 ` Brian Starkey
2018-02-23 14:04   ` Ville Syrjälä
2018-02-28 12:56     ` [Intel-gfx] " Ville Syrjälä
2018-02-23 16:26 ` Harry Wentland
2018-02-23 16:54   ` Ville Syrjälä
2018-03-06  7:51   ` Daniel Vetter
2018-03-06 15:41     ` Harry Wentland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180222214232.6064-2-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=johnson.lin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.