Re: [PATCH 04/16] drm/i915: Move skl+ wm/ddb registers to proper headers

2024-05-13 Thread Jani Nikula
On Fri, 10 May 2024, Ville Syrjala  wrote:
> From: Ville Syrjälä 
>
> On SKL+ the watermark/DDB registers are proper per-plane
> registers. Move the definitons to their respective files.
>
> Cc: Zhenyu Wang 
> CC: Zhi Wang 
> Signed-off-by: Ville Syrjälä 

Reviewed-by: Jani Nikula 

> ---
>  .../gpu/drm/i915/display/intel_cursor_regs.h  | 20 +
>  .../i915/display/skl_universal_plane_regs.h   | 64 ++
>  drivers/gpu/drm/i915/display/skl_watermark.c  |  1 +
>  .../gpu/drm/i915/display/skl_watermark_regs.h | 83 ---
>  drivers/gpu/drm/i915/gvt/handlers.c   |  1 +
>  5 files changed, 86 insertions(+), 83 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_cursor_regs.h 
> b/drivers/gpu/drm/i915/display/intel_cursor_regs.h
> index 62f7fb5c3f10..a478ef5787c5 100644
> --- a/drivers/gpu/drm/i915/display/intel_cursor_regs.h
> +++ b/drivers/gpu/drm/i915/display/intel_cursor_regs.h
> @@ -75,4 +75,24 @@
>  #define CUR_CHICKEN(pipe) _MMIO_CURSOR2(dev_priv, pipe, _CUR_CHICKEN_A)
>  #define CURSURFLIVE(pipe) _MMIO_CURSOR2(dev_priv, pipe, _CURASURFLIVE)
>  
> +/* skl+ */
> +#define _CUR_WM_A_0  0x70140
> +#define _CUR_WM_B_0  0x71140
> +#define _CUR_WM_SAGV_A   0x70158
> +#define _CUR_WM_SAGV_B   0x71158
> +#define _CUR_WM_SAGV_TRANS_A 0x7015C
> +#define _CUR_WM_SAGV_TRANS_B 0x7115C
> +#define _CUR_WM_TRANS_A  0x70168
> +#define _CUR_WM_TRANS_B  0x71168
> +#define _CUR_WM_0(pipe) _PIPE(pipe, _CUR_WM_A_0, _CUR_WM_B_0)
> +#define CUR_WM(pipe, level) _MMIO(_CUR_WM_0(pipe) + ((4) * (level)))
> +#define CUR_WM_SAGV(pipe) _MMIO_PIPE(pipe, _CUR_WM_SAGV_A, _CUR_WM_SAGV_B)
> +#define CUR_WM_SAGV_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_SAGV_TRANS_A, 
> _CUR_WM_SAGV_TRANS_B)
> +#define CUR_WM_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_TRANS_A, _CUR_WM_TRANS_B)
> +
> +/* skl+ */
> +#define _CUR_BUF_CFG_A   0x7017c
> +#define _CUR_BUF_CFG_B   0x7117c
> +#define CUR_BUF_CFG(pipe)_MMIO_PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B)
> +
>  #endif /* __INTEL_CURSOR_REGS_H__ */
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane_regs.h 
> b/drivers/gpu/drm/i915/display/skl_universal_plane_regs.h
> index 7e34470beb74..d0c760e8 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane_regs.h
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane_regs.h
> @@ -402,4 +402,68 @@
>   (index) * 4, 
> _PLANE_CSC_POSTOFF_HI_2(pipe) + \
>   (index) * 4)
>  
> +#define _PLANE_WM_1_A_0  0x70240
> +#define _PLANE_WM_1_B_0  0x71240
> +#define _PLANE_WM_2_A_0  0x70340
> +#define _PLANE_WM_2_B_0  0x71340
> +#define _PLANE_WM_SAGV_1_A   0x70258
> +#define _PLANE_WM_SAGV_1_B   0x71258
> +#define _PLANE_WM_SAGV_2_A   0x70358
> +#define _PLANE_WM_SAGV_2_B   0x71358
> +#define _PLANE_WM_SAGV_TRANS_1_A 0x7025C
> +#define _PLANE_WM_SAGV_TRANS_1_B 0x7125C
> +#define _PLANE_WM_SAGV_TRANS_2_A 0x7035C
> +#define _PLANE_WM_SAGV_TRANS_2_B 0x7135C
> +#define _PLANE_WM_TRANS_1_A  0x70268
> +#define _PLANE_WM_TRANS_1_B  0x71268
> +#define _PLANE_WM_TRANS_2_A  0x70368
> +#define _PLANE_WM_TRANS_2_B  0x71368
> +#define   PLANE_WM_EN(1 << 31)
> +#define   PLANE_WM_IGNORE_LINES  (1 << 30)
> +#define   PLANE_WM_LINES_MASKREG_GENMASK(26, 14)
> +#define   PLANE_WM_BLOCKS_MASK   REG_GENMASK(11, 0)
> +
> +#define _PLANE_WM_1(pipe) _PIPE(pipe, _PLANE_WM_1_A_0, _PLANE_WM_1_B_0)
> +#define _PLANE_WM_2(pipe) _PIPE(pipe, _PLANE_WM_2_A_0, _PLANE_WM_2_B_0)
> +#define _PLANE_WM_BASE(pipe, plane) \
> + _PLANE(plane, _PLANE_WM_1(pipe), _PLANE_WM_2(pipe))
> +#define PLANE_WM(pipe, plane, level) \
> + _MMIO(_PLANE_WM_BASE(pipe, plane) + ((4) * (level)))
> +#define _PLANE_WM_SAGV_1(pipe) \
> + _PIPE(pipe, _PLANE_WM_SAGV_1_A, _PLANE_WM_SAGV_1_B)
> +#define _PLANE_WM_SAGV_2(pipe) \
> + _PIPE(pipe, _PLANE_WM_SAGV_2_A, _PLANE_WM_SAGV_2_B)
> +#define PLANE_WM_SAGV(pipe, plane) \
> + _MMIO(_PLANE(plane, _PLANE_WM_SAGV_1(pipe), _PLANE_WM_SAGV_2(pipe)))
> +#define _PLANE_WM_SAGV_TRANS_1(pipe) \
> + _PIPE(pipe, _PLANE_WM_SAGV_TRANS_1_A, _PLANE_WM_SAGV_TRANS_1_B)
> +#define _PLANE_WM_SAGV_TRANS_2(pipe) \
> + _PIPE(pipe, _PLANE_WM_SAGV_TRANS_2_A, _PLANE_WM_SAGV_TRANS_2_B)
> +#define PLANE_WM_SAGV_TRANS(pipe, plane) \
> + _MMIO(_PLANE(plane, _PLANE_WM_SAGV_TRANS_1(pipe), 
> _PLANE_WM_SAGV_TRANS_2(pipe)))
> +#define _PLANE_WM_TRANS_1(pipe) \
> + _PIPE(pipe, _PLANE_WM_TRANS_1_A, _PLANE_WM_TRANS_1_B)
> +#define _PLANE_WM_TRANS_2(pipe) \
> + _PIPE(pipe, _PLANE_WM_TRANS_2_A, _PLANE_WM_TRANS_2_B)
> +#define PLANE_WM_TRANS(pipe, plane) \
> + _MMIO(_PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe)))
> +
> +#define _PLANE_BUF_CFG_1_B   0x7127c
> +#define 

[PATCH 04/16] drm/i915: Move skl+ wm/ddb registers to proper headers

2024-05-10 Thread Ville Syrjala
From: Ville Syrjälä 

On SKL+ the watermark/DDB registers are proper per-plane
registers. Move the definitons to their respective files.

Cc: Zhenyu Wang 
CC: Zhi Wang 
Signed-off-by: Ville Syrjälä 
---
 .../gpu/drm/i915/display/intel_cursor_regs.h  | 20 +
 .../i915/display/skl_universal_plane_regs.h   | 64 ++
 drivers/gpu/drm/i915/display/skl_watermark.c  |  1 +
 .../gpu/drm/i915/display/skl_watermark_regs.h | 83 ---
 drivers/gpu/drm/i915/gvt/handlers.c   |  1 +
 5 files changed, 86 insertions(+), 83 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cursor_regs.h 
b/drivers/gpu/drm/i915/display/intel_cursor_regs.h
index 62f7fb5c3f10..a478ef5787c5 100644
--- a/drivers/gpu/drm/i915/display/intel_cursor_regs.h
+++ b/drivers/gpu/drm/i915/display/intel_cursor_regs.h
@@ -75,4 +75,24 @@
 #define CUR_CHICKEN(pipe) _MMIO_CURSOR2(dev_priv, pipe, _CUR_CHICKEN_A)
 #define CURSURFLIVE(pipe) _MMIO_CURSOR2(dev_priv, pipe, _CURASURFLIVE)
 
+/* skl+ */
+#define _CUR_WM_A_00x70140
+#define _CUR_WM_B_00x71140
+#define _CUR_WM_SAGV_A 0x70158
+#define _CUR_WM_SAGV_B 0x71158
+#define _CUR_WM_SAGV_TRANS_A   0x7015C
+#define _CUR_WM_SAGV_TRANS_B   0x7115C
+#define _CUR_WM_TRANS_A0x70168
+#define _CUR_WM_TRANS_B0x71168
+#define _CUR_WM_0(pipe) _PIPE(pipe, _CUR_WM_A_0, _CUR_WM_B_0)
+#define CUR_WM(pipe, level) _MMIO(_CUR_WM_0(pipe) + ((4) * (level)))
+#define CUR_WM_SAGV(pipe) _MMIO_PIPE(pipe, _CUR_WM_SAGV_A, _CUR_WM_SAGV_B)
+#define CUR_WM_SAGV_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_SAGV_TRANS_A, 
_CUR_WM_SAGV_TRANS_B)
+#define CUR_WM_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_TRANS_A, _CUR_WM_TRANS_B)
+
+/* skl+ */
+#define _CUR_BUF_CFG_A 0x7017c
+#define _CUR_BUF_CFG_B 0x7117c
+#define CUR_BUF_CFG(pipe)  _MMIO_PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B)
+
 #endif /* __INTEL_CURSOR_REGS_H__ */
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane_regs.h 
b/drivers/gpu/drm/i915/display/skl_universal_plane_regs.h
index 7e34470beb74..d0c760e8 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane_regs.h
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane_regs.h
@@ -402,4 +402,68 @@
(index) * 4, 
_PLANE_CSC_POSTOFF_HI_2(pipe) + \
(index) * 4)
 
+#define _PLANE_WM_1_A_00x70240
+#define _PLANE_WM_1_B_00x71240
+#define _PLANE_WM_2_A_00x70340
+#define _PLANE_WM_2_B_00x71340
+#define _PLANE_WM_SAGV_1_A 0x70258
+#define _PLANE_WM_SAGV_1_B 0x71258
+#define _PLANE_WM_SAGV_2_A 0x70358
+#define _PLANE_WM_SAGV_2_B 0x71358
+#define _PLANE_WM_SAGV_TRANS_1_A   0x7025C
+#define _PLANE_WM_SAGV_TRANS_1_B   0x7125C
+#define _PLANE_WM_SAGV_TRANS_2_A   0x7035C
+#define _PLANE_WM_SAGV_TRANS_2_B   0x7135C
+#define _PLANE_WM_TRANS_1_A0x70268
+#define _PLANE_WM_TRANS_1_B0x71268
+#define _PLANE_WM_TRANS_2_A0x70368
+#define _PLANE_WM_TRANS_2_B0x71368
+#define   PLANE_WM_EN  (1 << 31)
+#define   PLANE_WM_IGNORE_LINES(1 << 30)
+#define   PLANE_WM_LINES_MASK  REG_GENMASK(26, 14)
+#define   PLANE_WM_BLOCKS_MASK REG_GENMASK(11, 0)
+
+#define _PLANE_WM_1(pipe) _PIPE(pipe, _PLANE_WM_1_A_0, _PLANE_WM_1_B_0)
+#define _PLANE_WM_2(pipe) _PIPE(pipe, _PLANE_WM_2_A_0, _PLANE_WM_2_B_0)
+#define _PLANE_WM_BASE(pipe, plane) \
+   _PLANE(plane, _PLANE_WM_1(pipe), _PLANE_WM_2(pipe))
+#define PLANE_WM(pipe, plane, level) \
+   _MMIO(_PLANE_WM_BASE(pipe, plane) + ((4) * (level)))
+#define _PLANE_WM_SAGV_1(pipe) \
+   _PIPE(pipe, _PLANE_WM_SAGV_1_A, _PLANE_WM_SAGV_1_B)
+#define _PLANE_WM_SAGV_2(pipe) \
+   _PIPE(pipe, _PLANE_WM_SAGV_2_A, _PLANE_WM_SAGV_2_B)
+#define PLANE_WM_SAGV(pipe, plane) \
+   _MMIO(_PLANE(plane, _PLANE_WM_SAGV_1(pipe), _PLANE_WM_SAGV_2(pipe)))
+#define _PLANE_WM_SAGV_TRANS_1(pipe) \
+   _PIPE(pipe, _PLANE_WM_SAGV_TRANS_1_A, _PLANE_WM_SAGV_TRANS_1_B)
+#define _PLANE_WM_SAGV_TRANS_2(pipe) \
+   _PIPE(pipe, _PLANE_WM_SAGV_TRANS_2_A, _PLANE_WM_SAGV_TRANS_2_B)
+#define PLANE_WM_SAGV_TRANS(pipe, plane) \
+   _MMIO(_PLANE(plane, _PLANE_WM_SAGV_TRANS_1(pipe), 
_PLANE_WM_SAGV_TRANS_2(pipe)))
+#define _PLANE_WM_TRANS_1(pipe) \
+   _PIPE(pipe, _PLANE_WM_TRANS_1_A, _PLANE_WM_TRANS_1_B)
+#define _PLANE_WM_TRANS_2(pipe) \
+   _PIPE(pipe, _PLANE_WM_TRANS_2_A, _PLANE_WM_TRANS_2_B)
+#define PLANE_WM_TRANS(pipe, plane) \
+   _MMIO(_PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe)))
+
+#define _PLANE_BUF_CFG_1_B 0x7127c
+#define _PLANE_BUF_CFG_2_B 0x7137c
+#define _PLANE_BUF_CFG_1(pipe) \
+   _PIPE(pipe, _PLANE_BUF_CFG_1_A, _PLANE_BUF_CFG_1_B)
+#define _PLANE_BUF_CFG_2(pipe) \
+   _PIPE(pipe, _PLANE_BUF_CFG_2_A, _PLANE_BUF_CFG_2_B)
+#define