vdin: add hdr10 pluse data in vframe [1/1]
authorYong Qin <yong.qin@amlogic.com>
Mon, 1 Jul 2019 09:19:26 +0000 (17:19 +0800)
committerYong Qin <yong.qin@amlogic.com>
Fri, 19 Jul 2019 09:32:36 +0000 (17:32 +0800)
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 <yong.qin@amlogic.com>
drivers/amlogic/media/vin/tvin/tvin_global.h
drivers/amlogic/media/vin/tvin/vdin/vdin_ctl.c
drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h
include/linux/amlogic/media/vfm/vframe.h

index 409d070..25adb68 100644 (file)
@@ -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;
index b1d5b4b..67625e0 100644 (file)
@@ -4217,6 +4217,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)
 {
@@ -4306,8 +4329,11 @@ void vdin_set_drm_data(struct vdin_dev_s *devp,
        }
 
        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;
index e9070a9..9da8940 100644 (file)
@@ -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
index 19e4d82..7dbf432 100644 (file)
@@ -115,6 +115,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
  */
@@ -172,6 +225,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 {
@@ -233,18 +287,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)