Commit 6bda8112 authored by Mark Yao's avatar Mark Yao Committed by Andrzej Hajda

drm/rockchip: pre dither down when output bpc is 8bit

Some encoder have a crc verification check, crc check fail if
input and output data is not equal.

That means encoder input and output need use same color depth,
vop can output 10bit data to encoder, but some panel only support
8bit depth, that would make crc check die.

So pre dither down vop data to 8bit if panel's bpc is 8.
Signed-off-by: default avatarMark Yao <mark.yao@rock-chips.com>
[seanpaul resolved conflict in rockchip_drm_vop.c]
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180423105003.9004-22-enric.balletbo@collabora.com
parent 7bd0fd98
...@@ -218,6 +218,7 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder, ...@@ -218,6 +218,7 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_connector_state *conn_state) struct drm_connector_state *conn_state)
{ {
struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
struct drm_display_info *di = &conn_state->connector->display_info;
/* /*
* The hardware IC designed that VOP must output the RGB10 video * The hardware IC designed that VOP must output the RGB10 video
...@@ -229,6 +230,7 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder, ...@@ -229,6 +230,7 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder,
s->output_mode = ROCKCHIP_OUT_MODE_AAAA; s->output_mode = ROCKCHIP_OUT_MODE_AAAA;
s->output_type = DRM_MODE_CONNECTOR_eDP; s->output_type = DRM_MODE_CONNECTOR_eDP;
s->output_bpc = di->bpc;
return 0; return 0;
} }
......
...@@ -36,6 +36,7 @@ struct rockchip_crtc_state { ...@@ -36,6 +36,7 @@ struct rockchip_crtc_state {
struct drm_crtc_state base; struct drm_crtc_state base;
int output_type; int output_type;
int output_mode; int output_mode;
int output_bpc;
}; };
#define to_rockchip_crtc_state(s) \ #define to_rockchip_crtc_state(s) \
container_of(s, struct rockchip_crtc_state, base) container_of(s, struct rockchip_crtc_state, base)
......
...@@ -925,6 +925,12 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, ...@@ -925,6 +925,12 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc,
if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA &&
!(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10)) !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10))
s->output_mode = ROCKCHIP_OUT_MODE_P888; s->output_mode = ROCKCHIP_OUT_MODE_P888;
if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && s->output_bpc == 8)
VOP_REG_SET(vop, common, pre_dither_down, 1);
else
VOP_REG_SET(vop, common, pre_dither_down, 0);
VOP_REG_SET(vop, common, out_mode, s->output_mode); VOP_REG_SET(vop, common, out_mode, s->output_mode);
VOP_REG_SET(vop, modeset, htotal_pw, (htotal << 16) | hsync_len); VOP_REG_SET(vop, modeset, htotal_pw, (htotal << 16) | hsync_len);
......
...@@ -67,6 +67,7 @@ struct vop_common { ...@@ -67,6 +67,7 @@ struct vop_common {
struct vop_reg cfg_done; struct vop_reg cfg_done;
struct vop_reg dsp_blank; struct vop_reg dsp_blank;
struct vop_reg data_blank; struct vop_reg data_blank;
struct vop_reg pre_dither_down;
struct vop_reg dither_down; struct vop_reg dither_down;
struct vop_reg dither_up; struct vop_reg dither_up;
struct vop_reg gate_en; struct vop_reg gate_en;
......
...@@ -264,6 +264,7 @@ static const struct vop_common rk3288_common = { ...@@ -264,6 +264,7 @@ static const struct vop_common rk3288_common = {
.standby = VOP_REG_SYNC(RK3288_SYS_CTRL, 0x1, 22), .standby = VOP_REG_SYNC(RK3288_SYS_CTRL, 0x1, 22),
.gate_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 23), .gate_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 23),
.mmu_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 20), .mmu_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 20),
.pre_dither_down = VOP_REG(RK3288_DSP_CTRL1, 0x1, 1),
.dither_down = VOP_REG(RK3288_DSP_CTRL1, 0xf, 1), .dither_down = VOP_REG(RK3288_DSP_CTRL1, 0xf, 1),
.dither_up = VOP_REG(RK3288_DSP_CTRL1, 0x1, 6), .dither_up = VOP_REG(RK3288_DSP_CTRL1, 0x1, 6),
.data_blank = VOP_REG(RK3288_DSP_CTRL0, 0x1, 19), .data_blank = VOP_REG(RK3288_DSP_CTRL0, 0x1, 19),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment