module_param(dolby_vision_mode, uint, 0664);
MODULE_PARM_DESC(dolby_vision_mode, "\n dolby_vision_mode\n");
+static unsigned int dolby_vision_target_mode = DOLBY_VISION_OUTPUT_MODE_BYPASS;
+module_param(dolby_vision_target_mode, uint, 0444);
+MODULE_PARM_DESC(dolby_vision_target_mode, "\n dolby_vision_target_mode\n");
+
static unsigned int dolby_vision_profile = 0xff;
module_param(dolby_vision_profile, uint, 0664);
MODULE_PARM_DESC(dolby_vision_profile, "\n dolby_vision_profile\n");
dolby_vision_wait_init = false;
dolby_vision_wait_count = 0;
dolby_vision_status = BYPASS_PROCESS;
+ dolby_vision_target_mode = DOLBY_VISION_OUTPUT_MODE_BYPASS;
dolby_vision_mode = DOLBY_VISION_OUTPUT_MODE_BYPASS;
dolby_vision_src_format = 0;
dolby_vision_on_count = 0;
mode = dolby_vision_mode;
if (dolby_vision_policy_process(
&mode, FORMAT_MVC)) {
- if ((mode == DOLBY_VISION_OUTPUT_MODE_BYPASS) &&
- (dolby_vision_mode !=
+ if ((mode != DOLBY_VISION_OUTPUT_MODE_BYPASS) &&
+ (dolby_vision_mode ==
DOLBY_VISION_OUTPUT_MODE_BYPASS))
dolby_vision_wait_on = true;
+ dolby_vision_target_mode = mode;
return 1;
}
}
&& (dolby_vision_mode ==
DOLBY_VISION_OUTPUT_MODE_BYPASS))
dolby_vision_wait_on = true;
+ dolby_vision_target_mode = mode;
return 1;
}
}
&& (dolby_vision_mode ==
DOLBY_VISION_OUTPUT_MODE_BYPASS))
dolby_vision_wait_on = true;
+ dolby_vision_target_mode = mode;
return 1;
}
}
&& (dolby_vision_mode ==
DOLBY_VISION_OUTPUT_MODE_BYPASS))
dolby_vision_wait_on = true;
+ dolby_vision_target_mode = mode;
return 1;
}
}
dolby_vision_set_toggle_flag(1);
pr_info("[dolby_vision_parse_metadata] output change from %d to %d\n",
dolby_vision_mode, current_mode);
+ dolby_vision_target_mode = current_mode;
dolby_vision_mode = current_mode;
if (is_dolby_vision_stb_mode())
new_dovi_setting.mode_changed = 1;
dolby_vision_wait_init = true;
dolby_vision_wait_count =
dolby_vision_wait_delay;
+ dolby_vision_target_mode = mode;
dolby_vision_wait_on = true;
pr_dolby_dbg("dolby_vision_need_wait src=%d mode=%d\n",
check_format, mode);
int graphic_status = 0;
int policy_changed = 0;
int sink_changed = 0;
+ int format_changed = 0;
if (!is_meson_box() && !is_meson_txlx() && !is_meson_tm2())
return -1;
/* rpt_vf = NULL; */
}
+ if (dolby_vision_mode != dolby_vision_target_mode)
+ format_changed = 1;
+
graphic_status = is_graphic_changed();
/* monitor policy changes */
policy_changed = is_policy_changed();
- if (policy_changed)
- dolby_vision_set_toggle_flag(1);
-
- if (graphic_status & 2)
+ if (policy_changed || format_changed || (graphic_status & 2))
dolby_vision_set_toggle_flag(1);
if (!is_dolby_vision_on())
sink_changed = (is_sink_cap_changed(vinfo,
¤t_hdr_cap, ¤t_sink_available) & 2) ? 1 : 0;
- if (sink_changed || policy_changed ||
+ if (sink_changed || policy_changed || format_changed ||
(video_status == 1) || (graphic_status & 2) ||
(dolby_vision_flags & FLAG_FORCE_HDMI_PKT)) {
u8 toggle_mode;
pr_dolby_dbg("Fake SDR, mode->%d\n", mode);
if (dolby_vision_policy == DOLBY_VISION_FOLLOW_SOURCE &&
mode == DOLBY_VISION_OUTPUT_MODE_BYPASS) {
+ dolby_vision_target_mode =
+ DOLBY_VISION_OUTPUT_MODE_BYPASS;
dolby_vision_mode =
DOLBY_VISION_OUTPUT_MODE_BYPASS;
dolby_vision_set_toggle_flag(0);
dolby_vision_wait_on = true;
pr_info("DOVI output change from %d to %d\n",
dolby_vision_mode, mode);
+ dolby_vision_target_mode = mode;
dolby_vision_mode = mode;
}
}
}
EXPORT_SYMBOL(get_dolby_vision_mode);
+int get_dolby_vision_target_mode(void)
+{
+ return dolby_vision_target_mode;
+}
+EXPORT_SYMBOL(get_dolby_vision_target_mode);
+
bool is_dolby_vision_enable(void)
{
return dolby_vision_enable;
/* sync hdr_policy with dolby_vision_policy */
/* get current dolby_vision_mode */
dv_policy = get_dolby_vision_policy();
- dv_mode = get_dolby_vision_mode();
+ dv_mode = get_dolby_vision_target_mode();
if ((dv_policy != DOLBY_VISION_FORCE_OUTPUT_MODE) ||
(dv_mode != DOLBY_VISION_OUTPUT_MODE_BYPASS)) {
/* use dv policy when not force bypass */
/* sync hdr_policy with dolby_vision_policy */
/* get current dolby_vision_mode */
dv_policy = get_dolby_vision_policy();
- dv_mode = get_dolby_vision_mode();
+ dv_mode = get_dolby_vision_target_mode();
dv_format = get_dolby_vision_src_format();
}
} else if (hdr_process_select == SDR_IPT) {
for (i = 0; i < HDR2_OETF_LUT_SIZE; i++) {
hdr_lut_param.oetf_lut[i] = oe_y_lut_hdr[i];
- output_mode = get_dolby_vision_mode();
+ output_mode = get_dolby_vision_target_mode();
if (output_mode == DOLBY_VISION_OUTPUT_MODE_SDR10 ||
output_mode == DOLBY_VISION_OUTPUT_MODE_SDR8)
hdr_lut_param.ogain_lut[i] =
- oo_y_lut_sdr_hdr_250[i];
+ 512 * 80 / 10000;
+ /* oo_y_lut_sdr_hdr_250[i]; */
else if (output_mode == DOLBY_VISION_OUTPUT_MODE_HDR10)
hdr_lut_param.ogain_lut[i] =
oo_y_lut_sdr_hdr_250[i];
for (i = 0; i < HDR2_OETF_LUT_SIZE; i++) {
hdr_lut_param.oetf_lut[i] = oe_y_lut_hdr[i];
// hdr_lut_param.ogain_lut[i] = oo_y_lut_bypass[i];
- output_mode = get_dolby_vision_mode();
+ output_mode = get_dolby_vision_target_mode();
if (output_mode == DOLBY_VISION_OUTPUT_MODE_SDR10 ||
output_mode == DOLBY_VISION_OUTPUT_MODE_SDR8)
hdr_lut_param.ogain_lut[i] =
} else if (hdr_process_select == HDR_IPT) {
for (i = 0; i < HDR2_OETF_LUT_SIZE; i++) {
hdr_lut_param.oetf_lut[i] = oe_y_lut_hdr[i];
- output_mode = get_dolby_vision_mode();
+ output_mode = get_dolby_vision_target_mode();
if (output_mode == DOLBY_VISION_OUTPUT_MODE_SDR10 ||
output_mode == DOLBY_VISION_OUTPUT_MODE_SDR8)
hdr_lut_param.ogain_lut[i] =
#define MUTE_TYPE_RGB 2
#define MUTE_TYPE_IPT 3
-extern void enable_dolby_vision(int enable);
-extern bool is_dolby_vision_enable(void);
-extern bool is_dolby_vision_on(void);
-extern bool is_dolby_vision_video_on(void);
-extern bool for_dolby_vision_certification(void);
-extern void set_dolby_vision_mode(int mode);
-extern int get_dolby_vision_mode(void);
-extern void dolby_vision_set_toggle_flag(int flag);
-extern int dolby_vision_wait_metadata(struct vframe_s *vf);
-extern int dolby_vision_pop_metadata(void);
+void enable_dolby_vision(int enable);
+bool is_dolby_vision_enable(void);
+bool is_dolby_vision_on(void);
+bool is_dolby_vision_video_on(void);
+bool for_dolby_vision_certification(void);
+void set_dolby_vision_mode(int mode);
+int get_dolby_vision_mode(void);
+int get_dolby_vision_target_mode(void);
+void dolby_vision_set_toggle_flag(int flag);
+int dolby_vision_wait_metadata(struct vframe_s *vf);
+int dolby_vision_pop_metadata(void);
int dolby_vision_update_metadata(struct vframe_s *vf, bool drop_flag);
int dolby_vision_process(
struct vframe_s *rpt_vf, struct vframe_s *vf,
u32 display_size, u8 pps_state);
-extern void dolby_vision_init_receiver(void *pdev);
-extern void dolby_vision_vf_put(struct vframe_s *vf);
-extern struct vframe_s *dolby_vision_vf_peek_el(struct vframe_s *vf);
-extern void dolby_vision_dump_setting(int debug_flag);
-extern void dolby_vision_dump_struct(void);
-extern void enable_osd_path(int on, int shadow_mode);
-extern void tv_dolby_vision_config(int config);
-extern void dolby_vision_update_pq_config(
+void dolby_vision_init_receiver(void *pdev);
+void dolby_vision_vf_put(struct vframe_s *vf);
+struct vframe_s *dolby_vision_vf_peek_el(struct vframe_s *vf);
+void dolby_vision_dump_setting(int debug_flag);
+void dolby_vision_dump_struct(void);
+void enable_osd_path(int on, int shadow_mode);
+void tv_dolby_vision_config(int config);
+void dolby_vision_update_pq_config(
char *pq_config_buf);
-extern int dolby_vision_update_setting(void);
-extern bool is_dolby_vision_stb_mode(void);
-extern bool is_meson_g12(void);
-extern bool is_meson_gxm(void);
-extern bool is_meson_box(void);
-extern bool is_meson_txlx(void);
-extern bool is_meson_txlx_tvmode(void);
-extern bool is_meson_txlx_stbmode(void);
-extern bool is_meson_tm2(void);
-extern bool is_meson_tm2_tvmode(void);
-extern bool is_meson_tm2_stbmode(void);
-extern bool is_meson_tvmode(void);
-extern void tv_dolby_vision_crc_clear(int flag);
-extern char *tv_dolby_vision_get_crc(u32 *len);
-extern void tv_dolby_vision_insert_crc(bool print);
-extern int dolby_vision_check_hdr10(struct vframe_s *vf);
-extern int dolby_vision_check_hlg(struct vframe_s *vf);
-extern int dolby_vision_check_hdr10plus(struct vframe_s *vf);
-extern void tv_dolby_vision_dma_table_modify(
+int dolby_vision_update_setting(void);
+bool is_dolby_vision_stb_mode(void);
+bool is_meson_g12(void);
+bool is_meson_gxm(void);
+bool is_meson_box(void);
+bool is_meson_txlx(void);
+bool is_meson_txlx_tvmode(void);
+bool is_meson_txlx_stbmode(void);
+bool is_meson_tm2(void);
+bool is_meson_tm2_tvmode(void);
+bool is_meson_tm2_stbmode(void);
+bool is_meson_tvmode(void);
+void tv_dolby_vision_crc_clear(int flag);
+char *tv_dolby_vision_get_crc(u32 *len);
+void tv_dolby_vision_insert_crc(bool print);
+int dolby_vision_check_hdr10(struct vframe_s *vf);
+int dolby_vision_check_hlg(struct vframe_s *vf);
+int dolby_vision_check_hdr10plus(struct vframe_s *vf);
+void tv_dolby_vision_dma_table_modify(
u32 tbl_id, uint64_t value);
-extern void tv_dolby_vision_efuse_info(void);
-extern int dolby_vision_parse_metadata(
+void tv_dolby_vision_efuse_info(void);
+int dolby_vision_parse_metadata(
struct vframe_s *vf, u8 toggle_mode,
bool bypass_release, bool drop_flag);
-extern void dolby_vision_update_vsvdb_config(
+void dolby_vision_update_vsvdb_config(
char *vsvdb_buf, u32 tbl_size);
-extern void tv_dolby_vision_el_info(void);
+void tv_dolby_vision_el_info(void);
-extern int enable_rgb_to_yuv_matrix_for_dvll(
+int enable_rgb_to_yuv_matrix_for_dvll(
int32_t on, uint32_t *coeff_orig, uint32_t bits);
-extern bool is_dovi_frame(struct vframe_s *vf);
-extern void update_graphic_width_height(unsigned int width,
- unsigned int height);
-extern int get_dolby_vision_policy(void);
+bool is_dovi_frame(struct vframe_s *vf);
+void update_graphic_width_height(unsigned int width, unsigned int height);
+int get_dolby_vision_policy(void);
void set_dolby_vision_policy(int policy);
-extern int get_dolby_vision_src_format(void);
-extern bool is_dolby_vision_el_disable(void);
-extern bool is_dovi_dual_layer_frame(struct vframe_s *vf);
+int get_dolby_vision_src_format(void);
+bool is_dolby_vision_el_disable(void);
+bool is_dovi_dual_layer_frame(struct vframe_s *vf);
void dolby_vision_set_provider(char *prov_name);
int dolby_vision_check_mvc(struct vframe_s *vf);
#endif