drm/msm/dpu: add support for dither block in display
PATCH v2 1/1 drm/msm/dpu: add support for dither block in display
This change enables dither block for primary interface in display.
Enabled for 6bpc in the current version.
Changes in v1:
- Remove redundant error checks (Rob).
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 39 +++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 63 +++++++++++++++++++++---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 28 +++++++++++ 3 files changed, 121 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +39 -0
@@ -208,6 +208,36 @@ struct dpu_encoder_virt {#define to_dpu_encoder_virt (x) container_of(x, struct dpu_encoder_virt, base) +static u32 dither_matrix[DITHER_MATRIX_SZ ] = { +15 ,7 ,13 ,5 ,3 ,11 ,1 ,9 ,12 ,4 ,14 ,6 ,0 ,8 ,2 ,10 +}; + +static void _dpu_encoder_setup_dither (struct dpu_encoder_phys *phys) +{ +struct dpu_hw_dither_cfg dither_cfg = {0 }; + +if (!phys->hw_pp || !phys->hw_pp->ops.setup_dither) +return ; + +switch (phys->connector->display_info.bpc) { +case 6 : + dither_cfg.c0_bitdepth =6 ; + dither_cfg.c1_bitdepth =6 ; + dither_cfg.c2_bitdepth =6 ; + dither_cfg.c3_bitdepth =6 ; + dither_cfg.temporal_en =0 ; +break ; +default : + phys->hw_pp->ops.setup_dither (phys->hw_pp,NULL ); +return ; + } + +memcpy (&dither_cfg.matrix, dither_matrix, +sizeof (u32) *DITHER_MATRIX_SZ ); + + phys->hw_pp->ops.setup_dither (phys->hw_pp, &dither_cfg); +} +void dpu_encoder_helper_report_irq_timeout (struct dpu_encoder_phys *phys_enc,enum dpu_intr_idx intr_idx) {
@@ -1082,6 +1112,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc)struct dpu_encoder_virt *dpu_enc =NULL ;struct msm_drm_private *priv;struct dpu_kms *dpu_kms; +int i;if (!drm_enc || !drm_enc->dev) {DPU_ERROR ("invalid parameters\n" );
@@ -1104,6 +1135,14 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) dpu_kms->catalog);_dpu_encoder_update_vsync_source (dpu_enc, &dpu_enc->disp_info); + +if (dpu_enc->disp_info.intf_type ==DRM_MODE_ENCODER_DSI ) { +for (i =0 ; i < dpu_enc->num_phys_encs; i++) { +struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; + +_dpu_encoder_setup_dither (phys); + } + } }void dpu_encoder_virt_runtime_resume (struct drm_encoder *drm_enc)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +54 -9
88 lines not on this page · raw message
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h +28 -0
@@ -10,6 +10,8 @@#include "dpu_hw_util.h" #include "dpu_hw_blk.h" +#define DITHER_MATRIX_SZ 16 +struct dpu_hw_pingpong ;struct dpu_hw_tear_check {
@@ -35,6 +37,26 @@ struct dpu_hw_pp_vsync_info { };/** +* struct dpu_hw_dither_cfg - dither feature structure +* @flags: for customizing operations +* @temporal_en: temperal dither enable +* @c0_bitdepth: c0 component bit depth +* @c1_bitdepth: c1 component bit depth +* @c2_bitdepth: c2 component bit depth +* @c3_bitdepth: c2 component bit depth +* @matrix: dither strength matrix +*/ +struct dpu_hw_dither_cfg { +u64 flags; +u32 temporal_en; +u32 c0_bitdepth; +u32 c1_bitdepth; +u32 c2_bitdepth; +u32 c3_bitdepth; +u32 matrix[DITHER_MATRIX_SZ ]; +}; + +/** * * struct dpu_hw_pingpong_ops : Interface to the pingpong Hw driver functions * Assumption is these functions will be called after clocks are enabled
@@ -82,6 +104,12 @@ struct dpu_hw_pingpong_ops {* Obtain current vertical line counter */ u32 (*get_line_count)(struct dpu_hw_pingpong *pp); + +/** +* Setup dither matix for pingpong block +*/ +void (*setup_dither)(struct dpu_hw_pingpong *pp, +struct dpu_hw_dither_cfg *cfg); };struct dpu_hw_pingpong {
Signature · 1 line
1.9.1
Hi,
Quoted 9 lines · Kalyan Thota
This change enables dither block for primary interface in display.
Enabled for 6bpc in the current version.
Changes in v1:
- Remove redundant error checks (Rob).
Quoted 6 lines
Signed-off-by Kalyan Thota <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 39 +++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 63 +++++++++++++++++++++---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 28 +++++++++++ 3 files changed, 121 insertions(+), 9 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Kristian Kristensen
Tested-byYes, this is a big improvement for the display I have here. Thanks Kalyan.
Quoted 21 lines · Doug Anderson
Hi,
Quoted 9 lines · Kalyan Thota
This change enables dither block for primary interface in display.
Enabled for 6bpc in the current version.
Changes in v1:
- Remove redundant error checks (Rob).Quoted 6 lines
Signed-off-by Kalyan Thota <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 39 +++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 63 +++++++++++++++++++++---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 28 +++++++++++ 3 files changed, 121 insertions(+), 9 deletions(-)Tested-by Douglas Anderson <[email protected]>