[PATCH 2/4] drm/fsl-dcu: respect pos/size register sizes

From: Stefan Agner
Date: Tue Sep 06 2016 - 00:03:01 EST


Mask the size and position values to avoid mutual overwriting.
Especially, a negative X position caused the Y position to be
overwritten with 0xfff too. This has been observed when using
a layer as cursor layer.

Signed-off-by: Stefan Agner <stefan@xxxxxxxx>
---
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
index 3b371fe7..060f881 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
@@ -118,11 +118,11 @@

#define DCU_CTRLDESCLN(layer, reg) (0x200 + (reg - 1) * 4 + (layer) * 0x40)

-#define DCU_LAYER_HEIGHT(x) ((x) << 16)
-#define DCU_LAYER_WIDTH(x) (x)
+#define DCU_LAYER_HEIGHT(x) (((x) & 0x7ff) << 16)
+#define DCU_LAYER_WIDTH(x) ((x) & 0x7ff)

-#define DCU_LAYER_POSY(x) ((x) << 16)
-#define DCU_LAYER_POSX(x) (x)
+#define DCU_LAYER_POSY(x) (((x) & 0xfff) << 16)
+#define DCU_LAYER_POSX(x) ((x) & 0xfff)

#define DCU_LAYER_EN BIT(31)
#define DCU_LAYER_TILE_EN BIT(30)
--
2.9.3