diff options
-rw-r--r-- | samsung/cal_9845/hdr_reg.c | 149 | ||||
-rw-r--r-- | samsung/cal_common/cal_config.h | 5 | ||||
-rw-r--r-- | samsung/cal_common/hdr_cal.h | 4 | ||||
-rw-r--r-- | samsung/exynos_drm_debug.c | 156 | ||||
-rw-r--r-- | samsung/exynos_drm_decon.c | 2 | ||||
-rw-r--r-- | samsung/exynos_drm_dpp.c | 132 | ||||
-rw-r--r-- | samsung/exynos_drm_dpp.h | 34 | ||||
-rw-r--r-- | samsung/exynos_drm_dqe.h | 6 | ||||
-rw-r--r-- | samsung/exynos_drm_drv.h | 1 | ||||
-rw-r--r-- | samsung/exynos_drm_plane.c | 26 | ||||
-rw-r--r-- | samsung/exynos_drm_plane.h | 1 |
11 files changed, 440 insertions, 76 deletions
diff --git a/samsung/cal_9845/hdr_reg.c b/samsung/cal_9845/hdr_reg.c index 719453d..2160abf 100644 --- a/samsung/cal_9845/hdr_reg.c +++ b/samsung/cal_9845/hdr_reg.c @@ -38,10 +38,10 @@ void hdr_regs_desc_init(void __iomem *regs, const char *name, u32 id) void hdr_reg_set_hdr(u32 id, bool en) { - cal_log_debug(0, "%s +\n", __func__); + cal_log_debug(id, "%s +\n", __func__); hdr_write_mask(id, HDR_LSI_L_COM_CTRL, en ? ~0 : 0, COM_CTRL_ENABLE_MASK); - cal_log_debug(0, "%s -\n", __func__); + cal_log_debug(id, "%s -\n", __func__); } void hdr_reg_set_eotf_lut(u32 id, struct hdr_eotf_lut *lut) @@ -49,7 +49,7 @@ void hdr_reg_set_eotf_lut(u32 id, struct hdr_eotf_lut *lut) int i; u32 val; - cal_log_debug(0, "%s +\n", __func__); + cal_log_debug(id, "%s +\n", __func__); if (!lut) { hdr_write_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_EEN(0), @@ -61,18 +61,18 @@ void hdr_reg_set_eotf_lut(u32 id, struct hdr_eotf_lut *lut) val = EOTF_POSX_H(lut->posx[i * 2 + 1]) | EOTF_POSX_L(lut->posx[i * 2]); hdr_write_relaxed(id, HDR_LSI_L_EOTF_POSX(i), val); - cal_log_debug(0, "POSX[%d]: 0x%x\n", i, val); + cal_log_debug(id, "POSX[%d]: 0x%x\n", i, val); } for (i = 0; i < HDR_EOTF_POSY_LUT_REG_CNT; i++) { hdr_write_relaxed(id, HDR_LSI_L_EOTF_POSY(i), lut->posy[i]); - cal_log_debug(0, "POSY[%d]: 0x%x\n", i, lut->posy[i]); + cal_log_debug(id, "POSY[%d]: 0x%x\n", i, lut->posy[i]); } hdr_write_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_EEN(1), MOD_CTRL_EEN_MASK); - cal_log_debug(0, "%s -\n", __func__); + cal_log_debug(id, "%s -\n", __func__); } void hdr_reg_set_oetf_lut(u32 id, struct hdr_oetf_lut *lut) @@ -80,7 +80,7 @@ void hdr_reg_set_oetf_lut(u32 id, struct hdr_oetf_lut *lut) int i; u32 val; - cal_log_debug(0, "%s +\n", __func__); + cal_log_debug(id, "%s +\n", __func__); if (!lut) { hdr_write_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_OEN(0), @@ -92,20 +92,20 @@ void hdr_reg_set_oetf_lut(u32 id, struct hdr_oetf_lut *lut) val = OETF_POSX_H(lut->posx[i * 2 + 1]) | OETF_POSX_L(lut->posx[i * 2]); hdr_write_relaxed(id, HDR_LSI_L_OETF_POSX(i), val); - cal_log_debug(0, "POSX[%d]: 0x%x\n", i, val); + cal_log_debug(id, "POSX[%d]: 0x%x\n", i, val); } for (i = 0; i < HDR_OETF_POSY_LUT_REG_CNT; i++) { val = OETF_POSY_H(lut->posy[i * 2 + 1]) | OETF_POSY_L(lut->posy[i * 2]); hdr_write_relaxed(id, HDR_LSI_L_OETF_POSY(i), val); - cal_log_debug(0, "POSY[%d]: 0x%x\n", i, val); + cal_log_debug(id, "POSY[%d]: 0x%x\n", i, val); } hdr_write_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_OEN(1), MOD_CTRL_OEN_MASK); - cal_log_debug(0, "%s -\n", __func__); + cal_log_debug(id, "%s -\n", __func__); } /* @@ -117,7 +117,7 @@ void hdr_reg_set_gm(u32 id, struct hdr_gm_data *data) { int i; - cal_log_debug(0, "%s +\n", __func__); + cal_log_debug(id, "%s +\n", __func__); if (!data) { hdr_write_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_GEN(0), @@ -127,18 +127,18 @@ void hdr_reg_set_gm(u32 id, struct hdr_gm_data *data) for (i = 0; i < HDR_GM_COEF_REG_CNT; ++i) { hdr_write_relaxed(id, HDR_LSI_L_GM_COEF(i), data->coeffs[i]); - cal_log_debug(0, "COEFFS[%d]: 0x%x\n", i, data->coeffs[i]); + cal_log_debug(id, "COEFFS[%d]: 0x%x\n", i, data->coeffs[i]); } for (i = 0; i < HDR_GM_OFFS_REG_CNT; ++i) { hdr_write_relaxed(id, HDR_LSI_L_GM_OFFS(i), data->offsets[i]); - cal_log_debug(0, "OFFSETS[%d]: 0x%x\n", i, data->offsets[i]); + cal_log_debug(id, "OFFSETS[%d]: 0x%x\n", i, data->offsets[i]); } hdr_write_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_GEN(1), MOD_CTRL_GEN_MASK); - cal_log_debug(0, "%s -\n", __func__); + cal_log_debug(id, "%s -\n", __func__); } void hdr_reg_set_tm(u32 id, struct hdr_tm_data *tm) @@ -146,7 +146,7 @@ void hdr_reg_set_tm(u32 id, struct hdr_tm_data *tm) int i; u32 val; - cal_log_debug(0, "%s +\n", __func__); + cal_log_debug(id, "%s +\n", __func__); if (!tm) { hdr_write_mask(id, HDR_LSI_L_MOD_CTRL, 0, MOD_CTRL_TEN_MASK); @@ -156,29 +156,136 @@ void hdr_reg_set_tm(u32 id, struct hdr_tm_data *tm) val = TM_COEFB(tm->coeff_b) | TM_COEFG(tm->coeff_g) | TM_COEFR(tm->coeff_r); hdr_write_relaxed(id, HDR_LSI_L_TM_COEF, val); - cal_log_debug(0, "COEFF: 0x%x\n", val); + cal_log_debug(id, "COEFF: 0x%x\n", val); val = TM_RNGX_MAXX(tm->rng_x_max) | TM_RNGX_MINX(tm->rng_x_min); hdr_write_relaxed(id, HDR_LSI_L_TM_RNGX, val); - cal_log_debug(0, "RNGX: 0x%x\n", val); + cal_log_debug(id, "RNGX: 0x%x\n", val); val = TM_RNGY_MAXY(tm->rng_y_max) | TM_RNGY_MINY(tm->rng_y_min); hdr_write_relaxed(id, HDR_LSI_L_TM_RNGY, val); - cal_log_debug(0, "RNGY: 0x%x\n", val); + cal_log_debug(id, "RNGY: 0x%x\n", val); for (i = 0; i < HDR_TM_POSX_LUT_REG_CNT; i++) { val = TM_POSX_H(tm->posx[i * 2 + 1]) | TM_POSX_L(tm->posx[i * 2]); hdr_write_relaxed(id, HDR_LSI_L_TM_POSX(i), val); - cal_log_debug(0, "POSX[%d]: 0x%x\n", i, val); + cal_log_debug(id, "POSX[%d]: 0x%x\n", i, val); } for (i = 0; i < HDR_TM_POSY_LUT_REG_CNT; i++) { hdr_write_relaxed(id, HDR_LSI_L_TM_POSY(i), tm->posy[i]); - cal_log_debug(0, "POSY[%d]: 0x%x\n", i, tm->posy[i]); + cal_log_debug(id, "POSY[%d]: 0x%x\n", i, tm->posy[i]); } hdr_write_mask(id, HDR_LSI_L_MOD_CTRL, ~0, MOD_CTRL_TEN_MASK); - cal_log_debug(0, "%s -\n", __func__); + cal_log_debug(id, "%s -\n", __func__); +} + +static void hdr_reg_print(u32 id, u32 start, u32 count, enum elem_size size) +{ + u32 reg, val; + int idx, i; + char buf[256]; + char *p = buf; + const char *end = buf + sizeof(buf); + bool is_32 = (size == ELEM_SIZE_32); + u32 pcount; + + pcount = is_32 ? count : DIV_ROUND_UP(count, 2); + + for (i = 0; i < pcount; ++i) { + reg = hdr_read(id, start + i * 4); + + idx = is_32 ? i : i * 2; + val = is_32 ? reg : GET_LUT_L(reg); + + p += scnprintf(p, end - p, "[%4d]%8x ", idx, val); + + if (((i * 2 + 1) != count) && !is_32) + p += scnprintf(p, end - p, "[%4d]%8x ", i * 2 + 1, + GET_LUT_H(reg)); + + if ((i % 5) == 4) { + cal_log_info(id, "%s\n", buf); + p = buf; + } + } + + if (p != buf) + cal_log_info(id, "%s\n", buf); +} + +void hdr_reg_print_eotf_lut(u32 id) +{ + u32 val; + + val = hdr_read_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_EEN_MASK); + cal_log_info(id, "HDR: eotf %s\n", val ? "on" : "off"); + + if (!val) + return; + + cal_log_info(id, "POSX:\n"); + hdr_reg_print(id, HDR_LSI_L_EOTF_POSX(0), DRM_SAMSUNG_HDR_EOTF_LUT_LEN, + ELEM_SIZE_16); + cal_log_info(id, "POSY:\n"); + hdr_reg_print(id, HDR_LSI_L_EOTF_POSY(0), DRM_SAMSUNG_HDR_EOTF_LUT_LEN, + ELEM_SIZE_32); +} + +void hdr_reg_print_oetf_lut(u32 id) +{ + u32 val; + + val = hdr_read_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_OEN_MASK); + cal_log_info(id, "HDR: oetf %s\n", val ? "on" : "off"); + + if (!val) + return; + + cal_log_info(id, "POSX:\n"); + hdr_reg_print(id, HDR_LSI_L_OETF_POSX(0), DRM_SAMSUNG_HDR_OETF_LUT_LEN, + ELEM_SIZE_16); + cal_log_info(id, "POSY:\n"); + hdr_reg_print(id, HDR_LSI_L_OETF_POSY(0), DRM_SAMSUNG_HDR_OETF_LUT_LEN, + ELEM_SIZE_16); +} + +void hdr_reg_print_gm(u32 id) +{ + u32 val; + + val = hdr_read_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_GEN_MASK); + cal_log_info(id, "HDR: gammut %s\n", val ? "on" : "off"); + + if (!val) + return; + + cal_log_info(id, "COEFFS:\n"); + hdr_reg_print(id, HDR_LSI_L_GM_COEF(0), HDR_GM_COEF_REG_CNT, + ELEM_SIZE_32); + cal_log_info(id, "OFFSETS:\n"); + hdr_reg_print(id, HDR_LSI_L_GM_OFFS(0), HDR_GM_OFFS_REG_CNT, + ELEM_SIZE_32); +} + +void hdr_reg_print_tm(u32 id) +{ + u32 val; + + val = hdr_read_mask(id, HDR_LSI_L_MOD_CTRL, MOD_CTRL_TEN_MASK); + cal_log_info(id, "HDR: tone mapping %s\n", val ? "on" : "off"); + + cal_log_info(id, "COEFF: 0x%x\n", hdr_read(id, HDR_LSI_L_TM_COEF)); + cal_log_info(id, "RNGX: 0x%x\n", hdr_read(id, HDR_LSI_L_TM_RNGX)); + cal_log_info(id, "RNGY: 0x%x\n", hdr_read(id, HDR_LSI_L_TM_RNGY)); + + cal_log_info(id, "POSX:\n"); + hdr_reg_print(id, HDR_LSI_L_TM_POSX(0), DRM_SAMSUNG_HDR_TM_LUT_LEN, + ELEM_SIZE_16); + cal_log_info(id, "POSY:\n"); + hdr_reg_print(id, HDR_LSI_L_TM_POSY(0), DRM_SAMSUNG_HDR_TM_LUT_LEN, + ELEM_SIZE_32); } diff --git a/samsung/cal_common/cal_config.h b/samsung/cal_common/cal_config.h index d9f042d..59feac3 100644 --- a/samsung/cal_common/cal_config.h +++ b/samsung/cal_common/cal_config.h @@ -55,6 +55,11 @@ #endif #endif +enum elem_size { + ELEM_SIZE_16 = 16, + ELEM_SIZE_32 = 32, +}; + struct cal_regs_desc { const char *name; void __iomem *regs; diff --git a/samsung/cal_common/hdr_cal.h b/samsung/cal_common/hdr_cal.h index 451a652..6e82342 100644 --- a/samsung/cal_common/hdr_cal.h +++ b/samsung/cal_common/hdr_cal.h @@ -21,4 +21,8 @@ void hdr_reg_set_eotf_lut(u32 id, struct hdr_eotf_lut *lut); void hdr_reg_set_oetf_lut(u32 id, struct hdr_oetf_lut *lut); void hdr_reg_set_gm(u32 id, struct hdr_gm_data *data); void hdr_reg_set_tm(u32 id, struct hdr_tm_data *tm); +void hdr_reg_print_eotf_lut(u32 id); +void hdr_reg_print_oetf_lut(u32 id); +void hdr_reg_print_gm(u32 id); +void hdr_reg_print_tm(u32 id); #endif /* __SAMSUNG_HDR_CAL_H__ */ diff --git a/samsung/exynos_drm_debug.c b/samsung/exynos_drm_debug.c index f1c80e6..3647ea8 100644 --- a/samsung/exynos_drm_debug.c +++ b/samsung/exynos_drm_debug.c @@ -743,13 +743,13 @@ exynos_debugfs_add_cgc(struct cgc_debug_override *cgc, struct dentry *parent) exynos_debugfs_add_lut("red", 0664, dent_lut, DRM_SAMSUNG_CGC_LUT_REG_CNT, cgc->verbose_cnt, - cgc->force_lut.r_values, NULL, 32, &info->dirty); + cgc->force_lut.r_values, NULL, ELEM_SIZE_32, &info->dirty); exynos_debugfs_add_lut("green", 0664, dent_lut, DRM_SAMSUNG_CGC_LUT_REG_CNT, cgc->verbose_cnt, - cgc->force_lut.g_values, NULL, 32, &info->dirty); + cgc->force_lut.g_values, NULL, ELEM_SIZE_32, &info->dirty); exynos_debugfs_add_lut("blue", 0664, dent_lut, DRM_SAMSUNG_CGC_LUT_REG_CNT, cgc->verbose_cnt, - cgc->force_lut.b_values, NULL, 32, &info->dirty); + cgc->force_lut.b_values, NULL, ELEM_SIZE_32, &info->dirty); return dent; } @@ -778,11 +778,11 @@ exynos_debugfs_add_regamma(struct regamma_debug_override *regamma, } exynos_debugfs_add_lut("red", 0664, dent_lut, REGAMMA_LUT_SIZE, 0, - NULL, regamma->force_lut, 16, &info->dirty); + NULL, regamma->force_lut, ELEM_SIZE_16, &info->dirty); exynos_debugfs_add_lut("green", 0664, dent_lut, REGAMMA_LUT_SIZE, 0, - NULL, regamma->force_lut, 16, &info->dirty); + NULL, regamma->force_lut, ELEM_SIZE_16, &info->dirty); exynos_debugfs_add_lut("blue", 0664, dent_lut, REGAMMA_LUT_SIZE, 0, - NULL, regamma->force_lut, 16, &info->dirty); + NULL, regamma->force_lut, ELEM_SIZE_16, &info->dirty); return dent; } @@ -803,7 +803,7 @@ exynos_debugfs_add_degamma(struct degamma_debug_override *degamma, debugfs_create_bool("force_enable", 0664, dent, &info->force_en); debugfs_create_bool("verbose", 0664, dent, &info->verbose); exynos_debugfs_add_lut("lut", 0664, dent, DEGAMMA_LUT_SIZE, 0, NULL, - degamma->force_lut, 16, &info->dirty); + degamma->force_lut, ELEM_SIZE_16, &info->dirty); return dent; } @@ -1011,6 +1011,148 @@ err_event_log: return -ENOENT; } +static struct dentry *exynos_debugfs_add_hdr_lut(const char *name, + struct dentry *parent, struct exynos_debug_info *info, + void *posx_lut, size_t posx_cnt, enum elem_size posx_type, + void *posy_lut, size_t posy_cnt, enum elem_size posy_type) +{ + struct dentry *dent, *dent_lut; + + dent = debugfs_create_dir(name, parent); + if (!dent) { + pr_err("failed to create %s directory\n", name); + return NULL; + } + + debugfs_create_bool("force_enable", 0664, dent, &info->force_en); + debugfs_create_bool("verbose", 0664, dent, &info->verbose); + + dent_lut = debugfs_create_dir("lut", dent); + if (!dent_lut) { + pr_err("failed to create %s lut directory\n", name); + debugfs_remove_recursive(dent); + return NULL; + } + + exynos_debugfs_add_lut("posx", 0664, dent_lut, posx_cnt, 0, posx_lut, + NULL, posx_type, &info->dirty); + exynos_debugfs_add_lut("posy", 0664, dent_lut, posy_cnt, 0, posy_lut, + NULL, posy_type, &info->dirty); + + return dent; +} + +static struct dentry *exynos_debugfs_add_gammut(struct exynos_hdr *hdr, + struct dentry *parent) +{ + struct dentry *dent, *dent_matrix; + struct gm_debug_override *gm = &hdr->gm; + struct exynos_debug_info *info = &gm->info; + + dent = debugfs_create_dir("gammut", parent); + if (!dent) { + pr_err("failed to create gammut directory\n"); + return NULL; + } + + debugfs_create_bool("force_enable", 0664, dent, &info->force_en); + debugfs_create_bool("verbose", 0664, dent, &info->verbose); + + dent_matrix = debugfs_create_dir("matrix", dent); + if (!dent_matrix) { + pr_err("failed to create gammut matrix directory\n"); + debugfs_remove_recursive(dent); + return NULL; + } + + exynos_debugfs_add_lut("coeffs", 0664, dent_matrix, + DRM_SAMSUNG_HDR_GM_DIMENS * DRM_SAMSUNG_HDR_GM_DIMENS, + 0, gm->force_data.coeffs, NULL, ELEM_SIZE_32, &info->dirty); + exynos_debugfs_add_lut("offsets", 0664, dent_matrix, + DRM_SAMSUNG_HDR_GM_DIMENS, 0, + gm->force_data.offsets, NULL, ELEM_SIZE_32, &info->dirty); + + return dent; +} + +static struct dentry *exynos_debugfs_add_tm(struct exynos_hdr *hdr, + struct dentry *parent) +{ + struct dentry *dent; + struct tm_debug_override *tm = &hdr->tm; + struct exynos_debug_info *info = &tm->info; + struct hdr_tm_data *tm_data = &tm->force_data; + + dent = exynos_debugfs_add_hdr_lut("tone_mapping", parent, info, + tm->force_data.posx, DRM_SAMSUNG_HDR_TM_LUT_LEN, ELEM_SIZE_16, + tm->force_data.posy, DRM_SAMSUNG_HDR_TM_LUT_LEN, ELEM_SIZE_32); + + debugfs_create_u16("coeff_r", 0664, dent, &tm_data->coeff_r); + debugfs_create_u16("coeff_g", 0664, dent, &tm_data->coeff_g); + debugfs_create_u16("coeff_b", 0664, dent, &tm_data->coeff_b); + + debugfs_create_u16("range_x_min", 0664, dent, &tm_data->rng_x_min); + debugfs_create_u16("range_x_max", 0664, dent, &tm_data->rng_x_max); + debugfs_create_u16("range_y_min", 0664, dent, &tm_data->rng_y_min); + debugfs_create_u16("range_y_max", 0664, dent, &tm_data->rng_y_max); + + return dent; +} + +int exynos_drm_debugfs_plane_add(struct exynos_drm_plane *exynos_plane) +{ + struct drm_plane *plane = &exynos_plane->base; + struct drm_minor *minor = plane->dev->primary; + struct dpp_device *dpp = plane_to_dpp(exynos_plane); + struct dentry *root, *ent, *hdr_dent; + struct exynos_hdr *hdr = &dpp->hdr; + + root = debugfs_create_dir(plane->name, minor->debugfs_root); + if (!root) + return -ENOMEM; + + exynos_plane->debugfs_entry = root; + + if (test_bit(DPP_ATTR_HDR, &dpp->attr)) { + hdr_dent = debugfs_create_dir("hdr", root); + if (!hdr_dent) + goto err; + + ent = exynos_debugfs_add_hdr_lut("eotf", hdr_dent, + &hdr->eotf.info, hdr->eotf.force_lut.posx, + DRM_SAMSUNG_HDR_EOTF_LUT_LEN, ELEM_SIZE_16, + hdr->eotf.force_lut.posy, + DRM_SAMSUNG_HDR_EOTF_LUT_LEN, ELEM_SIZE_32); + if (!ent) + goto err; + + ent = exynos_debugfs_add_hdr_lut("oetf", hdr_dent, + &hdr->oetf.info, hdr->oetf.force_lut.posx, + DRM_SAMSUNG_HDR_OETF_LUT_LEN, ELEM_SIZE_16, + hdr->oetf.force_lut.posy, + DRM_SAMSUNG_HDR_OETF_LUT_LEN, ELEM_SIZE_16); + if (!ent) + goto err; + + ent = exynos_debugfs_add_gammut(hdr, hdr_dent); + if (!ent) + goto err; + } + + if (test_bit(DPP_ATTR_HDR10_PLUS, &dpp->attr)) { + ent = exynos_debugfs_add_tm(hdr, hdr_dent ? : root); + if (!ent) + goto err; + } + + return 0; +err: + debugfs_remove_recursive(exynos_plane->debugfs_entry); + exynos_plane->debugfs_entry = NULL; + return -ENOMEM; +} + + #define PREFIX_LEN 40 #define ROW_LEN 32 void dpu_print_hex_dump(void __iomem *regs, const void *buf, size_t len) diff --git a/samsung/exynos_drm_decon.c b/samsung/exynos_drm_decon.c index 8d8f4d5..fd65384 100644 --- a/samsung/exynos_drm_decon.c +++ b/samsung/exynos_drm_decon.c @@ -463,7 +463,7 @@ static void decon_update_plane(struct exynos_drm_crtc *exynos_crtc, struct exynos_drm_plane *exynos_plane) { const struct drm_plane_state *plane_state = exynos_plane->base.state; - const struct exynos_drm_plane_state *exynos_plane_state = + struct exynos_drm_plane_state *exynos_plane_state = to_exynos_plane_state(plane_state); const struct drm_crtc_state *crtc_state = exynos_crtc->base.state; struct dpp_device *dpp = plane_to_dpp(exynos_plane); diff --git a/samsung/exynos_drm_dpp.c b/samsung/exynos_drm_dpp.c index 1c3e547..5f77455 100644 --- a/samsung/exynos_drm_dpp.c +++ b/samsung/exynos_drm_dpp.c @@ -10,6 +10,9 @@ * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ + +#define pr_fmt(fmt) "%s: " fmt, __func__ + #include <drm/exynos_drm.h> #include <drm/drm_atomic.h> #include <drm/drm_fourcc.h> @@ -270,7 +273,7 @@ static void dpp_convert_plane_state_to_config(struct dpp_params_info *config, struct drm_framebuffer *fb = state->base.fb; unsigned int simplified_rot; - pr_debug("%s: mode(%dx%d)\n", __func__, mode->hdisplay, mode->vdisplay); + pr_debug("mode(%dx%d)\n", mode->hdisplay, mode->vdisplay); config->src.x = state->base.src_x >> 16; config->src.y = state->base.src_y >> 16; @@ -397,8 +400,7 @@ static int set_protection(struct dpp_device *dpp, uint64_t modifier) return ret; if (dpp->id >= ARRAY_SIZE(protection_ids)) { - dpp_err(dpp, "%s: failed to get protection id(%u)\n", __func__, - dpp->id); + dpp_err(dpp, "failed to get protection id(%u)\n", dpp->id); return -EINVAL; } protection_id = protection_ids[dpp->id]; @@ -407,14 +409,13 @@ static int set_protection(struct dpp_device *dpp, uint64_t modifier) (protection ? SMC_PROTECTION_ENABLE : SMC_PROTECTION_DISABLE)); if (ret) { - dpp_err(dpp, "%s: failed to %s protection(ch:%u, ret:%d)\n", - __func__, protection ? "enable" : "disable", - dpp->id, ret); + dpp_err(dpp, "failed to %s protection(ch:%u, ret:%d)\n", + protection ? "enable" : "disable", dpp->id, ret); return ret; } dpp->protection = protection; - dpp_debug(dpp, "%s: ch:%u, en:%d\n", __func__, dpp->id, protection); + dpp_debug(dpp, "ch:%u, en:%d\n", dpp->id, protection); return ret; } @@ -433,10 +434,10 @@ static void __dpp_disable(struct dpp_device *dpp) dpp_reg_deinit(dpp->id, false, dpp->attr); - dpp->hdr_state.eotf_lut = NULL; - dpp->hdr_state.oetf_lut = NULL; - dpp->hdr_state.gm = NULL; - dpp->hdr_state.tm = NULL; + dpp->hdr.state.eotf_lut = NULL; + dpp->hdr.state.oetf_lut = NULL; + dpp->hdr.state.gm = NULL; + dpp->hdr.state.tm = NULL; set_protection(dpp, 0); dpp->state = DPP_STATE_OFF; @@ -600,7 +601,7 @@ static int dpp_check(struct dpp_device *dpp, const struct drm_display_mode *mode = &crtc_state->adjusted_mode; const struct drm_framebuffer *fb = state->base.fb; - dpp_debug(dpp, "%s +\n", __func__); + dpp_debug(dpp, "+\n"); memset(&config, 0, sizeof(struct dpp_params_info)); @@ -634,7 +635,7 @@ static int dpp_check(struct dpp_device *dpp, if (__dpp_check(dpp->id, &config, dpp->attr)) goto err; - dpp_debug(dpp, "%s -\n", __func__); + dpp_debug(dpp, "-\n"); return 0; @@ -650,40 +651,109 @@ err: return -ENOTSUPP; } -static void dpp_hdr_update(struct dpp_device *dpp, - const struct exynos_drm_plane_state *state) +static void +exynos_eotf_update(struct dpp_device *dpp, struct exynos_drm_plane_state *state) { - bool enable = false; + struct eotf_debug_override *eotf = &dpp->hdr.eotf; + struct exynos_debug_info *info = &eotf->info; + + pr_debug("en(%d) dirty(%d)\n", info->force_en, info->dirty); - if (dpp->hdr_state.eotf_lut != state->hdr_state.eotf_lut) { + if (info->force_en) + state->hdr_state.eotf_lut = &eotf->force_lut; + + if (dpp->hdr.state.eotf_lut != state->hdr_state.eotf_lut || info->dirty) { hdr_reg_set_eotf_lut(dpp->id, state->hdr_state.eotf_lut); - dpp->hdr_state.eotf_lut = state->hdr_state.eotf_lut; + dpp->hdr.state.eotf_lut = state->hdr_state.eotf_lut; + info->dirty = false; } - if (dpp->hdr_state.oetf_lut != state->hdr_state.oetf_lut) { + if (info->verbose) + hdr_reg_print_eotf_lut(dpp->id); +} + +static void +exynos_oetf_update(struct dpp_device *dpp, struct exynos_drm_plane_state *state) +{ + struct oetf_debug_override *oetf = &dpp->hdr.oetf; + struct exynos_debug_info *info = &oetf->info; + + pr_debug("en(%d) dirty(%d)\n", info->force_en, info->dirty); + + if (info->force_en) + state->hdr_state.oetf_lut = &oetf->force_lut; + + if (dpp->hdr.state.oetf_lut != state->hdr_state.oetf_lut || info->dirty) { hdr_reg_set_oetf_lut(dpp->id, state->hdr_state.oetf_lut); - dpp->hdr_state.oetf_lut = state->hdr_state.oetf_lut; + dpp->hdr.state.oetf_lut = state->hdr_state.oetf_lut; + info->dirty = false; } - if (dpp->hdr_state.gm != state->hdr_state.gm) { + if (info->verbose) + hdr_reg_print_oetf_lut(dpp->id); +} + +static void +exynos_gm_update(struct dpp_device *dpp, struct exynos_drm_plane_state *state) +{ + struct gm_debug_override *gm = &dpp->hdr.gm; + struct exynos_debug_info *info = &gm->info; + + pr_debug("en(%d) dirty(%d)\n", info->force_en, info->dirty); + + if (info->force_en) + state->hdr_state.gm = &gm->force_data; + + if (dpp->hdr.state.gm != state->hdr_state.gm || info->dirty) { hdr_reg_set_gm(dpp->id, state->hdr_state.gm); - dpp->hdr_state.gm = state->hdr_state.gm; + dpp->hdr.state.gm = state->hdr_state.gm; + info->dirty = false; } - if (dpp->hdr_state.tm != state->hdr_state.tm) { + if (info->verbose) + hdr_reg_print_gm(dpp->id); +} + +static void +exynos_tm_update(struct dpp_device *dpp, struct exynos_drm_plane_state *state) +{ + struct tm_debug_override *tm = &dpp->hdr.tm; + struct exynos_debug_info *info = &tm->info; + + pr_debug("en(%d) dirty(%d)\n", info->force_en, info->dirty); + + if (info->force_en) + state->hdr_state.tm = &tm->force_data; + + if (dpp->hdr.state.tm != state->hdr_state.tm || info->dirty) { hdr_reg_set_tm(dpp->id, state->hdr_state.tm); - dpp->hdr_state.tm = state->hdr_state.tm; + dpp->hdr.state.tm = state->hdr_state.tm; + info->dirty = false; } - if (dpp->hdr_state.eotf_lut || dpp->hdr_state.oetf_lut || - dpp->hdr_state.gm || dpp->hdr_state.tm) + if (info->verbose) + hdr_reg_print_tm(dpp->id); +} + +static void dpp_hdr_update(struct dpp_device *dpp, + struct exynos_drm_plane_state *state) +{ + bool enable = false; + + exynos_eotf_update(dpp, state); + exynos_oetf_update(dpp, state); + exynos_gm_update(dpp, state); + exynos_tm_update(dpp, state); + + if (dpp->hdr.state.eotf_lut || dpp->hdr.state.oetf_lut || + dpp->hdr.state.gm || dpp->hdr.state.tm) enable = true; hdr_reg_set_hdr(dpp->id, enable); } static int dpp_update(struct dpp_device *dpp, - const struct exynos_drm_plane_state *state) + struct exynos_drm_plane_state *state) { struct dpp_params_info *config = &dpp->win_config; const struct drm_plane_state *plane_state = &state->base; @@ -692,7 +762,7 @@ static int dpp_update(struct dpp_device *dpp, const struct exynos_drm_crtc_state *exynos_crtc_state = to_exynos_crtc_state(crtc_state); - dpp_debug(dpp, "%s +\n", __func__); + dpp_debug(dpp, "+\n"); __dpp_enable(dpp); @@ -707,7 +777,7 @@ static int dpp_update(struct dpp_device *dpp, dpp_reg_configure_params(dpp->id, config, dpp->attr); - dpp_debug(dpp, "%s -\n", __func__); + dpp_debug(dpp, "-\n"); return 0; } @@ -720,7 +790,7 @@ static int dpp_bind(struct device *dev, struct device *master, void *data) int ret = 0; int id = dpp->id; - dpp_debug(dpp, "%s +\n", __func__); + dpp_debug(dpp, "+\n"); memset(&plane_config, 0, sizeof(plane_config)); @@ -739,7 +809,7 @@ static int dpp_bind(struct device *dev, struct device *master, void *data) if (ret) return ret; - dpp_debug(dpp, "%s -\n", __func__); + dpp_debug(dpp, "-\n"); return 0; } diff --git a/samsung/exynos_drm_dpp.h b/samsung/exynos_drm_dpp.h index 52d331c..640043e 100644 --- a/samsung/exynos_drm_dpp.h +++ b/samsung/exynos_drm_dpp.h @@ -19,6 +19,7 @@ #include <dpp_cal.h> #include "exynos_drm_drv.h" +#include "exynos_drm_dqe.h" enum EXYNOS9_DPP_FEATURES { /* Can reads the graphical image */ @@ -36,6 +37,35 @@ enum dpp_state { DPP_STATE_ON, }; +struct eotf_debug_override { + struct exynos_debug_info info; + struct hdr_eotf_lut force_lut; +}; + +struct oetf_debug_override { + struct exynos_debug_info info; + struct hdr_oetf_lut force_lut; +}; + +struct gm_debug_override { + struct exynos_debug_info info; + struct hdr_gm_data force_data; +}; + +struct tm_debug_override { + struct exynos_debug_info info; + struct hdr_tm_data force_data; +}; + +struct exynos_hdr { + struct exynos_hdr_state state; + + struct eotf_debug_override eotf; + struct oetf_debug_override oetf; + struct gm_debug_override gm; + struct tm_debug_override tm; +}; + struct dpp_device { struct device *dev; @@ -80,7 +110,7 @@ struct dpp_device { int (*check)(struct dpp_device *this_dpp, const struct exynos_drm_plane_state *state); int (*update)(struct dpp_device *this_dpp, - const struct exynos_drm_plane_state *state); + struct exynos_drm_plane_state *state); int (*disable)(struct dpp_device *this_dpp); /* @@ -90,7 +120,7 @@ struct dpp_device { dma_addr_t dbg_dma_addr; struct exynos_drm_plane plane; - struct exynos_hdr_state hdr_state; + struct exynos_hdr hdr; }; #ifdef CONFIG_OF diff --git a/samsung/exynos_drm_dqe.h b/samsung/exynos_drm_dqe.h index 8707480..f6787c1 100644 --- a/samsung/exynos_drm_dqe.h +++ b/samsung/exynos_drm_dqe.h @@ -15,6 +15,7 @@ #include <drm/samsung_drm.h> #include <dqe_cal.h> +#include <cal_config.h> struct decon_device; struct exynos_dqe; @@ -47,11 +48,6 @@ struct dither_debug_override { struct dither_config val; }; -enum elem_size { - ELEM_SIZE_16 = 16, - ELEM_SIZE_32 = 32, -}; - #define MAX_NAME_SIZE 32 struct debugfs_lut { void *lut_ptr; diff --git a/samsung/exynos_drm_drv.h b/samsung/exynos_drm_drv.h index fc14885..5044a43 100644 --- a/samsung/exynos_drm_drv.h +++ b/samsung/exynos_drm_drv.h @@ -150,6 +150,7 @@ to_exynos_plane_state(const struct drm_plane_state *state) struct exynos_drm_plane { struct drm_plane base; unsigned int index; + struct dentry *debugfs_entry; struct { struct drm_property *restriction; diff --git a/samsung/exynos_drm_plane.c b/samsung/exynos_drm_plane.c index 7a8d6aa..c70d93e 100644 --- a/samsung/exynos_drm_plane.c +++ b/samsung/exynos_drm_plane.c @@ -321,16 +321,24 @@ static void exynos_drm_plane_print_state(struct drm_printer *p, } } +static int exynos_drm_plane_late_register(struct drm_plane *plane) +{ + struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); + + return exynos_drm_debugfs_plane_add(exynos_plane); +} + static struct drm_plane_funcs exynos_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = drm_plane_cleanup, - .reset = exynos_drm_plane_reset, - .atomic_duplicate_state = exynos_drm_plane_duplicate_state, - .atomic_destroy_state = exynos_drm_plane_destroy_state, - .atomic_set_property = exynos_drm_plane_set_property, - .atomic_get_property = exynos_drm_plane_get_property, - .atomic_print_state = exynos_drm_plane_print_state, + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = drm_plane_cleanup, + .reset = exynos_drm_plane_reset, + .atomic_duplicate_state = exynos_drm_plane_duplicate_state, + .atomic_destroy_state = exynos_drm_plane_destroy_state, + .atomic_set_property = exynos_drm_plane_set_property, + .atomic_get_property = exynos_drm_plane_get_property, + .atomic_print_state = exynos_drm_plane_print_state, + .late_register = exynos_drm_plane_late_register, }; static int diff --git a/samsung/exynos_drm_plane.h b/samsung/exynos_drm_plane.h index 3bb9bcd..92e8500 100644 --- a/samsung/exynos_drm_plane.h +++ b/samsung/exynos_drm_plane.h @@ -58,5 +58,6 @@ enum { int exynos_plane_init(struct drm_device *dev, struct exynos_drm_plane *exynos_plane, unsigned int index, const struct exynos_drm_plane_config *config); +int exynos_drm_debugfs_plane_add(struct exynos_drm_plane *exynos_plane); #endif /* __EXYNOS_DRM_PLANE_H__ */ |