drm: msm: sde: Fix 3d gamut programming sequence
Elements in the struct drm_msm_3d_col needs to be swapped for efficient
programming using the reg dma block. Change swaps the fields in uapi
header and fix couple of issues with disable sequence.
Change-Id: Ieb6f80f4017305ac19a9fb3babfa28f718eda483
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
diff --git a/drivers/gpu/drm/msm/sde/sde_color_processing.c b/drivers/gpu/drm/msm/sde/sde_color_processing.c
index 3114960..b410302 100644
--- a/drivers/gpu/drm/msm/sde/sde_color_processing.c
+++ b/drivers/gpu/drm/msm/sde/sde_color_processing.c
@@ -180,7 +180,7 @@
struct drm_property_blob *blob = prop_node->blob_ptr;
if (!blob)
- return -EINVAL;
+ return 0;
drm_property_unreference_blob(blob);
prop_node->blob_ptr = NULL;
return 0;
diff --git a/drivers/gpu/drm/msm/sde/sde_hw_color_proc_common_v4.h b/drivers/gpu/drm/msm/sde/sde_hw_color_proc_common_v4.h
index 28479ab..8f7764d 100644
--- a/drivers/gpu/drm/msm/sde/sde_hw_color_proc_common_v4.h
+++ b/drivers/gpu/drm/msm/sde/sde_hw_color_proc_common_v4.h
@@ -21,6 +21,7 @@
#define GAMUT_MAP_EN BIT(1)
#define GAMUT_EN BIT(0)
#define GAMUT_MODE_13B_OFF 640
+#define GAMUT_MODE_5_OFF 1248
enum {
gamut_mode_17 = 0,
diff --git a/drivers/gpu/drm/msm/sde/sde_hw_reg_dma_v1_color_proc.c b/drivers/gpu/drm/msm/sde/sde_hw_reg_dma_v1_color_proc.c
index 753697b..0dcbb7e 100644
--- a/drivers/gpu/drm/msm/sde/sde_hw_reg_dma_v1_color_proc.c
+++ b/drivers/gpu/drm/msm/sde/sde_hw_reg_dma_v1_color_proc.c
@@ -347,10 +347,9 @@
break;
case GAMUT_3D_MODE_5:
*tbl_len = GAMUT_3D_MODE5_TBL_SZ * sizeof(u32) * 2;
- *tbl_off = 0;
+ *tbl_off = GAMUT_MODE_5_OFF;
*scale_off = GAMUT_SCALEB_OFFSET_OFF;
*opcode = gamut_mode_5 << 2;
- *opcode |= GAMUT_MAP_EN;
break;
case GAMUT_3D_MODE_13:
*tbl_len = GAMUT_3D_MODE13_TBL_SZ * sizeof(u32) * 2;
@@ -364,7 +363,6 @@
*scale_off = (*opcode == gamut_mode_13a) ?
GAMUT_SCALEA_OFFSET_OFF : GAMUT_SCALEB_OFFSET_OFF;
*opcode <<= 2;
- *opcode |= GAMUT_MAP_EN;
break;
default:
rc = -EINVAL;
@@ -475,7 +473,7 @@
}
REG_DMA_SETUP_OPS(dma_write_cfg,
ctx->cap->sblk->gamut.base + GAMUT_LOWER_COLOR_OFF,
- &payload->col[i][0].c0, tbl_len,
+ &payload->col[i][0].c2_c1, tbl_len,
REG_BLK_WRITE_MULTIPLE, 2, 0);
rc = dma_ops->setup_payload(&dma_write_cfg);
if (rc) {
diff --git a/include/uapi/drm/msm_drm_pp.h b/include/uapi/drm/msm_drm_pp.h
index e809c03..d9155a9 100644
--- a/include/uapi/drm/msm_drm_pp.h
+++ b/include/uapi/drm/msm_drm_pp.h
@@ -96,8 +96,8 @@
* @c2_c1: Holds c2/c1 values
*/
struct drm_msm_3d_col {
- __u32 c0;
__u32 c2_c1;
+ __u32 c0;
};
/**
* struct drm_msm_3d_gamut - 3d gamut feature structure