Skip to content

Commit 386ba08

Browse files
committed
drm/i915: Extract ilk_csc_limited_range()
Extract a helper which determines if we need to use the pipe CSC for limited range RGB output. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190218193137.22914-4-ville.syrjala@linux.intel.com Reviewed-by: Uma Shankar <uma.shankar@intel.com>
1 parent 9fdfb8e commit 386ba08

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/gpu/drm/i915/intel_color.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,28 @@ static void ilk_load_ycbcr_conversion_matrix(struct intel_crtc *crtc)
161161
}
162162
}
163163

164+
static bool ilk_csc_limited_range(const struct intel_crtc_state *crtc_state)
165+
{
166+
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
167+
168+
/*
169+
* FIXME if there's a gamma LUT after the CSC, we should
170+
* do the range compression using the gamma LUT instead.
171+
*/
172+
return crtc_state->limited_color_range &&
173+
(IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv) ||
174+
IS_GEN_RANGE(dev_priv, 9, 10));
175+
}
176+
164177
static void ilk_load_csc_matrix(const struct intel_crtc_state *crtc_state)
165178
{
166179
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
167180
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
168-
bool limited_color_range = false;
181+
bool limited_color_range = ilk_csc_limited_range(crtc_state);
169182
enum pipe pipe = crtc->pipe;
170183
u16 coeffs[9] = {};
171184
int i;
172185

173-
/*
174-
* FIXME if there's a gamma LUT after the CSC, we should
175-
* do the range compression using the gamma LUT instead.
176-
*/
177-
if (INTEL_GEN(dev_priv) >= 8 || IS_HASWELL(dev_priv))
178-
limited_color_range = crtc_state->limited_color_range;
179-
180186
if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ||
181187
crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444) {
182188
ilk_load_ycbcr_conversion_matrix(crtc);

0 commit comments

Comments
 (0)