Fix off-by-one issue in LINEWIDTH, LINECOUNT, FRAMEWIDTH and FRAMEHEIGHT
macro definitions.  The first two macros are used to set a fetchunit's
source buffer dimension and the other two are used to set a fetchunit's
frame dimension.  It appears that display controller itself works ok
without this fix, however, it enters panic mode when prefetch engine(DPRC
and PRGs) attaches to it without this fix.

Fixes: 0e177d5ce01c ("drm/imx: Add i.MX8qxp Display Controller pixel engine")
Reviewed-by: Alexander Stein <[email protected]>
Reviewed-by: Frank Li <[email protected]>
Signed-off-by: Liu Ying <[email protected]>
---
v4:
- Rebase onto the latest drm-misc-next and resolve conflicts.

v2:
- Collect Alexander's and Frank's R-b tags.
---
 drivers/gpu/drm/imx/dc/dc-fu.c | 4 ++--
 drivers/gpu/drm/imx/dc/dc-fu.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/imx/dc/dc-fu.c b/drivers/gpu/drm/imx/dc/dc-fu.c
index 
1d8f74babef8a7139d9d4d42726426dfe437d966..2e197b3344bd12491c1f7bab0e5304190ed84356
 100644
--- a/drivers/gpu/drm/imx/dc/dc-fu.c
+++ b/drivers/gpu/drm/imx/dc/dc-fu.c
@@ -31,8 +31,8 @@
 #define STRIDE(x)                      FIELD_PREP(STRIDE_MASK, (x) - 1)
 
 /* SOURCEBUFFERDIMENSION */
-#define LINECOUNT(x)                   FIELD_PREP(GENMASK(29, 16), (x))
-#define LINEWIDTH(x)                   FIELD_PREP(GENMASK(13, 0), (x))
+#define LINECOUNT(x)                   FIELD_PREP(GENMASK(29, 16), (x) - 1)
+#define LINEWIDTH(x)                   FIELD_PREP(GENMASK(13, 0), (x) - 1)
 
 /* LAYEROFFSET */
 #define LAYERYOFFSET(x)                        FIELD_PREP(GENMASK(30, 16), (x))
diff --git a/drivers/gpu/drm/imx/dc/dc-fu.h b/drivers/gpu/drm/imx/dc/dc-fu.h
index 
f678de3ca8c0ae8d883ae47ce6bebc33cd00815d..cc93317e300134a0f8c378a155fb7c67dc6689d5
 100644
--- a/drivers/gpu/drm/imx/dc/dc-fu.h
+++ b/drivers/gpu/drm/imx/dc/dc-fu.h
@@ -38,8 +38,8 @@
 #define YUVCONVERSIONMODE(x)           FIELD_PREP(YUVCONVERSIONMODE_MASK, (x))
 
 /* FRAMEDIMENSIONS */
-#define FRAMEHEIGHT(x)                 FIELD_PREP(GENMASK(29, 16), (x))
-#define FRAMEWIDTH(x)                  FIELD_PREP(GENMASK(13, 0), (x))
+#define FRAMEHEIGHT(x)                 FIELD_PREP(GENMASK(29, 16), (x) - 1)
+#define FRAMEWIDTH(x)                  FIELD_PREP(GENMASK(13, 0), (x) - 1)
 
 /* CONTROL */
 #define INPUTSELECT_MASK               GENMASK(4, 3)

-- 
2.34.1

Reply via email to