mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
amdv: add aisdk function for hw5. [1/1]
PD#SWPL-168075 PD#SWPL-168078 Problem: add aisdk function for hw5. Solution: add aisdk function for hw5. Verify: t3x Change-Id: I60b3d1e3488ae7442179a7f6974134141e2f4082 Signed-off-by: jialong.jiang <jialong.jiang@amlogic.com>
This commit is contained in:
committed by
gerrit autosubmit
parent
35f7e12255
commit
47b69b6702
@@ -464,7 +464,7 @@ u32 ambient_test_mode;
|
||||
module_param(ambient_test_mode, uint, 0664);
|
||||
MODULE_PARM_DESC(ambient_test_mode, "\n ambient_test_mode\n");
|
||||
|
||||
static unsigned int lightsense_test_mode;
|
||||
u32 lightsense_test_mode;
|
||||
module_param(lightsense_test_mode, uint, 0664);
|
||||
MODULE_PARM_DESC(lightsense_test_mode, "\n lightsense_test_mode\n");
|
||||
|
||||
@@ -15254,13 +15254,19 @@ static long amdolby_vision_ioctl(struct file *file,
|
||||
if (copy_from_user(&light_sensor, argp,
|
||||
sizeof(struct light_sensor_s)) == 0) {
|
||||
if (debug_dolby & 0x200)
|
||||
pr_info("[DV]: cur mode %d, light_sense %d, t_frontLux %d\n",
|
||||
mode_id, light_sensor.flag, light_sensor.t_frontLux);
|
||||
if (light_sensor.flag != cfg_info[mode_id].light_sense ||
|
||||
light_sensor.t_frontLux != cfg_info[mode_id].t_front_lux) {
|
||||
need_update_cfg = true;
|
||||
cfg_info[mode_id].light_sense = light_sensor.flag;
|
||||
cfg_info[mode_id].t_front_lux = light_sensor.t_frontLux;
|
||||
pr_info("[DV]: cur mode %d, light_sense %d, t_frontLux %d, t_rearLum %d\n",
|
||||
mode_id, light_sensor.flag,
|
||||
light_sensor.t_frontLux, light_sensor.t_rearLum);
|
||||
if (light_sensor.flag) {
|
||||
if (light_sensor.t_frontLux != cfg_info[mode_id].t_front_lux ||
|
||||
light_sensor.t_rearLum != cfg_info[mode_id].t_rear_lum) {
|
||||
cfg_info[mode_id].light_sense = light_sensor.flag;
|
||||
cfg_info[mode_id].t_front_lux = light_sensor.t_frontLux;
|
||||
cfg_info[mode_id].t_rear_lum = light_sensor.t_rearLum;
|
||||
need_update_cfg = true;
|
||||
}
|
||||
} else {
|
||||
cfg_info[mode_id].light_sense = 0;
|
||||
}
|
||||
} else {
|
||||
ret = -EFAULT;
|
||||
|
||||
@@ -964,6 +964,7 @@ extern u32 last_top1_ro0;
|
||||
extern u32 enable_ro_check;
|
||||
extern bool force_core2c_on;
|
||||
extern bool bypass_detunnel;
|
||||
extern u32 lightsense_test_mode;
|
||||
/************/
|
||||
|
||||
#define pr_dv_dbg(fmt, args...)\
|
||||
|
||||
@@ -2516,6 +2516,24 @@ int amdv_parse_metadata_hw5(struct vframe_s *vf,
|
||||
p_ambient = &dynamic_darkdetail;
|
||||
}
|
||||
}
|
||||
|
||||
if (lightsense_test_mode == 1 && toggle_mode == 1) {
|
||||
if ((top2_info.core_on_cnt % 100) < 50)
|
||||
p_ambient = &lightsense_test_cfg_hw5[0];
|
||||
else
|
||||
p_ambient = &lightsense_test_cfg_hw5[1];
|
||||
} else if (((struct pq_config_dvp *)pq_config_dvp_fake)->
|
||||
tdc.ambient_config.ambient) {
|
||||
if (((struct pq_config_dvp *)pq_config_dvp_fake)->
|
||||
tdc.ambient_config.dark_detail)
|
||||
dynamic_config_new.dark_detail =
|
||||
cfg_info[cur_pic_mode].dark_detail;
|
||||
/*only if cfg enables ambient we allow use light sense feature*/
|
||||
/*light sense: update rear and front*/
|
||||
p_ambient = &dynamic_config_new;
|
||||
update_ambient_lightsense_hw5(p_ambient);
|
||||
}
|
||||
|
||||
if (variable_fps_mode == 1 && toggle_mode == 1 &&
|
||||
vf && vf->source_type == VFRAME_SOURCE_TYPE_HDMI &&
|
||||
hdmi_frame_count < VARIABLE_FPS_COUNT) {
|
||||
@@ -2907,6 +2925,22 @@ int amdv_hw5_control_path(struct vframe_s *vf, struct vd_proc_info_t *vd_proc_in
|
||||
|
||||
flag = p_funcs_tv->tv_hw5_control_path(tv_hw5_setting);
|
||||
|
||||
if (apo_value.content_type != tv_hw5_setting->input_info->content_type ||
|
||||
apo_value.white_point != tv_hw5_setting->input_info->white_point) {
|
||||
apo_value.content_type = tv_hw5_setting->input_info->content_type;
|
||||
apo_value.white_point = tv_hw5_setting->input_info->white_point;
|
||||
apo_value.L11_byte2 = tv_hw5_setting->input_info->L11_byte2;
|
||||
apo_value.L11_byte3 = tv_hw5_setting->input_info->L11_byte3;
|
||||
set_amdv_apo_enable(true);
|
||||
}
|
||||
|
||||
if (debug_dolby & 0x200)
|
||||
pr_dv_dbg("dv content type = %d, white_point = %d, L11_byte2 = %d, L11_byte3 = %d\n",
|
||||
tv_hw5_setting->input_info->content_type,
|
||||
tv_hw5_setting->input_info->white_point,
|
||||
tv_hw5_setting->input_info->L11_byte2,
|
||||
tv_hw5_setting->input_info->L11_byte3);
|
||||
|
||||
if (debug_dolby & 0x400) {
|
||||
do_gettimeofday(&end);
|
||||
time_use = (end.tv_sec - start.tv_sec) * 1000000 +
|
||||
|
||||
@@ -104,6 +104,7 @@ module_param(force_hdr_tonemapping, uint, 0664);
|
||||
MODULE_PARM_DESC(force_hdr_tonemapping, "\n force_hdr_tonemapping\n");
|
||||
|
||||
static u32 last_front_lux;
|
||||
static u32 last_real_lum;
|
||||
|
||||
u16 L2PQ_100_500[] = {
|
||||
2081, /* 100 */
|
||||
@@ -804,6 +805,14 @@ struct ambient_cfg_s lightsense_test_cfg[2] = {
|
||||
{ 9, 65536, 0, 65535, 0, 0, 0},
|
||||
};
|
||||
|
||||
struct dynamic_cfg_s lightsense_test_cfg_hw5[2] = {
|
||||
/*update_flag, ambient, rear, front, whitex, whitey,dark_detail*/
|
||||
/*precision_rendering_upd_mode,precision_rendering_strength*/
|
||||
/*global_dimming_upd_mode,six_vector_upd_mode,l1l4_filtering_upd_mode*/
|
||||
{ 9, 65536, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 9, 65536, 0, 65535, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
struct target_config def_tgt_display_cfg_bestpq = {
|
||||
36045,
|
||||
2,
|
||||
@@ -1288,6 +1297,7 @@ u32 check_cfg_enabled_top1(void)
|
||||
void update_cp_cfg_hw5(bool update_pyramid, bool is_top1, bool enable)
|
||||
{
|
||||
struct target_config_dvp *tdc;
|
||||
int i = 0;
|
||||
|
||||
if (debug_dolby & 0x80000)
|
||||
pr_dv_dbg("update_cp_cfg_hw5 %d\n", is_top1);
|
||||
@@ -1315,6 +1325,16 @@ void update_cp_cfg_hw5(bool update_pyramid, bool is_top1, bool enable)
|
||||
tdc->d_color_shift = cfg_info[cur_pic_mode].colorshift;
|
||||
tdc->d_saturation = cfg_info[cur_pic_mode].saturation;
|
||||
|
||||
if (dv_user_cfg_flag) {
|
||||
tdc->gamma = user_target_config[cur_pic_mode].gamma;
|
||||
tdc->max = user_target_config[cur_pic_mode].max_lin;
|
||||
tdc->min = user_target_config[cur_pic_mode].min_lin;
|
||||
for (i = 0; i < 8; i++) {
|
||||
tdc->t_primaries[i] =
|
||||
user_target_config[cur_pic_mode].t_primaries[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (debug_tprimary) {
|
||||
tdc->t_primaries[0] = cur_debug_tprimary[0][0]; /*rx*/
|
||||
tdc->t_primaries[1] = cur_debug_tprimary[0][1]; /*ry*/
|
||||
@@ -1391,7 +1411,10 @@ void update_cp_cfg(void)
|
||||
|
||||
void update_ambient_lightsense(struct ambient_cfg_s *p_ambient)
|
||||
{
|
||||
int print_flag = 0;
|
||||
u32 print_flag = 0;
|
||||
|
||||
if (!p_ambient)
|
||||
return;
|
||||
|
||||
if (cfg_info[cur_pic_mode].light_sense == 0)
|
||||
return;
|
||||
@@ -1409,12 +1432,41 @@ void update_ambient_lightsense(struct ambient_cfg_s *p_ambient)
|
||||
p_ambient->update_flag |= 9;
|
||||
p_ambient->ambient = (1 << 16);
|
||||
p_ambient->t_frontLux = cfg_info[cur_pic_mode].t_front_lux;
|
||||
p_ambient->t_rearLum = cfg_info[cur_pic_mode].t_rear_lum;
|
||||
print_flag = (p_ambient->t_frontLux - last_front_lux > 1000) ? 1 : 0;
|
||||
print_flag |= (p_ambient->t_rearLum - last_real_lum > 1000) ? 2 : 0;
|
||||
|
||||
if ((debug_dolby & 0x200) && print_flag)
|
||||
pr_dv_dbg("%s: sensor frontLux %d, last frontLux %d\n",
|
||||
__func__, p_ambient->t_frontLux, last_front_lux);
|
||||
pr_dv_dbg("%s: frontLux %d, last frontLux %d, rearLum %d, last rearLum %d\n",
|
||||
__func__, p_ambient->t_frontLux, last_front_lux,
|
||||
p_ambient->t_rearLum, last_real_lum);
|
||||
last_front_lux = p_ambient->t_frontLux;
|
||||
last_real_lum = p_ambient->t_rearLum;
|
||||
}
|
||||
|
||||
void update_ambient_lightsense_hw5(struct dynamic_cfg_s *p_ambient)
|
||||
{
|
||||
u32 print_flag = 0;
|
||||
|
||||
if (!p_ambient)
|
||||
return;
|
||||
|
||||
if (cfg_info[cur_pic_mode].light_sense == 0)
|
||||
return;
|
||||
|
||||
p_ambient->update_flag |= 9;
|
||||
p_ambient->ambient = (1 << 16);
|
||||
p_ambient->t_frontLux = cfg_info[cur_pic_mode].t_front_lux;
|
||||
p_ambient->t_rearLum = cfg_info[cur_pic_mode].t_rear_lum;
|
||||
print_flag = (p_ambient->t_frontLux - last_front_lux > 1000) ? 1 : 0;
|
||||
print_flag |= (p_ambient->t_rearLum - last_real_lum > 1000) ? 2 : 0;
|
||||
|
||||
if ((debug_dolby & 0x200) && print_flag)
|
||||
pr_dv_dbg("%s: frontLux %d, last frontLux %d, rearLum %d, last rearLum %d\n",
|
||||
__func__, p_ambient->t_frontLux, last_front_lux,
|
||||
p_ambient->t_rearLum, last_real_lum);
|
||||
last_front_lux = p_ambient->t_frontLux;
|
||||
last_real_lum = p_ambient->t_rearLum;
|
||||
}
|
||||
|
||||
/*0: reset picture mode and reset pq for all picture mode*/
|
||||
@@ -2840,27 +2892,36 @@ int get_dv_pq_info(char *buf)
|
||||
user_cfg_info[cur_pic_mode].tprimaries[5],
|
||||
user_cfg_info[cur_pic_mode].tprimaries[6],
|
||||
user_cfg_info[cur_pic_mode].tprimaries[7]);
|
||||
if (is_aml_hw5()) {
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin max: [%d]\n",
|
||||
user_target_config[cur_pic_mode].max_lin);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin min: [%d]\n",
|
||||
user_target_config[cur_pic_mode].min_lin);
|
||||
} else {
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin max_lin: [%d]\n",
|
||||
user_target_config[cur_pic_mode].max_lin);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin max_line_dm3: [%d]\n",
|
||||
user_target_config[cur_pic_mode].max_lin_dm3);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin max_pq: [%d]\n",
|
||||
user_target_config[cur_pic_mode].max_pq);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin max_pq_dm3: [%d]\n",
|
||||
user_target_config[cur_pic_mode].max_pq_dm3);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin min_lin: [%d]\n",
|
||||
user_target_config[cur_pic_mode].min_lin);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin min_pq: [%d]\n",
|
||||
user_target_config[cur_pic_mode].min_pq);
|
||||
}
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin gamma: [%d]\n",
|
||||
user_target_config[cur_pic_mode].gamma);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin max_lin: [%d]\n",
|
||||
user_target_config[cur_pic_mode].max_lin);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin max_line_dm3: [%d]\n",
|
||||
user_target_config[cur_pic_mode].max_lin_dm3);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin max_pq: [%d]\n",
|
||||
user_target_config[cur_pic_mode].max_pq);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin max_pq_dm3: [%d]\n",
|
||||
user_target_config[cur_pic_mode].max_pq_dm3);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin min_lin: [%d]\n",
|
||||
user_target_config[cur_pic_mode].min_lin);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin min_pq: [%d]\n",
|
||||
user_target_config[cur_pic_mode].min_pq);
|
||||
pos += sprintf(buf + pos,
|
||||
"user bin tPrimaries: ");
|
||||
pos += sprintf(buf + pos, "[%d][%d][%d][%d][%d][%d][%d][%d]\n",
|
||||
|
||||
@@ -288,6 +288,7 @@ struct dv_cfg_info_s {
|
||||
int dark_detail; /*dark detail, on or off*/
|
||||
int light_sense; /*light sense, on or off*/
|
||||
int t_front_lux;
|
||||
int t_rear_lum;
|
||||
bool bypass_pd_from_user;
|
||||
};
|
||||
|
||||
@@ -330,6 +331,7 @@ extern struct target_config def_tgt_display_cfg_bestpq;
|
||||
extern struct target_config def_tgt_display_cfg_ll;
|
||||
extern int cur_pic_mode;/*current picture mode id*/
|
||||
extern struct ambient_cfg_s lightsense_test_cfg[2];
|
||||
extern struct dynamic_cfg_s lightsense_test_cfg_hw5[2];
|
||||
extern struct ambient_cfg_s ambient_test_cfg[AMBIENT_CFG_FRAMES];
|
||||
extern struct ambient_cfg_s ambient_test_cfg_2[AMBIENT_CFG_FRAMES];
|
||||
extern struct ambient_cfg_s ambient_test_cfg_3[AMBIENT_CFG_FRAMES];
|
||||
@@ -372,6 +374,7 @@ void update_cp_cfg(void);
|
||||
void update_cp_cfg_hw5(bool update_pyramid, bool is_top1, bool enable);
|
||||
void update_user_cfg_to_bin(void);
|
||||
void update_ambient_lightsense(struct ambient_cfg_s *p_ambient);
|
||||
void update_ambient_lightsense_hw5(struct dynamic_cfg_s *p_ambient);
|
||||
void calculate_user_pq_config(void);
|
||||
void get_dv_bin_config_hw5(void);
|
||||
u32 check_cfg_enabled_top1(void);
|
||||
|
||||
@@ -75,6 +75,7 @@ struct dv_user_cfg_s {
|
||||
struct light_sensor_s {
|
||||
int flag;
|
||||
__u32 t_frontLux;
|
||||
__u32 t_rearLum;
|
||||
};
|
||||
|
||||
#define DV_M 'D'
|
||||
|
||||
Reference in New Issue
Block a user