Commit 67630bac authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Add 10bit gamma mode for gen2/3

Some gen2/gen3 parts have a 10bit gamma mode, on some pipes.
Expose it.

The format is different to the later i965+ style in that we
store a 10bit value and a 6 bit floating point slope for each
entry. Ie. the hardware extrapolates the intermediate steps
from the current LUT entry, instead of interpolating between
the current and next LUT entries. This also means we don't store
the last LUT entry in any register as it is defined by the previous
LUT entry's value+slope.

The slope has limited precision though (2 bit exponent + 4 bit
mantissa), so we'd have to allow for more error in the state checker
for the last entry and we have to make sure userspace doesn't
pass in something where the slope is simply to steep. In theory
we should perhaps check the slope for every interval, but we don't
do that for any other interpolated gamma mode and I suspect they
may also have some internal limit on the slope. I haven't confirmed
that theory though. Anyways, for ease of implementation we shall
just ignore the last entry in the state checker. If all the other
entries match anyway then that seems like a good indication that
the hardware was programmed as expected.

v2: Redo the state checker logic a bit
    Rebase due to other changes
v3: Fix C8 readout
v4: Use REG_FIELD_PREP()
Acked-by: default avatarUma Shankar <uma.shankar@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221114153732.11773-20-ville.syrjala@linux.intel.com
parent 07fc6a7b
This diff is collapsed.
...@@ -132,9 +132,9 @@ ...@@ -132,9 +132,9 @@
[PIPE_D] = TGL_CURSOR_D_OFFSET, \ [PIPE_D] = TGL_CURSOR_D_OFFSET, \
} }
#define I9XX_COLORS \ #define I845_COLORS \
.display.color = { .gamma_lut_size = 256 } .display.color = { .gamma_lut_size = 256 }
#define I965_COLORS \ #define I9XX_COLORS \
.display.color = { .gamma_lut_size = 129, \ .display.color = { .gamma_lut_size = 129, \
.gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \ .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
} }
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
.dma_mask_size = 32, \ .dma_mask_size = 32, \
I845_PIPE_OFFSETS, \ I845_PIPE_OFFSETS, \
I845_CURSOR_OFFSETS, \ I845_CURSOR_OFFSETS, \
I9XX_COLORS, \ I845_COLORS, \
GEN_DEFAULT_PAGE_SIZES, \ GEN_DEFAULT_PAGE_SIZES, \
GEN_DEFAULT_REGIONS GEN_DEFAULT_REGIONS
...@@ -341,7 +341,7 @@ static const struct intel_device_info pnv_m_info = { ...@@ -341,7 +341,7 @@ static const struct intel_device_info pnv_m_info = {
.dma_mask_size = 36, \ .dma_mask_size = 36, \
I9XX_PIPE_OFFSETS, \ I9XX_PIPE_OFFSETS, \
I9XX_CURSOR_OFFSETS, \ I9XX_CURSOR_OFFSETS, \
I965_COLORS, \ I9XX_COLORS, \
GEN_DEFAULT_PAGE_SIZES, \ GEN_DEFAULT_PAGE_SIZES, \
GEN_DEFAULT_REGIONS GEN_DEFAULT_REGIONS
...@@ -547,7 +547,7 @@ static const struct intel_device_info vlv_info = { ...@@ -547,7 +547,7 @@ static const struct intel_device_info vlv_info = {
.display.mmio_offset = VLV_DISPLAY_BASE, .display.mmio_offset = VLV_DISPLAY_BASE,
I9XX_PIPE_OFFSETS, I9XX_PIPE_OFFSETS,
I9XX_CURSOR_OFFSETS, I9XX_CURSOR_OFFSETS,
I965_COLORS, I9XX_COLORS,
GEN_DEFAULT_PAGE_SIZES, GEN_DEFAULT_PAGE_SIZES,
GEN_DEFAULT_REGIONS, GEN_DEFAULT_REGIONS,
}; };
......
...@@ -1712,6 +1712,20 @@ ...@@ -1712,6 +1712,20 @@
#define PALETTE_RED_MASK REG_GENMASK(23, 16) #define PALETTE_RED_MASK REG_GENMASK(23, 16)
#define PALETTE_GREEN_MASK REG_GENMASK(15, 8) #define PALETTE_GREEN_MASK REG_GENMASK(15, 8)
#define PALETTE_BLUE_MASK REG_GENMASK(7, 0) #define PALETTE_BLUE_MASK REG_GENMASK(7, 0)
/* pre-i965 10bit interpolated mode ldw */
#define PALETTE_10BIT_RED_LDW_MASK REG_GENMASK(23, 16)
#define PALETTE_10BIT_GREEN_LDW_MASK REG_GENMASK(15, 8)
#define PALETTE_10BIT_BLUE_LDW_MASK REG_GENMASK(7, 0)
/* pre-i965 10bit interpolated mode udw */
#define PALETTE_10BIT_RED_EXP_MASK REG_GENMASK(23, 22)
#define PALETTE_10BIT_RED_MANT_MASK REG_GENMASK(21, 18)
#define PALETTE_10BIT_RED_UDW_MASK REG_GENMASK(17, 16)
#define PALETTE_10BIT_GREEN_EXP_MASK REG_GENMASK(15, 14)
#define PALETTE_10BIT_GREEN_MANT_MASK REG_GENMASK(13, 10)
#define PALETTE_10BIT_GREEN_UDW_MASK REG_GENMASK(9, 8)
#define PALETTE_10BIT_BLUE_EXP_MASK REG_GENMASK(7, 6)
#define PALETTE_10BIT_BLUE_MANT_MASK REG_GENMASK(5, 2)
#define PALETTE_10BIT_BLUE_UDW_MASK REG_GENMASK(1, 0)
#define PALETTE(pipe, i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + \ #define PALETTE(pipe, i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) + \
_PICK((pipe), _PALETTE_A, \ _PICK((pipe), _PALETTE_A, \
_PALETTE_B, _CHV_PALETTE_C) + \ _PALETTE_B, _CHV_PALETTE_C) + \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment