]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Fix readout of PIPEGCMAX
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 3 Mar 2020 17:33:12 +0000 (19:33 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 9 Mar 2020 20:11:36 +0000 (22:11 +0200)
PIPEGCMAX is a 11.6 (or 1.16 if you will) value. Ie. it can
represent a value of 1.0 when the maximum we can store in the
software LUT is 0.ffff. Clamp the value so that it gets
saturated to the max the uapi supports.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200303173313.28117-9-ville.syrjala@linux.intel.com
Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
drivers/gpu/drm/i915/display/intel_color.c
drivers/gpu/drm/i915/i915_reg.h

index 8796f04e23a841dceac45eb8ce29ca921ca1c8f0..ed9996aacafdf8156bcdcb27cb41dc48188d0214 100644 (file)
@@ -442,7 +442,8 @@ static void i965_lut_10p6_pack(struct drm_color_lut *entry, u32 ldw, u32 udw)
 
 static u16 i965_lut_11p6_max_pack(u32 val)
 {
-       return REG_FIELD_GET(PIPEGCMAX_RGB_MASK, val);
+       /* PIPEGCMAX is 11.6, clamp to 10.6 */
+       return clamp_val(val, 0, 0xffff);
 }
 
 static u32 ilk_lut_10(const struct drm_color_lut *color)
index 80cf02a6eec1ed7574ca16dea01fd4690055907f..79ae9654dac9526b3f9a7bd2e1ef2f6192146138 100644 (file)
@@ -5870,7 +5870,6 @@ enum {
 
 #define  _PIPEAGCMAX           0x70010
 #define  _PIPEBGCMAX           0x71010
-#define PIPEGCMAX_RGB_MASK     REG_GENMASK(15, 0)
 #define PIPEGCMAX(pipe, i)     _MMIO_PIPE2(pipe, _PIPEAGCMAX + (i) * 4)
 
 #define _PIPE_MISC_A                   0x70030