drm/rockchip: vop2: enable dither up when input rgb565

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: I554924b979735e2377b1e9d06b22b2d9b35450a4
This commit is contained in:
Sandy Huang
2021-07-21 16:58:30 +08:00
committed by Tao Huang
parent f5d4d3c289
commit 81633ee291
3 changed files with 19 additions and 0 deletions

View File

@@ -531,6 +531,7 @@ struct vop2_win_regs {
struct vop_reg global_alpha_val;
struct vop_reg color_key;
struct vop_reg color_key_en;
struct vop_reg dither_up;
};
struct vop2_video_port_regs {

View File

@@ -1298,6 +1298,17 @@ static bool vop2_win_uv_swap(uint32_t format)
}
}
static bool vop2_win_dither_up(uint32_t format)
{
switch (format) {
case DRM_FORMAT_BGR565:
case DRM_FORMAT_RGB565:
return true;
default:
return false;
}
}
static bool vop2_output_uv_swap(uint32_t bus_format, uint32_t output_mode)
{
/*
@@ -2991,6 +3002,7 @@ static void vop2_plane_atomic_update(struct drm_plane *plane, struct drm_plane_s
uint32_t stride;
uint32_t transform_offset;
struct drm_format_name_buf format_name;
bool dither_up;
#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
bool AFBC_flag = false;
@@ -3186,6 +3198,9 @@ static void vop2_plane_atomic_update(struct drm_plane *plane, struct drm_plane_s
VOP_WIN_SET(vop2, win, r2y_en, vpstate->r2y_en);
VOP_WIN_SET(vop2, win, csc_mode, vpstate->csc_mode);
dither_up = vop2_win_dither_up(fb->format->format);
VOP_WIN_SET(vop2, win, dither_up, dither_up);
VOP_WIN_SET(vop2, win, enable, 1);
if (vop2_cluster_window(win)) {
lb_mode = vop2_get_cluster_lb_mode(win, vpstate);

View File

@@ -928,6 +928,7 @@ static const struct vop2_win_regs rk3568_cluster0_win_data = {
.enable = VOP_REG(RK3568_CLUSTER0_WIN0_CTRL0, 0x1, 0),
.format = VOP_REG(RK3568_CLUSTER0_WIN0_CTRL0, 0x1f, 1),
.rb_swap = VOP_REG(RK3568_CLUSTER0_WIN0_CTRL0, 0x1, 14),
.dither_up = VOP_REG(RK3568_CLUSTER0_WIN0_CTRL0, 0x1, 18),
.act_info = VOP_REG(RK3568_CLUSTER0_WIN0_ACT_INFO, 0x1fff1fff, 0),
.dsp_info = VOP_REG(RK3568_CLUSTER0_WIN0_DSP_INFO, 0x0fff0fff, 0),
.dsp_st = VOP_REG(RK3568_CLUSTER0_WIN0_DSP_ST, 0x1fff1fff, 0),
@@ -948,6 +949,7 @@ static const struct vop2_win_regs rk3568_cluster1_win_data = {
.enable = VOP_REG(RK3568_CLUSTER1_WIN0_CTRL0, 0x1, 0),
.format = VOP_REG(RK3568_CLUSTER1_WIN0_CTRL0, 0x1f, 1),
.rb_swap = VOP_REG(RK3568_CLUSTER1_WIN0_CTRL0, 0x1, 14),
.dither_up = VOP_REG(RK3568_CLUSTER1_WIN0_CTRL0, 0x1, 18),
.act_info = VOP_REG(RK3568_CLUSTER1_WIN0_ACT_INFO, 0x1fff1fff, 0),
.dsp_info = VOP_REG(RK3568_CLUSTER1_WIN0_DSP_INFO, 0x0fff0fff, 0),
.dsp_st = VOP_REG(RK3568_CLUSTER1_WIN0_DSP_ST, 0x1fff1fff, 0),
@@ -965,6 +967,7 @@ static const struct vop2_win_regs rk3568_esmart_win_data = {
.scl = &rk3568_esmart_win_scl,
.enable = VOP_REG(RK3568_ESMART0_REGION0_CTRL, 0x1, 0),
.format = VOP_REG(RK3568_ESMART0_REGION0_CTRL, 0x1f, 1),
.dither_up = VOP_REG(RK3568_ESMART0_REGION0_CTRL, 0x1, 12),
.rb_swap = VOP_REG(RK3568_ESMART0_REGION0_CTRL, 0x1, 14),
.uv_swap = VOP_REG(RK3568_ESMART0_REGION0_CTRL, 0x1, 16),
.act_info = VOP_REG(RK3568_ESMART0_REGION0_ACT_INFO, 0x1fff1fff, 0),