DV: playback bl+el black screen [1/1]
authoryao liu <yao.liu@amlogic.com>
Tue, 4 Jun 2019 14:22:58 +0000 (22:22 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 6 Jun 2019 05:21:46 +0000 (22:21 -0700)
PD#SWPL-7872

Problem:
TM2 special case , vd2 afbc can't work on TM2

Solution:
Process bl+el as SDR on TM2

Verify:
T962e2

Change-Id: I2433b72c4b5548e75665aba9623a29cd5f12d202
Signed-off-by: yao liu <yao.liu@amlogic.com>
drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c
drivers/amlogic/media/video_sink/video.c
include/linux/amlogic/media/amdolbyvision/dolby_vision.h

index d4ed4fc..0bd98c4 100644 (file)
@@ -198,6 +198,7 @@ static u32 last_dolby_vision_ll_policy = DOLBY_VISION_LL_DISABLE;
 #endif
 
 static uint dolby_vision_on_count;
+static bool dolby_vision_el_disable;
 
 #define FLAG_FORCE_CVM                         0x01
 #define FLAG_BYPASS_CVM                                0x02
@@ -220,6 +221,7 @@ static uint dolby_vision_on_count;
 #define FLAG_PRIORITY_GRAPHIC   0x200000
 #define FLAG_DISABLE_LOAD_VSVDB         0x400000
 #define FLAG_DISABLE_CRC        0x800000
+#define FLAG_ENABLE_EL          0x1000000
 #define FLAG_TOGGLE_FRAME                      0x80000000
 
 #define FLAG_FRAME_DELAY_MASK  0xf
@@ -1905,7 +1907,7 @@ static int dolby_core1_set(
                if (is_meson_g12() || is_meson_tm2_stbmode())
                        VSYNC_WR_DV_REG_BITS(
                                DOLBY_PATH_CTRL,
-                               /* vd2 to core1 */
+                               /* vd2 to vpp */
                                1, 1, 1);
                else
                        VSYNC_WR_DV_REG_BITS(
@@ -3501,6 +3503,7 @@ static int dvel_receiver_event_fun(int type, void *data, void *arg)
                setting_update_count = 0;
                crc_count = 0;
                crc_bypass_count = 0;
+               dolby_vision_el_disable = 0;
                return -1;
        } else if (type == VFRAME_EVENT_PROVIDER_QUREY_STATE) {
                return RECEIVER_ACTIVE;
@@ -3519,6 +3522,7 @@ static int dvel_receiver_event_fun(int type, void *data, void *arg)
                setting_update_count = 0;
                crc_count = 0;
                crc_bypass_count = 0;
+               dolby_vision_el_disable = 0;
        }
        return 0;
 }
@@ -5188,6 +5192,17 @@ int dolby_vision_parse_metadata(
                                src_bdp = 10;
                                bypass_release = true;
                        }
+                       if (is_meson_tm2_stbmode() &&
+                               (req.dv_enhance_exist && !mel_flag &&
+                               ((dolby_vision_flags & FLAG_CERTIFICAION)
+                                       == 0))) {
+                               src_format = FORMAT_SDR;
+                               dovi_setting.src_format = src_format;
+                               total_comp_size = 0;
+                               total_md_size = 0;
+                               src_bdp = 10;
+                               bypass_release = true;
+                       }
                } else if (is_dolby_vision_stb_mode())
                        src_format = dovi_setting.src_format;
                else if (is_meson_tvmode())
@@ -5320,6 +5335,14 @@ int dolby_vision_parse_metadata(
                                el_flag, mel_flag);
                        meta_flag_bl = 0;
                }
+
+               if (is_meson_tm2_stbmode() &&
+                       (el_flag && !mel_flag &&
+                       ((dolby_vision_flags & FLAG_CERTIFICAION) == 0))) {
+                       el_flag = 0;
+                       dolby_vision_el_disable = 1;
+               }
+
                if ((src_format == FORMAT_DOVI)
                && meta_flag_bl && meta_flag_el) {
                        /* dovi frame no meta or meta error */
@@ -6436,6 +6459,12 @@ bool is_dolby_vision_stb_mode(void)
 }
 EXPORT_SYMBOL(is_dolby_vision_stb_mode);
 
+bool is_dolby_vision_el_disable(void)
+{
+       return dolby_vision_el_disable;
+}
+EXPORT_SYMBOL(is_dolby_vision_el_disable);
+
 int register_dv_functions(const struct dolby_vision_func_s *func)
 {
        int ret = -1;
index ecd9e75..217696e 100644 (file)
@@ -3117,7 +3117,7 @@ static void pip_toggle_frame(struct vframe_s *vf)
        if (debug_flag & DEBUG_FLAG_PRINT_TOGGLE_FRAME)
                pr_info("%s()\n", __func__);
 
-       if ((vf->width == 0) && (vf->height == 0)) {
+       if ((vf->width == 0) || (vf->height == 0)) {
                amlog_level(LOG_LEVEL_ERROR,
                        "Video: invalid frame dimension\n");
                return;
@@ -3583,6 +3583,10 @@ bool has_enhanced_layer(struct vframe_s *vf)
 {
        struct provider_aux_req_s req;
 
+       if (is_dolby_vision_el_disable() &&
+               !for_dolby_vision_certification())
+               return 0;
+
        if (!vf)
                return 0;
        if (vf->source_type != VFRAME_SOURCE_TYPE_OTHERS)
@@ -5844,7 +5848,8 @@ struct vframe_s *dolby_vision_toggle_frame(struct vframe_s *vf)
        int height_bl, height_el;
        int ret = dolby_vision_update_metadata(vf);
 
-       cur_dispbuf2 = dolby_vision_vf_peek_el(vf);
+       if (!is_dolby_vision_el_disable() || for_dolby_vision_certification())
+               cur_dispbuf2 = dolby_vision_vf_peek_el(vf);
        if (cur_dispbuf2) {
                if (cur_dispbuf2->type & VIDTYPE_COMPRESS) {
                        VSYNC_WR_MPEG_REG(VD2_AFBC_HEAD_BADDR,
@@ -7941,7 +7946,9 @@ SET_FILTER:
                        video2_onoff_state = VIDEO_ENABLE_STATE_ON_PENDING;
                } else if (video2_onoff_state ==
                        VIDEO_ENABLE_STATE_ON_PENDING) {
-                       if (is_dolby_vision_on())
+                       if (is_dolby_vision_on() &&
+                               (!is_dolby_vision_el_disable() ||
+                               for_dolby_vision_certification()))
                                vpp_misc_set &= ~(VPP_VD2_PREBLEND |
                                        VPP_VD2_POSTBLEND | VPP_PREBLEND_EN);
                        else if (process_3d_type ||
index 59ba523..da2be09 100644 (file)
@@ -75,5 +75,5 @@ extern int enable_rgb_to_yuv_matrix_for_dvll(
 extern bool is_dovi_frame(struct vframe_s *vf);
 extern void update_graphic_width_height(unsigned int width,
        unsigned int height);
-
+extern bool is_dolby_vision_el_disable(void);
 #endif