From f2efc4b40628958949dbcd84add42d633dafcd2a Mon Sep 17 00:00:00 2001 From: Yong Qin Date: Mon, 1 Jul 2019 17:19:26 +0800 Subject: [PATCH] vdin: add hdr10 pluse data in vframe [1/1] PD#SWPL-9849 Problem: add hdr10 pkt data into vframe structure Solution: according to hdmi rx hdr10p_on flag, copy hdr10p data from hdmirx to vframe Verify: tl1 Change-Id: I4d3bcbcce4d1303a5e5d4cf57a7777e4fd1fd54c Signed-off-by: Yong Qin --- drivers/amlogic/media/vin/tvin/tvin_global.h | 41 ------------ .../amlogic/media/vin/tvin/vdin/vdin_ctl.c | 28 ++++++++ .../amlogic/media/vin/tvin/vdin/vdin_drv.h | 2 +- include/linux/amlogic/media/vfm/vframe.h | 66 +++++++++++++++---- 4 files changed, 83 insertions(+), 54 deletions(-) diff --git a/drivers/amlogic/media/vin/tvin/tvin_global.h b/drivers/amlogic/media/vin/tvin/tvin_global.h index d4eb45032237..ed143f507471 100644 --- a/drivers/amlogic/media/vin/tvin/tvin_global.h +++ b/drivers/amlogic/media/vin/tvin/tvin_global.h @@ -448,47 +448,6 @@ struct tvin_hdr_info_s { unsigned int hdr_check_cnt; }; -struct tvin_hdr10p_data_s { - uint32_t vsif_hb; - uint32_t vsif_ieee_code; - struct pb4_st { - uint8_t rvd:1; - uint8_t max_lumin:5; - uint8_t app_ver:2; - } __packed pb4_st; - uint8_t average_maxrgb; - uint8_t distrib_valus0; - uint8_t distrib_valus1; - uint8_t distrib_valus2; - uint8_t distrib_valus3; - uint8_t distrib_valus4; - uint8_t distrib_valus5; - uint8_t distrib_valus6; - uint8_t distrib_valus7; - uint8_t distrib_valus8; - struct pb15_18_st { - uint32_t knee_point_x_9_6:4; - uint32_t num_bezier_curve_anchors:4; - uint32_t knee_point_y_9_8:2; - uint32_t knee_point_x_5_0:6; - uint32_t knee_point_y_7_0:8; - uint32_t bezier_curve_anchors0:8; - } __packed pb15_18_st; - uint8_t bezier_curve_anchors1; - uint8_t bezier_curve_anchors2; - uint8_t bezier_curve_anchors3; - uint8_t bezier_curve_anchors4; - uint8_t bezier_curve_anchors5; - uint8_t bezier_curve_anchors6; - uint8_t bezier_curve_anchors7; - uint8_t bezier_curve_anchors8; - struct pb27_st { - uint8_t rvd:6; - uint8_t no_delay_flag:1; - uint8_t overlay_flag:1; - } __packed pb27_st; -} __packed; - struct tvin_hdr10plus_info_s { bool hdr10p_on; struct tvin_hdr10p_data_s hdr10p_data; diff --git a/drivers/amlogic/media/vin/tvin/vdin/vdin_ctl.c b/drivers/amlogic/media/vin/tvin/vdin/vdin_ctl.c index 4edd7ad97dcb..eee7fe914bd5 100644 --- a/drivers/amlogic/media/vin/tvin/vdin/vdin_ctl.c +++ b/drivers/amlogic/media/vin/tvin/vdin/vdin_ctl.c @@ -4245,6 +4245,29 @@ static int vdin_hdr_sei_error_check(struct vdin_dev_s *devp) return 0; } +void vdin_hdr10plus_check(struct vdin_dev_s *devp, + struct vframe_s *vf) { + + if (devp->prop.hdr10p_info.hdr10p_on) { + devp->prop.hdr10p_info.hdr10p_on = false; + + vf->signal_type |= (1 << 29);/*present_flag*/ + vf->signal_type |= (0 << 25);/*0:limited*/ + /*color_primaries*/ + vf->signal_type = ((9 << 16) | + (vf->signal_type & (~0xFF0000))); + /*transfer_characteristic*/ + vf->signal_type = ((0x30 << 8) | + (vf->signal_type & (~0xFF00))); + /*matrix_coefficient*/ + vf->signal_type = ((9 << 0) | + (vf->signal_type & (~0xFF))); + memcpy(&vf->prop.hdr10p_data, + &devp->prop.hdr10p_info.hdr10p_data, + sizeof(struct tvin_hdr10p_data_s)); + } +} + void vdin_set_drm_data(struct vdin_dev_s *devp, struct vframe_s *vf) { @@ -4332,8 +4355,13 @@ void vdin_set_drm_data(struct vdin_dev_s *devp, vf->signal_type = ((1 << 8) | (vf->signal_type & (~0xFF00))); } + + devp->parm.info.signal_type = vf->signal_type; + /*hdr10+ check*/ + vdin_hdr10plus_check(devp, vf); } + void vdin_check_hdmi_hdr(struct vdin_dev_s *devp) { struct tvin_state_machine_ops_s *sm_ops; diff --git a/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h b/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h index a95ffe8b31a0..2658af937c44 100644 --- a/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h +++ b/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h @@ -48,7 +48,7 @@ /* Ref.2019/04/25: tl1 vdin0 afbce dynamically switch support, * vpp also should support this function */ -#define VDIN_VER "Ref.2019/07/08-add dv ll mode" +#define VDIN_VER "Ref.2019/07/19:vf add hdr10 plus data" /*the counter of vdin*/ #define VDIN_MAX_DEVS 2 diff --git a/include/linux/amlogic/media/vfm/vframe.h b/include/linux/amlogic/media/vfm/vframe.h index 6caff7d8ea4d..468c1c85579e 100644 --- a/include/linux/amlogic/media/vfm/vframe.h +++ b/include/linux/amlogic/media/vfm/vframe.h @@ -116,6 +116,59 @@ struct vframe_hist_s { #endif } /*vframe_hist_t */; +struct tvin_hdr10p_data_s { + uint32_t vsif_hb; + uint32_t vsif_ieee_code; + struct pb4_st { + uint8_t rvd:1; + uint8_t max_lumin:5; + uint8_t app_ver:2; + } __packed pb4_st; + uint8_t average_maxrgb; + uint8_t distrib_valus0; + uint8_t distrib_valus1; + uint8_t distrib_valus2; + uint8_t distrib_valus3; + uint8_t distrib_valus4; + uint8_t distrib_valus5; + uint8_t distrib_valus6; + uint8_t distrib_valus7; + uint8_t distrib_valus8; + struct pb15_18_st { + uint32_t knee_point_x_9_6:4; + uint32_t num_bezier_curve_anchors:4; + uint32_t knee_point_y_9_8:2; + uint32_t knee_point_x_5_0:6; + uint32_t knee_point_y_7_0:8; + uint32_t bezier_curve_anchors0:8; + } __packed pb15_18_st; + uint8_t bezier_curve_anchors1; + uint8_t bezier_curve_anchors2; + uint8_t bezier_curve_anchors3; + uint8_t bezier_curve_anchors4; + uint8_t bezier_curve_anchors5; + uint8_t bezier_curve_anchors6; + uint8_t bezier_curve_anchors7; + uint8_t bezier_curve_anchors8; + struct pb27_st { + uint8_t rvd:6; + uint8_t no_delay_flag:1; + uint8_t overlay_flag:1; + } __packed pb27_st; +} __packed; + +/*vdin dolby vsi info param*/ +struct tvin_dv_vsif_s { + uint8_t dobly_vision_signal:1; + uint8_t backlt_ctrl_MD_present:1; + uint8_t auxiliary_MD_present:1; + uint8_t eff_tmax_PQ_hi; + uint8_t eff_tmax_PQ_low; + uint8_t auxiliary_runmode; + uint8_t auxiliary_runversion; + uint8_t auxiliary_debug0; +}; + /* * If bottom == 0 or right == 0, then all Blackbar information are invalid */ @@ -222,6 +275,7 @@ struct vframe_prop_s { struct vframe_meas_s meas; struct vframe_master_display_colour_s master_display_colour; + struct tvin_hdr10p_data_s hdr10p_data; } /*vframe_prop_t */; struct vdisplay_info_s { @@ -283,18 +337,6 @@ struct vframe_pic_mode_s { enum pic_mode_provider_e provider; }; -/*vdin dolby vsi info param*/ -struct tvin_dv_vsif_s { - uint8_t dobly_vision_signal:1; - uint8_t backlt_ctrl_MD_present:1; - uint8_t auxiliary_MD_present:1; - uint8_t eff_tmax_PQ_hi; - uint8_t eff_tmax_PQ_low; - uint8_t auxiliary_runmode; - uint8_t auxiliary_runversion; - uint8_t auxiliary_debug0; -}; - #define BITDEPTH_Y_SHIFT 8 #define BITDEPTH_Y8 (0 << BITDEPTH_Y_SHIFT) #define BITDEPTH_Y9 (1 << BITDEPTH_Y_SHIFT)