drm/i915: Add i9xx_lut_8()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 7 Nov 2019 15:17:17 +0000 (17:17 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 20 Feb 2020 19:44:54 +0000 (21:44 +0200)
We have a nice little helper to compute a single LUT entry
for everything except the 8bpc legacy gamma mode. Let's
complete the set.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191107151725.10507-5-ville.syrjala@linux.intel.com
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
drivers/gpu/drm/i915/display/intel_color.c

index d44bd82878013b988c453c017de31e15f8610d1a..36dd52d2a9ee099ecff295f110ff586bdf74c94e 100644 (file)
@@ -392,6 +392,13 @@ static void cherryview_load_csc_matrix(const struct intel_crtc_state *crtc_state
        intel_de_write(dev_priv, CGM_PIPE_MODE(pipe), crtc_state->cgm_mode);
 }
 
+static u32 i9xx_lut_8(const struct drm_color_lut *color)
+{
+       return drm_color_lut_extract(color->red, 8) << 16 |
+               drm_color_lut_extract(color->green, 8) << 8 |
+               drm_color_lut_extract(color->blue, 8);
+}
+
 /* i965+ "10.6" bit interpolated format "even DW" (low 8 bits) */
 static u32 i965_lut_10p6_ldw(const struct drm_color_lut *color)
 {
@@ -435,10 +442,7 @@ static void i9xx_load_luts_internal(const struct intel_crtc_state *crtc_state,
                const struct drm_color_lut *lut = blob->data;
 
                for (i = 0; i < 256; i++) {
-                       u32 word =
-                               (drm_color_lut_extract(lut[i].red, 8) << 16) |
-                               (drm_color_lut_extract(lut[i].green, 8) << 8) |
-                               drm_color_lut_extract(lut[i].blue, 8);
+                       u32 word = i9xx_lut_8(&lut[i]);
 
                        if (HAS_GMCH(dev_priv))
                                intel_de_write(dev_priv, PALETTE(pipe, i),