Skip to content

Commit abd9d66

Browse files
aknautiyalrodrigovivi
authored andcommitted
drm/i915/display: Fix the 12 BPC bits for PIPE_MISC reg
Till DISPLAY12 the PIPE_MISC bits 5-7 are used to set the Dithering BPC, with valid values of 6, 8, 10 BPC. For ADLP+ these bits are used to set the PORT OUTPUT BPC, with valid values of: 6, 8, 10, 12 BPC, and need to be programmed whether dithering is enabled or not. This patch: -corrects the bits 5-7 for PIPE MISC register for 12 BPC. -renames the bits and mask to have generic names for these bits for dithering bpc and port output bpc. v3: Added a note for MIPI DSI which uses the PIPE_MISC for readout for pipe_bpp. (Uma Shankar) v2: Added 'display' to the subject and fixes tag. (Uma Shankar) Fixes: 756f85c ("drm/i915/bdw: Broadwell has PIPEMISC") Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> (v1) Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: intel-gfx@lists.freedesktop.org Cc: <stable@vger.kernel.org> # v3.13+ Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com> Reviewed-by: Uma Shankar <uma.shankar@intel.com> Signed-off-by: Uma Shankar <uma.shankar@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210811051857.109723-1-ankit.k.nautiyal@intel.com (cherry picked from commit 70418a6) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent d927ae7 commit abd9d66

2 files changed

Lines changed: 35 additions & 15 deletions

File tree

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,16 +5746,18 @@ static void bdw_set_pipemisc(const struct intel_crtc_state *crtc_state)
57465746

57475747
switch (crtc_state->pipe_bpp) {
57485748
case 18:
5749-
val |= PIPEMISC_DITHER_6_BPC;
5749+
val |= PIPEMISC_6_BPC;
57505750
break;
57515751
case 24:
5752-
val |= PIPEMISC_DITHER_8_BPC;
5752+
val |= PIPEMISC_8_BPC;
57535753
break;
57545754
case 30:
5755-
val |= PIPEMISC_DITHER_10_BPC;
5755+
val |= PIPEMISC_10_BPC;
57565756
break;
57575757
case 36:
5758-
val |= PIPEMISC_DITHER_12_BPC;
5758+
/* Port output 12BPC defined for ADLP+ */
5759+
if (DISPLAY_VER(dev_priv) > 12)
5760+
val |= PIPEMISC_12_BPC_ADLP;
57595761
break;
57605762
default:
57615763
MISSING_CASE(crtc_state->pipe_bpp);
@@ -5808,15 +5810,27 @@ int bdw_get_pipemisc_bpp(struct intel_crtc *crtc)
58085810

58095811
tmp = intel_de_read(dev_priv, PIPEMISC(crtc->pipe));
58105812

5811-
switch (tmp & PIPEMISC_DITHER_BPC_MASK) {
5812-
case PIPEMISC_DITHER_6_BPC:
5813+
switch (tmp & PIPEMISC_BPC_MASK) {
5814+
case PIPEMISC_6_BPC:
58135815
return 18;
5814-
case PIPEMISC_DITHER_8_BPC:
5816+
case PIPEMISC_8_BPC:
58155817
return 24;
5816-
case PIPEMISC_DITHER_10_BPC:
5818+
case PIPEMISC_10_BPC:
58175819
return 30;
5818-
case PIPEMISC_DITHER_12_BPC:
5819-
return 36;
5820+
/*
5821+
* PORT OUTPUT 12 BPC defined for ADLP+.
5822+
*
5823+
* TODO:
5824+
* For previous platforms with DSI interface, bits 5:7
5825+
* are used for storing pipe_bpp irrespective of dithering.
5826+
* Since the value of 12 BPC is not defined for these bits
5827+
* on older platforms, need to find a workaround for 12 BPC
5828+
* MIPI DSI HW readout.
5829+
*/
5830+
case PIPEMISC_12_BPC_ADLP:
5831+
if (DISPLAY_VER(dev_priv) > 12)
5832+
return 36;
5833+
fallthrough;
58205834
default:
58215835
MISSING_CASE(tmp);
58225836
return 0;

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6163,11 +6163,17 @@ enum {
61636163
#define PIPEMISC_HDR_MODE_PRECISION (1 << 23) /* icl+ */
61646164
#define PIPEMISC_OUTPUT_COLORSPACE_YUV (1 << 11)
61656165
#define PIPEMISC_PIXEL_ROUNDING_TRUNC REG_BIT(8) /* tgl+ */
6166-
#define PIPEMISC_DITHER_BPC_MASK (7 << 5)
6167-
#define PIPEMISC_DITHER_8_BPC (0 << 5)
6168-
#define PIPEMISC_DITHER_10_BPC (1 << 5)
6169-
#define PIPEMISC_DITHER_6_BPC (2 << 5)
6170-
#define PIPEMISC_DITHER_12_BPC (3 << 5)
6166+
/*
6167+
* For Display < 13, Bits 5-7 of PIPE MISC represent DITHER BPC with
6168+
* valid values of: 6, 8, 10 BPC.
6169+
* ADLP+, the bits 5-7 represent PORT OUTPUT BPC with valid values of:
6170+
* 6, 8, 10, 12 BPC.
6171+
*/
6172+
#define PIPEMISC_BPC_MASK (7 << 5)
6173+
#define PIPEMISC_8_BPC (0 << 5)
6174+
#define PIPEMISC_10_BPC (1 << 5)
6175+
#define PIPEMISC_6_BPC (2 << 5)
6176+
#define PIPEMISC_12_BPC_ADLP (4 << 5) /* adlp+ */
61716177
#define PIPEMISC_DITHER_ENABLE (1 << 4)
61726178
#define PIPEMISC_DITHER_TYPE_MASK (3 << 2)
61736179
#define PIPEMISC_DITHER_TYPE_SP (0 << 2)

0 commit comments

Comments
 (0)