dv: support PIP [1/1]

PD#SWPL-9950

Problem:
  not support VD1+VD2 PIP for DV+None_DV or 2xNone_DV
  need bypass HDR+ to HDR module when Sink support
  need always bypass to HDR module for HLG
  not fully support convert between format SDR/HDR(+)/HLG
  not support convert all format to IPT(DV)
  not support follow sink/follow src policy for PIP

Solution:
  add full matrix support to convert between SDR/HDR formats
  add support to convert all format to IPT(DV)
  rewrite policy, video process and tx handing for PIP

Verify:
  tested and merged in raven project
  need test on for src
  need test for sink(has regression, need to fix)

Change-Id: I001d9dcdcb94c95fb2b7651e726d1ebadc8f4551
Signed-off-by: robin zhu <robin.zhu@amlogic.com>
This commit is contained in:
robin zhu
2019-06-25 13:02:14 -07:00
committed by Jianxin Pan
parent 42fb43b491
commit 40acf218c9
17 changed files with 4232 additions and 1434 deletions

View File

@@ -13924,7 +13924,7 @@ F: drivers/amlogic/media/enhancement/amvecm/arch/*
F: drivers/amlogic/media/enhancement/amvecm/dnlp_algorithm/*
F: include/linux/amlogic/media/amvecm/*
F: drivers/amlogic/media/enhancement/amvecm/hdr/*
F: drivers/amlogic/media/enhancement/amvecm/amprime_sl/*
F: drivers/amlogic/media/enhancement/amvecm/amprime_sl/*
AMLOGIC GXL ADD SKT DTS
M: Yun Cai <yun.cai@amlogic.com>

View File

@@ -205,7 +205,9 @@ enum signal_format_e {
FORMAT_HDR10 = 1,
FORMAT_SDR = 2,
FORMAT_DOVI_LL = 3,
FORMAT_SDR_2020 = 4
FORMAT_HLG = 4,
FORMAT_HDR10PLUS = 5,
FORMAT_SDR_2020 = 6
};
enum priority_mode_e {
@@ -532,6 +534,7 @@ struct dovi_setting_s {
uint32_t vout_width;
uint32_t vout_height;
u8 vsvdb_tbl[32];
u8 hdrdb_tbl[7];
struct ext_md_s ext_md;
uint32_t vsvdb_len;
uint32_t vsvdb_changed;

View File

@@ -6,6 +6,7 @@ obj-$(CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_VECM) += am_vecm.o
am_vecm-objs := amve.o
am_vecm-objs += amcm.o
am_vecm-objs += amcsc.o
am_vecm-objs += amcsc_pip.o
am_vecm-objs += amvecm.o
am_vecm-objs += keystone_correction.o
am_vecm-objs += bitdepth.o

File diff suppressed because it is too large Load Diff

View File

@@ -18,6 +18,13 @@
#ifndef AM_CSC_H
#define AM_CSC_H
extern uint debug_csc;
#define pr_csc(lvl, fmt, args...)\
do {\
if (debug_csc & lvl)\
pr_info(fmt, ## args);\
} while (0)
/* white balance value */
extern void ve_ogo_param_update(void);
extern struct tcon_rgb_ogo_s video_rgb_ogo;
@@ -75,6 +82,16 @@ enum mtx_en_e {
OSD1_MTX_EN
};
enum output_format_e {
UNKNOWN_FMT = 0,
BT709,
BT2020,
BT2020_PQ,
BT2020_PQ_DYNAMIC,
BT2020_HLG,
BT2100_IPT
};
#define POST_MTX_EN_MASK (1 << POST_MTX_EN)
#define VD2_MTX_EN_MASK (1 << VD2_MTX_EN)
#define VD1_MTX_EN_MASK (1 << VD1_MTX_EN)
@@ -84,6 +101,21 @@ enum mtx_en_e {
#define HDR_SUPPORT (1 << 2)
#define HLG_SUPPORT (1 << 3)
#define SIG_CS_CHG 0x01
#define SIG_SRC_CHG 0x02
#define SIG_PRI_INFO 0x04
#define SIG_KNEE_FACTOR 0x08
#define SIG_HDR_MODE 0x10
#define SIG_HDR_SUPPORT 0x20
#define SIG_WB_CHG 0x40
#define SIG_HLG_MODE 0x80
#define SIG_HLG_SUPPORT 0x100
#define SIG_OP_CHG 0x200
#define SIG_SRC_OUTPUT_CHG 0x400/*for box*/
#define SIG_HDR10_PLUS_MODE 0x800
#define SIG_COLORIMETRY_SUPPORT 0x1000
#define SIG_OUTPUT_MODE_CHG 0x2000
#define LUT_289_SIZE 289
extern unsigned int lut_289_mapping[LUT_289_SIZE];
extern int dnlp_en;
@@ -97,15 +129,36 @@ extern uint hdr_flag;
extern int video_rgb_ogo_xvy_mtx_latch;
extern int video_rgb_ogo_xvy_mtx;
extern int tx_op_color_primary;
extern uint cur_csc_type;
extern uint cur_csc_type[VD_PATH_MAX];
/* 0: hdr->hdr, 1:hdr->sdr, 2:hdr->hlg */
extern uint hdr_process_mode[VD_PATH_MAX];
extern uint cur_hdr_process_mode[VD_PATH_MAX];
/* 0: bypass, 1:hdr10p->hdr, 2:hdr10p->sdr, 3:hdr10p->hlg */
extern uint hdr10_plus_process_mode[VD_PATH_MAX];
extern uint cur_hdr10_plus_process_mode[VD_PATH_MAX];
/* 0: hlg->hlg, 1:hlg->sdr 2:hlg->hdr*/
extern uint hlg_process_mode[VD_PATH_MAX];
extern uint cur_hlg_process_mode[VD_PATH_MAX];
/* 0: sdr->sdr, 1:sdr->hdr, 2:sdr->hlg */
extern uint sdr_process_mode[VD_PATH_MAX];
extern uint cur_sdr_process_mode[VD_PATH_MAX];
/* 0: tx don't support hdr10+, 1: tx support hdr10+*/
extern uint tx_hdr10_plus_support;
extern int amvecm_matrix_process(
struct vframe_s *vf, struct vframe_s *vf_rpt, int flags);
struct vframe_s *vf, struct vframe_s *vf_rpt, int flags,
enum vd_path_e vd_path);
extern int amvecm_hdr_dbg(u32 sel);
extern u32 get_video_enabled(void);
extern u32 get_videopip_enabled(void);
extern void get_hdr_source_type(void);
extern void get_cur_vd_signal_type(enum vd_path_e vd_path);
extern enum color_primary_e get_color_primary(void);
/*hdr*/
/*#define DBG_BUF_SIZE (1024)*/
@@ -125,6 +178,44 @@ struct hdr_data_t {
extern void hdr_init(struct hdr_data_t *phdr_data);
extern void hdr_exit(void);
extern void hdr_set_cfg_osd_100(int val);
extern void hdr_osd_off(void);
extern void hdr_vd1_off(void);
extern bool is_video_layer_on(enum vd_path_e vd_path);
#define HDR_MODULE_OFF 0
#define HDR_MODULE_ON 1
#define HDR_MODULE_BYPASS 2
extern void set_hdr_module_status(enum vd_path_e vd_path, int status);
extern int get_hdr_module_status(enum vd_path_e vd_path);
extern int get_primaries_type(struct vframe_master_display_colour_s *p_mdc);
#define PROC_BYPASS 0
/* to backward compatible */
#define PROC_MATCH 1
#define PROC_OFF 4
/* sdr */
#define PROC_SDR_TO_HDR 1
#define PROC_SDR_TO_HLG 2
/* hdr */
#define PROC_HDR_TO_SDR 1
#define PROC_HDR_TO_HLG 2
/* hlg */
#define PROC_HLG_TO_SDR 1
#define PROC_HLG_TO_HDR 2
/* hdr+ */
#define PROC_HDRP_TO_HDR 1
#define PROC_HDRP_TO_SDR 2
#define PROC_HDRP_TO_HLG 3
extern uint get_hdr10_plus_pkt_delay(void);
extern void update_hdr10_plus_pkt(bool enable,
void *hdr10plus_params,
void *send_info);
extern void send_hdr10_plus_pkt(enum vd_path_e vd_path);
#define HDRPLUS_PKT_UPDATE 2
#define HDRPLUS_PKT_REPEAT 1
#define HDRPLUS_PKT_IDLE 0
#endif /* AM_CSC_H */

View File

@@ -0,0 +1,929 @@
/*
* drivers/amlogic/media/enhancement/amvecm/amcsc_pip.c
*
* Copyright (C) 2017 Amlogic, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#include <linux/amlogic/media/vfm/vframe.h>
#include <linux/amlogic/media/vfm/video_common.h>
#include <linux/amlogic/media/amvecm/amvecm.h>
#include <linux/amlogic/media/amdolbyvision/dolby_vision.h>
#include "amcsc.h"
#include "set_hdr2_v0.h"
#include "hdr/am_hdr10_plus.h"
/* 0: follow sink, 1: follow source */
static uint hdr_policy;
static uint cur_hdr_policy;
static enum output_format_e target_format[VD_PATH_MAX];
static enum hdr_type_e cur_source_format[VD_PATH_MAX];
static enum output_format_e output_format;
static const char *module_str[7] = {
"UNKNOWN",
"VD1",
"VD2",
"OSD1",
"VDIN0",
"VDIN1",
"DI"
};
static const char *process_str[15] = {
"UNKNOWN",
"HDR_BYPASS",
"HDR_SDR",
"SDR_HDR",
"HLG_BYPASS",
"HLG_SDR",
"HLG_HDR",
"SDR_HLG",
"SDR_IPT",
"HDR_IPT",
"HLG_IPT",
"HDR_HLG",
"RGB_YUV",
"RGB_HDR",
"RGB_HLG"
};
static const char *policy_str[3] = {
"follow_sink",
"follow_source",
"force_output"
};
static const char *input_str[7] = {
"NONE",
"HDR",
"HDR+",
"DOVI",
"PRIME",
"HLG",
"SDR"
};
/* output_format_e */
static const char *output_str[7] = {
"UNKNOWN",
"709",
"2020",
"HDR",
"HDR+",
"HLG",
"IPT"
};
static const char *dv_output_str[6] = {
"IPT",
"TUNNEL",
"HDR10",
"SDR10",
"SDR8",
"BYPASS"
};
void hdr_proc(
enum hdr_module_sel module_sel,
enum hdr_process_sel hdr_process_select,
struct vinfo_s *vinfo)
{
enum hdr_process_sel cur_hdr_process;
cur_hdr_process = hdr_func(
module_sel, hdr_process_select, vinfo);
if (cur_hdr_process != hdr_process_select)
pr_csc(8, "am_vecm: module=%s, process=%s(%s)\n",
module_str[module_sel],
process_str[hdr_process_select],
process_str[cur_hdr_process]);
else
pr_csc(8, "am_vecm: hdr module=%s, process=%s\n",
module_str[module_sel],
process_str[hdr_process_select]);
}
int hdr_policy_process(
struct vinfo_s *vinfo,
enum hdr_type_e *source_format,
enum vd_path_e vd_path)
{
int change_flag = 0;
enum vd_path_e oth_path =
(vd_path == VD1_PATH) ? VD2_PATH : VD1_PATH;
int dv_policy = 0;
int dv_mode = 0;
bool hdr10_plus_support =
(vinfo->hdr_info.hdr10plus_info.ieeeoui
== HDR_PLUS_IEEE_OUI) &&
(vinfo->hdr_info.hdr10plus_info.application_version
== 1);
tx_hdr10_plus_support = hdr10_plus_support;
cur_hdr_policy = hdr_policy;
if (is_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();
if ((dv_policy != DOLBY_VISION_FORCE_OUTPUT_MODE)
|| (dv_mode != DOLBY_VISION_OUTPUT_MODE_BYPASS)) {
/* use dv policy when not force bypass */
cur_hdr_policy = dv_policy;
}
}
if ((get_hdr_module_status(vd_path) != HDR_MODULE_ON)
&& is_dolby_vision_enable()) {
sdr_process_mode[vd_path] = PROC_BYPASS;
hdr_process_mode[vd_path] = PROC_BYPASS;
hlg_process_mode[vd_path] = PROC_BYPASS;
hdr10_plus_process_mode[vd_path] = PROC_BYPASS;
target_format[vd_path] = BT709;
} else if (cur_hdr_policy == 0) {
if ((vd_path == VD1_PATH)
&& (source_format[vd_path] == HDRTYPE_HLG)
&& (vinfo->hdr_info.hdr_support & HLG_SUPPORT)) {
/* vd1 bypass hlg */
hlg_process_mode[vd_path] = PROC_BYPASS;
target_format[vd_path] = BT2020_HLG;
} else if ((vd_path == VD1_PATH)
&& (!is_video_layer_on(VD2_PATH))
&& (source_format[vd_path] == HDRTYPE_HDR10PLUS)
&& hdr10_plus_support) {
/* vd1 bypass hdr+ when vd2 off */
hdr10_plus_process_mode[vd_path] = PROC_BYPASS;
target_format[vd_path] = BT2020_PQ_DYNAMIC;
} else if (is_dolby_vision_on() && (vd_path == VD2_PATH)) {
/* vd2 *->ipt when vd1 dolby on */
hdr_process_mode[vd_path] = PROC_MATCH;
hlg_process_mode[vd_path] = PROC_MATCH;
sdr_process_mode[vd_path] = PROC_MATCH;
hdr10_plus_process_mode[vd_path] = PROC_MATCH;
target_format[vd_path] = BT2100_IPT;
} else if ((vd_path == VD2_PATH)
&& is_video_layer_on(VD1_PATH)) {
/* vd1 on and vd2 follow vd1 output */
if (target_format[VD1_PATH] == BT2020_HLG) {
/* vd2 *->hlg when vd1 output hlg */
sdr_process_mode[vd_path] = PROC_SDR_TO_HLG;
hdr_process_mode[vd_path] = PROC_HDR_TO_HLG;
hlg_process_mode[vd_path] = PROC_BYPASS;
hdr10_plus_process_mode[vd_path] =
PROC_HDRP_TO_HLG;
target_format[vd_path] = BT2020_HLG;
} else if ((target_format[VD1_PATH] == BT2020_PQ) ||
(target_format[VD1_PATH] == BT2020_PQ_DYNAMIC)) {
/* vd2 *->hdr when vd1 output hdr/hdr+ */
sdr_process_mode[vd_path] = PROC_SDR_TO_HDR;
hdr_process_mode[vd_path] = PROC_BYPASS;
hlg_process_mode[vd_path] = PROC_HLG_TO_HDR;
hdr10_plus_process_mode[vd_path] =
PROC_HDRP_TO_HDR;
target_format[vd_path] = BT2020_PQ;
} else {
/* vd2 *->sdr when vd1 output sdr */
sdr_process_mode[vd_path] = PROC_BYPASS;
hdr_process_mode[vd_path] = PROC_HDR_TO_SDR;
hlg_process_mode[vd_path] = PROC_HLG_TO_SDR;
hdr10_plus_process_mode[vd_path] =
PROC_HDRP_TO_SDR;
if ((target_format[VD1_PATH] == BT2020) &&
(source_format[vd_path] == HDRTYPE_HLG))
target_format[vd_path] = BT2020;
else
target_format[vd_path] = BT709;
}
} else if ((vinfo->hdr_info.hdr_support & HDR_SUPPORT)
&& ((source_format[vd_path] != HDRTYPE_HLG)
|| ((source_format[vd_path] == HDRTYPE_HLG)
&& (hdr_flag & 0x10)))) {
/* *->hdr */
sdr_process_mode[vd_path] = PROC_SDR_TO_HDR;
hdr_process_mode[vd_path] = PROC_BYPASS;
hlg_process_mode[vd_path] = PROC_HLG_TO_HDR;
hdr10_plus_process_mode[vd_path] =
PROC_HDRP_TO_HDR;
target_format[vd_path] = BT2020_PQ;
} else {
/* *->sdr */
sdr_process_mode[vd_path] = PROC_BYPASS;
hdr_process_mode[vd_path] = PROC_HDR_TO_SDR;
hlg_process_mode[vd_path] = PROC_HLG_TO_SDR;
hdr10_plus_process_mode[vd_path] =
PROC_HDRP_TO_SDR;
#if 0
if ((vinfo->hdr_info.colorimetry_support
& SINK_SUPPORTS_BT2020) &&
(source_format[vd_path] == HDRTYPE_HLG) &&
!is_video_layer_on(oth_path))
target_format[vd_path] = BT2020;
else
target_format[vd_path] = BT709;
#else
target_format[vd_path] = BT709;
#endif
}
} else if (cur_hdr_policy == 1) {
if ((vd_path == VD2_PATH) && is_dolby_vision_on()) {
/* VD2 with VD1 in DV mode */
hdr_process_mode[vd_path] = PROC_MATCH;
hlg_process_mode[vd_path] = PROC_MATCH;
sdr_process_mode[vd_path] = PROC_MATCH; /* *->ipt */
target_format[vd_path] = BT2100_IPT;
} else if ((vd_path == VD1_PATH)
|| ((vd_path == VD2_PATH) && !is_video_layer_on(VD1_PATH))) {
/* VD1(with/without VD2) */
/* or VD2(without VD1) <= should switch to VD1 */
switch (source_format[vd_path]) {
case HDRTYPE_SDR:
if (is_video_layer_on(oth_path)) {
if ((target_format[oth_path] ==
BT2020_PQ) ||
(target_format[oth_path] ==
BT2020_PQ_DYNAMIC)) {
/* other layer output HDR */
/* sdr *->hdr */
sdr_process_mode[vd_path] =
PROC_SDR_TO_HDR;
target_format[vd_path] =
BT2020_PQ;
} else if (target_format[oth_path] ==
BT2020_HLG) {
/* other layer output hlg */
/* sdr *->hlg */
sdr_process_mode[vd_path] =
PROC_SDR_TO_HLG;
target_format[vd_path] =
BT2020_HLG;
} else {
/* sdr->sdr */
sdr_process_mode[vd_path] =
PROC_BYPASS;
target_format[vd_path] = BT709;
}
} else {
/* sdr->sdr */
sdr_process_mode[vd_path] =
PROC_BYPASS;
target_format[vd_path] = BT709;
}
break;
case HDRTYPE_HLG:
/* source HLG */
if (is_video_layer_on(oth_path)
&& ((target_format[oth_path] ==
BT2020_PQ) ||
(target_format[oth_path] ==
BT2020_PQ_DYNAMIC))) {
/* hlg->hdr */
hlg_process_mode[vd_path] =
PROC_HLG_TO_HDR;
target_format[vd_path] =
BT2020_PQ;
} else if (vinfo->hdr_info.hdr_support
& HLG_SUPPORT) {
/* hlg->hlg */
hlg_process_mode[vd_path] =
PROC_BYPASS;
target_format[vd_path] =
BT2020_HLG;
} else if ((vinfo->hdr_info.hdr_support
& HDR_SUPPORT) && (hdr_flag & 0x10)) {
/* hlg->hdr */
hlg_process_mode[vd_path] =
PROC_HLG_TO_HDR;
target_format[vd_path] =
BT2020_PQ;
} else {
/* hlg->sdr */
hlg_process_mode[vd_path] =
PROC_HLG_TO_SDR;
#if 0
if ((vinfo->hdr_info.colorimetry_support
& SINK_SUPPORTS_BT2020) &&
!is_video_layer_on(oth_path))
target_format[vd_path] =
BT2020;
else
target_format[vd_path] =
BT709;
#else
target_format[vd_path] = BT709;
#endif
}
break;
case HDRTYPE_HDR10:
/* source HDR10 */
if (vinfo->hdr_info.hdr_support & HDR_SUPPORT) {
/* hdr bypass */
hdr_process_mode[vd_path] =
PROC_BYPASS;
target_format[vd_path] =
BT2020_PQ;
} else if (vinfo->hdr_info.hdr_support
& HLG_SUPPORT) {
/* hdr->hlg */
hdr_process_mode[vd_path] =
PROC_HDR_TO_HLG;
target_format[vd_path] =
BT2020_HLG;
} else {
/* hdr ->sdr */
hdr_process_mode[vd_path] =
PROC_HDR_TO_SDR;
target_format[vd_path] =
BT709;
}
break;
case HDRTYPE_HDR10PLUS:
/* source HDR10+ */
if (hdr10_plus_support
&& !is_video_layer_on(oth_path)) {
/* hdr+ bypass */
hdr10_plus_process_mode[vd_path] =
PROC_BYPASS;
target_format[vd_path] =
BT2020_PQ_DYNAMIC;
} else if (vinfo->hdr_info.hdr_support
& HDR_SUPPORT) {
/* hdr+->hdr */
hdr10_plus_process_mode[vd_path] =
PROC_HDRP_TO_HDR;
target_format[vd_path] = BT2020_PQ;
} else if (vinfo->hdr_info.hdr_support
& HLG_SUPPORT) {
/* hdr+->hlg */
hdr10_plus_process_mode[vd_path] =
PROC_HDRP_TO_HLG;
target_format[vd_path] = BT2020_HLG;
} else {
/* hdr+ *->sdr */
hdr10_plus_process_mode[vd_path] =
PROC_HDRP_TO_SDR;
target_format[vd_path] = BT709;
}
break;
default:
break;
}
} else {
/* VD2 with VD1 */
if (is_dolby_vision_on()) {
/* VD1 is dolby vision */
hdr_process_mode[vd_path] = PROC_MATCH;
hlg_process_mode[vd_path] = PROC_MATCH;
sdr_process_mode[vd_path] = PROC_MATCH;
target_format[vd_path] = BT2100_IPT;
} else {
oth_path = VD1_PATH;
switch (source_format[vd_path]) {
case HDRTYPE_SDR:
/* VD2 source SDR */
if ((target_format[oth_path] ==
BT2020_PQ)
|| (target_format[oth_path] ==
BT2020_PQ_DYNAMIC)) {
/* other layer output HDR */
/* sdr *->hdr */
sdr_process_mode[vd_path] =
PROC_SDR_TO_HDR;
target_format[vd_path] =
BT2020_PQ;
} else if (target_format[oth_path] ==
BT2020_HLG) {
/* other layer on and not sdr */
/* sdr *->hlg */
sdr_process_mode[vd_path] =
PROC_SDR_TO_HLG;
target_format[vd_path] =
BT2020_HLG;
} else {
/* sdr->sdr */
sdr_process_mode[vd_path] =
PROC_BYPASS;
target_format[vd_path] = BT709;
}
break;
case HDRTYPE_HLG:
/* VD2 source HLG */
if (target_format[oth_path]
== BT2020_HLG) {
/* hlg->hlg */
hlg_process_mode[vd_path] =
PROC_BYPASS;
target_format[vd_path] =
BT2020_HLG;
} else if ((target_format[oth_path] ==
BT2020_PQ)
|| (target_format[oth_path] ==
BT2020_PQ_DYNAMIC)) {
/* hlg->hdr */
hlg_process_mode[vd_path] =
PROC_HLG_TO_HDR;
target_format[vd_path] =
BT2020_PQ;
} else if (target_format[oth_path] ==
BT709) {
/* hlg->sdr */
hlg_process_mode[vd_path] =
PROC_HLG_TO_SDR;
target_format[vd_path] = BT709;
}
break;
case HDRTYPE_HDR10:
/* VD2 source HDR10 */
if ((target_format[oth_path] ==
BT2020_PQ)
|| (target_format[oth_path] ==
BT2020_PQ_DYNAMIC)) {
/* hdr->hdr */
hdr_process_mode[vd_path] =
PROC_BYPASS;
target_format[vd_path] =
BT2020_PQ;
} else if (target_format[oth_path]
== BT2020_HLG) {
/* hdr->hlg */
hdr_process_mode[vd_path] =
PROC_HDR_TO_HLG;
target_format[vd_path] =
BT2020_HLG;
} else {
/* hdr->sdr */
hdr_process_mode[vd_path] =
PROC_HDR_TO_SDR;
target_format[vd_path] = BT709;
}
break;
case HDRTYPE_HDR10PLUS:
/* VD2 source HDR10+ */
if ((target_format[oth_path] ==
BT2020_PQ)
|| (target_format[oth_path] ==
BT2020_PQ_DYNAMIC)) {
/* hdr->hdr */
hdr10_plus_process_mode[vd_path]
= PROC_HDRP_TO_HDR;
target_format[vd_path] =
BT2020_PQ;
} else if (target_format[oth_path]
== BT2020_HLG) {
/* hdr->hlg */
hdr_process_mode[vd_path] =
PROC_HDR_TO_HLG;
target_format[vd_path] =
BT2020_HLG;
} else {
/* hdr->sdr */
hdr10_plus_process_mode[vd_path]
= PROC_HDRP_TO_SDR;
target_format[vd_path] = BT709;
}
break;
default:
break;
}
}
}
} else if (cur_hdr_policy == 2) {
/* *->ipt */
hdr_process_mode[vd_path] = PROC_MATCH;
hlg_process_mode[vd_path] = PROC_MATCH;
sdr_process_mode[vd_path] = PROC_MATCH;
target_format[vd_path] = BT2100_IPT;
}
/* update change flags */
if (is_dolby_vision_on()
&& (vd_path == VD1_PATH)) {
pr_csc(4, "am_vecm: vd%d: (%s) %s->%s.\n",
vd_path + 1,
policy_str[dv_policy],
input_str[get_dolby_vision_src_format()],
dv_output_str[dv_mode]);
} else {
if (cur_hdr10_plus_process_mode[vd_path]
!= hdr10_plus_process_mode[vd_path])
change_flag |= SIG_HDR_MODE;
if (cur_hdr_process_mode[vd_path]
!= hdr_process_mode[vd_path])
change_flag |= SIG_HDR_MODE;
if (cur_hlg_process_mode[vd_path]
!= hlg_process_mode[vd_path])
change_flag |= SIG_HLG_MODE;
if (cur_sdr_process_mode[vd_path]
!= sdr_process_mode[vd_path])
change_flag |= SIG_HDR_MODE;
if (cur_source_format[vd_path]
!= source_format[vd_path])
change_flag |= SIG_SRC_CHG;
if (change_flag)
pr_csc(4, "am_vecm: vd%d: (%s) %s->%s (%s).\n",
vd_path + 1,
policy_str[cur_hdr_policy],
input_str[source_format[vd_path]],
output_str[target_format[vd_path]],
is_dolby_vision_on() ?
dv_output_str[dv_mode] :
output_str[output_format]);
}
cur_source_format[vd_path] = source_format[vd_path];
if (is_dolby_vision_on()
&& (vd_path == VD2_PATH)
&& is_video_layer_on(VD2_PATH)
&& (target_format[vd_path] != BT2100_IPT)) {
pr_csc(4, "am_vecm: vd%d output mode not match to dolby %s.\n",
vd_path + 1,
output_str[target_format[vd_path]]);
change_flag |= SIG_OUTPUT_MODE_CHG;
} else if (!is_dolby_vision_on()
&& is_video_layer_on(VD1_PATH)
&& is_video_layer_on(VD2_PATH)
&& (target_format[vd_path]
!= target_format[oth_path])) {
pr_csc(4, "am_vecm: vd%d output mode not match %s %s.\n",
vd_path + 1,
output_str[target_format[vd_path]],
output_str[target_format[oth_path]]);
change_flag |= SIG_OUTPUT_MODE_CHG;
}
if (change_flag & SIG_OUTPUT_MODE_CHG) {
/* need change video process for another path */
switch (cur_source_format[oth_path]) {
case HDRTYPE_HDR10PLUS:
cur_hdr10_plus_process_mode[oth_path] =
PROC_OFF;
break;
case HDRTYPE_HDR10:
cur_hdr_process_mode[oth_path] = PROC_OFF;
break;
case HDRTYPE_HLG:
cur_hlg_process_mode[oth_path] = PROC_OFF;
break;
case HDRTYPE_SDR:
cur_sdr_process_mode[oth_path] = PROC_OFF;
break;
default:
break;
}
}
return change_flag;
}
static void prepare_hdr_info(
struct master_display_info_s *hdr_data,
struct vframe_master_display_colour_s *p)
{
memset(hdr_data->primaries, 0, sizeof(hdr_data->primaries));
if ((p->present_flag & 1)
&& (((hdr_data->features >> 16) & 0xff) == 9)) {
memcpy(hdr_data->primaries,
p->primaries,
sizeof(u32)*6);
memcpy(hdr_data->white_point,
p->white_point,
sizeof(u32)*2);
hdr_data->luminance[0] =
p->luminance[0];
hdr_data->luminance[1] =
p->luminance[1];
if (p->content_light_level.present_flag == 1) {
hdr_data->max_content =
p->content_light_level.max_content;
hdr_data->max_frame_average =
p->content_light_level.max_pic_average;
} else {
hdr_data->max_content = 0;
hdr_data->max_frame_average = 0;
}
hdr_data->luminance[0] = hdr_data->luminance[0] / 10000;
hdr_data->present_flag = 1;
}
}
void hdmi_packet_process(
int signal_change_flag,
struct vinfo_s *vinfo,
struct vframe_master_display_colour_s *p,
struct hdr10plus_para *hdmitx_hdr10plus_param,
enum vd_path_e vd_path)
{
struct vout_device_s *vdev = NULL;
struct master_display_info_s send_info;
enum output_format_e cur_output_format = output_format;
if (!vinfo)
return;
if (!vinfo->vout_device) {
pr_info("vinfo->vout_device is null, return\n");
return;
}
vdev = vinfo->vout_device;
if (!vdev->fresh_tx_hdr_pkt) {
pr_info("vdev->fresh_tx_hdr_pkt is null, return\n");
/* continue */
}
if ((target_format[vd_path] == cur_output_format)
&& (cur_output_format != BT2020_PQ_DYNAMIC)
&& ((cur_output_format == BT2020_PQ) &&
!(signal_change_flag & SIG_PRI_INFO)))
return;
/* clean hdr10plus packet when switch to others */
if ((target_format[vd_path] != BT2020_PQ_DYNAMIC)
&& (cur_output_format == BT2020_PQ_DYNAMIC)) {
if (get_hdr10_plus_pkt_delay()) {
update_hdr10_plus_pkt(false,
(void *)NULL,
(void *)NULL);
} else if (vdev->fresh_tx_hdr10plus_pkt)
vdev->fresh_tx_hdr10plus_pkt(0,
hdmitx_hdr10plus_param);
pr_csc(4, "am_vecm: vd%d hdmi clean hdr10+ pkt\n",
vd_path + 1);
}
if (output_format != target_format[vd_path]) {
pr_csc(4,
"am_vecm: vd%d %s %s, vd2 %s %s, output_format %s => %s\n",
vd_path + 1,
is_video_layer_on(VD1_PATH) ? "on" : "off",
output_str[target_format[VD1_PATH]],
is_video_layer_on(VD2_PATH) ? "on" : "off",
output_str[target_format[VD2_PATH]],
output_str[cur_output_format],
output_str[target_format[vd_path]]);
output_format = target_format[vd_path];
}
switch (output_format) {
case BT709:
send_info.features =
/* default 709 limit */
(0 << 30) /*sdr output 709*/
| (1 << 29) /*video available*/
| (5 << 26) /* unspecified */
| (0 << 25) /* limit */
| (1 << 24) /*color available*/
| (1 << 16) /* bt709 */
| (1 << 8) /* bt709 */
| (1 << 0); /* bt709 */
break;
case BT2020:
send_info.features =
/* default 709 full */
(1 << 30) /*sdr output 709*/
| (1 << 29) /*video available*/
| (5 << 26) /* unspecified */
| (0 << 25) /* limit */
| (1 << 24) /*color available*/
| (9 << 16) /* 2020 */
| (1 << 8) /* bt709 */
| (10 << 0);
break;
case BT2020_PQ:
send_info.features =
(0 << 30) /*sdr output 709*/
| (1 << 29) /*video available*/
| (5 << 26) /* unspecified */
| (0 << 25) /* limit */
| (1 << 24) /*color available*/
| (9 << 16)
| (16 << 8)
| (10 << 0); /* bt2020c */
break;
case BT2020_HLG:
send_info.features =
(0 << 30) /*sdr output 709*/
| (1 << 29) /*video available*/
| (5 << 26) /* unspecified */
| (0 << 25) /* limit */
| (1 << 24) /*color available*/
| (9 << 16)
| (18 << 8)
| (10 << 0);
break;
case BT2020_PQ_DYNAMIC:
send_info.features =
(0 << 30) /*sdr output 709*/
| (1 << 29) /*video available*/
| (5 << 26) /* unspecified */
| (0 << 25) /* limit */
| (1 << 24) /*color available*/
| (9 << 16)
| (16 << 8) /* Always HDR10 */
| (10 << 0); /* bt2020c */
break;
case UNKNOWN_FMT:
case BT2100_IPT:
/* handle by dolby vision */
return;
}
/* drm */
prepare_hdr_info(&send_info, p);
/* hdr10+ */
if ((output_format == BT2020_PQ_DYNAMIC)
&& hdmitx_hdr10plus_param) {
if (get_hdr10_plus_pkt_delay()) {
update_hdr10_plus_pkt(true,
(void *)hdmitx_hdr10plus_param,
(void *)&send_info);
} else {
if (vdev->fresh_tx_hdr_pkt)
vdev->fresh_tx_hdr_pkt(&send_info);
if (vdev->fresh_tx_hdr10plus_pkt)
vdev->fresh_tx_hdr10plus_pkt(
1, hdmitx_hdr10plus_param);
}
return;
}
/* none hdr+ */
if (vdev->fresh_tx_hdr_pkt)
vdev->fresh_tx_hdr_pkt(&send_info);
}
void video_post_process(
enum vpp_matrix_csc_e csc_type,
struct vinfo_s *vinfo,
enum vd_path_e vd_path)
{
switch (cur_source_format[vd_path]) {
case HDRTYPE_SDR:
if (vd_path == VD2_PATH && is_dolby_vision_on()) {
hdr_proc(VD2_HDR, SDR_IPT, vinfo);
} else if (sdr_process_mode[vd_path] == PROC_BYPASS) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HDR_BYPASS, vinfo);
else
hdr_proc(VD2_HDR, HDR_BYPASS, vinfo);
if (((vd_path == VD1_PATH) &&
!is_video_layer_on(VD2_PATH))
|| ((vd_path == VD2_PATH) &&
!is_video_layer_on(VD1_PATH)))
hdr_proc(OSD1_HDR, HDR_BYPASS, vinfo);
} else if (sdr_process_mode[vd_path] == PROC_SDR_TO_HDR) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, SDR_HDR, vinfo);
else
hdr_proc(VD2_HDR, SDR_HDR, vinfo);
hdr_proc(OSD1_HDR, SDR_HDR, vinfo);
} else if (sdr_process_mode[vd_path] == PROC_SDR_TO_HLG) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, SDR_HLG, vinfo);
else if (vd_path == VD2_PATH)
hdr_proc(VD2_HDR, SDR_HLG, vinfo);
hdr_proc(OSD1_HDR, SDR_HLG, vinfo);
}
break;
case HDRTYPE_HDR10:
if (vd_path == VD2_PATH && is_dolby_vision_on()) {
hdr_proc(VD2_HDR, HDR_IPT, vinfo);
} else if (hdr_process_mode[vd_path] == PROC_BYPASS) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HDR_BYPASS, vinfo);
else
hdr_proc(VD2_HDR, HDR_BYPASS, vinfo);
hdr_proc(OSD1_HDR, SDR_HDR, vinfo);
} else if (hdr_process_mode[vd_path] == PROC_HDR_TO_SDR) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HDR_SDR, vinfo);
else
hdr_proc(VD2_HDR, HDR_SDR, vinfo);
hdr_proc(OSD1_HDR, HDR_BYPASS, vinfo);
} else if (hdr_process_mode[vd_path] == PROC_HDR_TO_HLG) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HDR_HLG, vinfo);
else
hdr_proc(VD2_HDR, HDR_HLG, vinfo);
hdr_proc(OSD1_HDR, SDR_HLG, vinfo);
}
break;
case HDRTYPE_HLG:
if (vd_path == VD2_PATH && is_dolby_vision_on()) {
hdr_proc(VD2_HDR, HLG_IPT, vinfo);
} else if (hlg_process_mode[vd_path] == PROC_BYPASS) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HDR_BYPASS, vinfo);
else
hdr_proc(VD2_HDR, HDR_BYPASS, vinfo);
hdr_proc(OSD1_HDR, SDR_HLG, vinfo);
} else if (hlg_process_mode[vd_path] == PROC_HLG_TO_SDR) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HLG_SDR, vinfo);
else
hdr_proc(VD2_HDR, HLG_SDR, vinfo);
hdr_proc(OSD1_HDR, HDR_BYPASS, vinfo);
} else if (hlg_process_mode[vd_path] == PROC_HLG_TO_HDR) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HLG_HDR, vinfo);
else
hdr_proc(VD2_HDR, HLG_HDR, vinfo);
hdr_proc(OSD1_HDR, SDR_HDR, vinfo);
}
break;
case HDRTYPE_HDR10PLUS:
if ((vd_path == VD2_PATH) && is_dolby_vision_on()) {
hdr_proc(VD2_HDR, HDR_IPT, vinfo);
} else if (hdr10_plus_process_mode[vd_path] ==
PROC_BYPASS) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HDR_BYPASS, vinfo);
else
hdr_proc(VD2_HDR, HDR_BYPASS, vinfo);
hdr_proc(OSD1_HDR, SDR_HDR, vinfo);
} else if (hdr10_plus_process_mode[vd_path] ==
PROC_HDRP_TO_HDR) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HDR_BYPASS, vinfo);
else
hdr_proc(VD2_HDR, HDR_BYPASS, vinfo);
hdr_proc(OSD1_HDR, SDR_HDR, vinfo);
} else if (hdr10_plus_process_mode[vd_path] ==
PROC_HDRP_TO_SDR) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HDR_SDR, vinfo);
else
hdr_proc(VD2_HDR, HDR_SDR, vinfo);
hdr_proc(OSD1_HDR, HDR_BYPASS, vinfo);
} else if (hdr10_plus_process_mode[vd_path] ==
PROC_HDRP_TO_HLG) {
if (vd_path == VD1_PATH)
hdr_proc(VD1_HDR, HDR_HLG, vinfo);
else
hdr_proc(VD2_HDR, HDR_HLG, vinfo);
hdr_proc(OSD1_HDR, SDR_HLG, vinfo);
}
break;
default:
break;
}
if (cur_sdr_process_mode[vd_path] !=
sdr_process_mode[vd_path]) {
if (cur_source_format[vd_path] == HDRTYPE_SDR)
pr_csc(1,
"am_vecm: vd%d: sdr_process_mode %d to %d\n",
vd_path + 1,
cur_sdr_process_mode[vd_path],
sdr_process_mode[vd_path]);
cur_sdr_process_mode[vd_path] =
sdr_process_mode[vd_path];
}
if (cur_hdr_process_mode[vd_path] !=
hdr_process_mode[vd_path]) {
if (cur_source_format[vd_path] == HDRTYPE_HDR10)
pr_csc(1,
"am_vecm: vd%d: hdr_process_mode %d to %d\n",
vd_path + 1,
cur_hdr_process_mode[vd_path],
hdr_process_mode[vd_path]);
cur_hdr_process_mode[vd_path] =
hdr_process_mode[vd_path];
}
if (cur_hlg_process_mode[vd_path] !=
hlg_process_mode[vd_path]) {
if (cur_source_format[vd_path] == HDRTYPE_HLG)
pr_csc(1,
"am_vecm: vd%d: hlg_process_mode %d to %d\n",
vd_path + 1,
cur_hlg_process_mode[vd_path],
hlg_process_mode[vd_path]);
cur_hlg_process_mode[vd_path] =
hlg_process_mode[vd_path];
}
if (cur_hdr10_plus_process_mode[vd_path] !=
hdr10_plus_process_mode[vd_path]) {
if (cur_source_format[vd_path] == HDRTYPE_HDR10PLUS)
pr_csc(1,
"am_vecm: vd%d: hdr10_plus_process_mode %d to %d\n",
vd_path + 1,
cur_hdr10_plus_process_mode[vd_path],
hdr10_plus_process_mode[vd_path]);
cur_hdr10_plus_process_mode[vd_path] =
hdr10_plus_process_mode[vd_path];
}
if (cur_csc_type[vd_path] != csc_type) {
pr_csc(1, "am_vecm: vd%d: csc from 0x%x to 0x%x.\n",
vd_path + 1, cur_csc_type[vd_path], csc_type);
cur_csc_type[vd_path] = csc_type;
}
}

View File

@@ -0,0 +1,34 @@
/*
* drivers/amlogic/media/enhancement/amvecm/amcsc_pip.h
*
* Copyright (C) 2017 Amlogic, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#ifndef AM_CSC_PIP_H
#define AM_CSC_PIP_H
extern int hdr_policy_process(
struct vinfo_s *vinfo,
enum hdr_type_e *source_format,
enum vd_path_e vd_path);
extern void hdmi_packet_process(
int signal_change_flag,
struct vinfo_s *vinfo,
struct vframe_master_display_colour_s *p,
struct hdr10plus_para *hdmitx_hdr10plus_param,
enum vd_path_e vd_path);
extern void video_post_process(
enum vpp_matrix_csc_e csc_type,
struct vinfo_s *vinfo,
enum vd_path_e vd_path);
#endif

View File

@@ -183,7 +183,7 @@ unsigned int debug_game_mode_1;
module_param(debug_game_mode_1, uint, 0664);
MODULE_PARM_DESC(debug_game_mode_1, "\n debug_game_mode_1\n");
unsigned int pq_user_value;
enum hdr_type_e hdr_source_type = HDRTYPE_SDR;
enum hdr_type_e hdr_source_type = HDRTYPE_NONE;
#define SR0_OFFSET 0xc00
#define SR1_OFFSET 0xc80
@@ -1078,44 +1078,59 @@ int amvecm_on_vs(
unsigned int sps_w_in,
unsigned int sps_h_in,
unsigned int cm_in_w,
unsigned int cm_in_h)
unsigned int cm_in_h,
enum vd_path_e vd_path)
{
int result = 0;
if (probe_ok == 0)
return 0;
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
if (for_dolby_vision_certification())
if (for_dolby_vision_certification() && (vd_path == VD1_PATH))
return 0;
#endif
if (!dnlp_insmod_ok)
if (!dnlp_insmod_ok && vd_path == VD1_PATH)
dnlp_alg_param_init();
if (flags & CSC_FLAG_CHECK_OUTPUT) {
if (toggle_vf)
amvecm_fresh_overscan(toggle_vf);
else if (vf)
amvecm_fresh_overscan(vf);
if (vd_path == VD1_PATH) {
if (toggle_vf)
amvecm_fresh_overscan(toggle_vf);
else if (vf)
amvecm_fresh_overscan(vf);
}
/* to test if output will change */
return amvecm_matrix_process(
toggle_vf, vf, flags);
}
toggle_vf, vf, flags, vd_path);
} else if (vd_path == VD1_PATH)
send_hdr10_plus_pkt(vd_path);
if ((toggle_vf != NULL) || (vf != NULL)) {
/* matrix adjust */
result = amvecm_matrix_process(toggle_vf, vf, flags);
if (toggle_vf) {
result = amvecm_matrix_process(
toggle_vf, vf, flags, vd_path);
if (toggle_vf)
ioctrl_get_hdr_metadata(toggle_vf);
if (toggle_vf && vd_path == VD1_PATH) {
lc_process(toggle_vf, sps_h_en, sps_v_en,
sps_w_in, sps_h_in);
amvecm_size_patch(cm_in_w, cm_in_h);
}
} else {
amvecm_reset_overscan();
result = amvecm_matrix_process(NULL, NULL, flags);
ve_hist_gamma_reset();
lc_process(NULL, sps_h_en, sps_v_en,
sps_w_in, sps_h_in);
if (vd_path == VD1_PATH)
amvecm_reset_overscan();
result = amvecm_matrix_process(
NULL, NULL, flags, vd_path);
if (vd_path == VD1_PATH) {
ve_hist_gamma_reset();
lc_process(NULL, sps_h_en, sps_v_en,
sps_w_in, sps_h_in);
}
}
if (vd_path != VD1_PATH)
return result;
if (!is_dolby_vision_on())
get_hdr_source_type();
@@ -1617,7 +1632,8 @@ static long amvecm_ioctl(struct file *file,
case AMVECM_IOC_G_CSCTYPE:
argp = (void __user *)arg;
if (copy_to_user(argp,
&cur_csc_type, sizeof(enum vpp_matrix_csc_e)))
&cur_csc_type[VD1_PATH],
sizeof(enum vpp_matrix_csc_e)))
ret = -EFAULT;
break;
case AMVECM_IOC_G_COLOR_PRI:
@@ -1628,7 +1644,7 @@ static long amvecm_ioctl(struct file *file,
ret = -EFAULT;
break;
case AMVECM_IOC_S_CSCTYPE:
if (copy_from_user(&cur_csc_type,
if (copy_from_user(&cur_csc_type[VD1_PATH],
(void __user *)arg,
sizeof(enum vpp_matrix_csc_e))) {
ret = -EFAULT;
@@ -6781,7 +6797,7 @@ static int aml_vecm_probe(struct platform_device *pdev)
if (is_meson_gxl_cpu() || is_meson_gxm_cpu())
hdr_flag = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3);
else
hdr_flag = (1 << 0) | (1 << 1) | (0 << 2) | (0 << 3);
hdr_flag = (1 << 0) | (1 << 1) | (0 << 2) | (0 << 3) | (1 << 4);
hdr_init(&amvecm_dev.hdr_d);
aml_vecm_dt_parse(pdev);

View File

@@ -638,6 +638,7 @@ void hdr10_plus_hdmitx_vsif_parser(
int i;
int kpx, kpy;
int bz_cur_anchors[9];
u32 maxrgb_99_percentiles = 0;
memset(hdmitx_hdr10plus_param, 0, sizeof(struct hdr10plus_para));
@@ -702,7 +703,9 @@ void hdr10_plus_hdmitx_vsif_parser(
hdmitx_hdr10plus_param->average_maxrgb = (u8)ave_maxrgb;
for (i = 0; i < 9; i++) {
if (i == 2) {
if ((i == 2) &&
/* V0 sei update */
(hdmitx_hdr10plus_param->application_version != 0)) {
distribution_values[i] =
hdr_plus_sei.distribution_maxrgb_percentiles[0][i];
hdmitx_hdr10plus_param->distribution_values[i] =
@@ -711,6 +714,14 @@ void hdr10_plus_hdmitx_vsif_parser(
}
distribution_values[i] =
hdr_plus_sei.distribution_maxrgb_percentiles[0][i] / 10;
/* V0 sei update */
if ((hdr_plus_sei.num_distribution_maxrgb_percentiles[0] == 10)
&& (hdmitx_hdr10plus_param->application_version == 0)
&& (i == 8)) {
maxrgb_99_percentiles =
hdr_plus_sei.distribution_maxrgb_percentiles[0][i + 1];
distribution_values[i] = maxrgb_99_percentiles / 10;
}
if (distribution_values[i] < (1 << 12)) {
distribution_values[i] =
(distribution_values[i] + (1 << 3)) >> 4;
@@ -763,7 +774,7 @@ void hdr10_plus_hdmitx_vsif_parser(
/*only video, don't include graphic*/
hdmitx_hdr10plus_param->graphics_overlay_flag = 0;
/*metadata and video have no delay*/
hdmitx_hdr10plus_param->no_delay_flag = 0;
hdmitx_hdr10plus_param->no_delay_flag = 1;
memcpy(&dbg_hdr10plus_pkt, hdmitx_hdr10plus_param,
sizeof(struct hdr10plus_para));

File diff suppressed because it is too large Load Diff

View File

@@ -16,6 +16,7 @@
*/
#include <linux/types.h>
#include <linux/amlogic/media/vout/vinfo.h>
#ifndef MAX
#define MAX(x1, x2) (double)(x1 > x2 ? x1 : x2)
@@ -50,43 +51,48 @@ int64_t FloatRev(int64_t iA);
int64_t FloatCon(int64_t iA, int MOD);
enum hdr_module_sel {
VD1_HDR = 0x1,
VD2_HDR = 0x2,
OSD1_HDR = 0x4,
VDIN0_HDR = 0x8,
VDIN1_HDR = 0x10,
DI_HDR = 0x20,
VD1_HDR = 1,
VD2_HDR = 2,
OSD1_HDR = 3,
VDIN0_HDR = 4,
VDIN1_HDR = 5,
DI_HDR = 6,
HDR_MAX
};
enum hdr_matrix_sel {
HDR_IN_MTX = 0x1,
HDR_GAMUT_MTX = 0x2,
HDR_OUT_MTX = 0x4,
HDR_IN_MTX = 1,
HDR_GAMUT_MTX = 2,
HDR_OUT_MTX = 3,
HDR_MTX_MAX
};
enum hdr_lut_sel {
HDR_EOTF_LUT = 0x1,
HDR_OOTF_LUT = 0x2,
HDR_OETF_LUT = 0x4,
HDR_CGAIN_LUT = 0x8,
HDR_EOTF_LUT = 1,
HDR_OOTF_LUT = 2,
HDR_OETF_LUT = 3,
HDR_CGAIN_LUT = 4,
HDR_LUT_MAX
};
enum hdr_process_sel {
HDR_BYPASS = 0x1,
HDR_SDR = 0x2,
SDR_HDR = 0x4,
HLG_BYPASS = 0x8,
HLG_SDR = 0x10,
HLG_HDR = 0x20,
SDR_HLG = 0X40,
HDRPLUS_SDR = 0x80,
HDR_BYPASS = 1,
HDR_SDR = 2,
SDR_HDR = 3,
HLG_BYPASS = 4,
HLG_SDR = 5,
HLG_HDR = 6,
SDR_HLG = 7,
SDR_IPT = 8,
HDR_IPT = 9,
HLG_IPT = 10,
HDR_HLG = 11,
RGB_YUV = 12,
RGB_HDR = 13,
RGB_HLG = 14,
HDR_p_MAX
};
#define MTX_ON 1
#define MTX_OFF 0
@@ -101,13 +107,16 @@ enum hdr_process_sel {
#define HDR2_OETF_LUT_SIZE 149
#define HDR2_CGAIN_LUT_SIZE 65
#define MTX_NUM_PARAM 16
struct hdr_proc_mtx_param_s {
int mtx_only;
int mtx_in[15];
int mtx_in[MTX_NUM_PARAM];
int mtx_gamut[9];
int mtx_cgain[15];
int mtx_ogain[15];
int mtx_out[15];
int mtx_gamut_mode;
int mtx_cgain[MTX_NUM_PARAM];
int mtx_ogain[MTX_NUM_PARAM];
int mtx_out[MTX_NUM_PARAM];
int mtxi_pre_offset[3];
int mtxi_pos_offset[3];
int mtxo_pre_offset[3];
@@ -116,6 +125,10 @@ struct hdr_proc_mtx_param_s {
enum hdr_process_sel p_sel;
};
#define OO_BITS 12
#define OO_GAIN_SHIFT 3
#define OO_NOR (OO_BITS - OO_GAIN_SHIFT)
struct hdr_proc_lut_param_s {
int64_t eotf_lut[143];
int64_t oetf_lut[149];
@@ -130,8 +143,9 @@ typedef int64_t(*MenuFun)(int64_t);
void eotf_float_gen(int64_t *o_out, MenuFun eotf);
void oetf_float_gen(int64_t *bin_e, MenuFun oetf);
void nolinear_lut_gen(int64_t *bin_c, MenuFun cgain);
extern void hdr_func(enum hdr_module_sel module_sel,
enum hdr_process_sel hdr_process_select);
extern enum hdr_process_sel hdr_func(enum hdr_module_sel module_sel,
enum hdr_process_sel hdr_process_select,
struct vinfo_s *vinfo);
/*G12A vpp matrix*/
enum vpp_matrix_e {
VD1_MTX = 0x1,

View File

@@ -1009,11 +1009,13 @@ u32 get_video_enabled(void)
{
return video_enabled;
}
EXPORT_SYMBOL(get_video_enabled);
u32 get_videopip_enabled(void)
{
return video2_enabled;
}
EXPORT_SYMBOL(get_videopip_enabled);
/* show first frame*/
static bool show_first_frame_nosync;
@@ -5995,7 +5997,7 @@ struct vframe_s *dolby_vision_toggle_frame(struct vframe_s *vf)
struct vframe_s *toggle_vf = NULL;
int width_bl, width_el;
int height_bl, height_el;
int ret = dolby_vision_update_metadata(vf);
int ret;
if (!is_dolby_vision_el_disable() || for_dolby_vision_certification())
cur_dispbuf2 = dolby_vision_vf_peek_el(vf);
@@ -6051,11 +6053,24 @@ struct vframe_s *dolby_vision_toggle_frame(struct vframe_s *vf)
ori2_end_y_lines =
height_el - 1;
}
if (!get_video_enabled()) {
/* when video layer off */
/* not need to update setting */
dolby_vision_set_toggle_flag(0);
return NULL;
};
ret = dolby_vision_update_metadata(vf);
if (ret == 0) {
/* setting generated for this frame */
/* or DOVI in bypass mode */
toggle_vf = vf;
dolby_vision_set_toggle_flag(1);
} else if (ret == 1) {
/* both dolby and hdr module bypass */
toggle_vf = vf;
dolby_vision_set_toggle_flag(0);
} else {
/* fail generating setting for this frame */
toggle_vf = NULL;
@@ -6572,6 +6587,7 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id)
int toggle_cnt;
struct vframe_s *toggle_vf = NULL;
struct vframe_s *toggle_frame = NULL;
struct vframe_s *toggle_pip_frame = NULL;
int video1_off_req = 0;
int video2_off_req = 0;
struct vframe_s *cur_dispbuf_back = cur_dispbuf;
@@ -6816,8 +6832,11 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id)
#endif
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
/* check video frame before VECM process */
if (is_dolby_vision_enable() && vf)
if (is_dolby_vision_enable() && vf) {
dolby_vision_check_hdr10(vf);
dolby_vision_check_hdr10plus(vf);
dolby_vision_check_hlg(vf);
}
#endif
#ifdef CONFIG_TVIN_VDIN
/* patch for m8 4k2k wifidisplay bandwidth bottleneck */
@@ -7167,7 +7186,6 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id)
}
#if defined(CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_VECM)
refresh_on_vs(vf);
if (amvecm_on_vs(
(cur_dispbuf != &vf_local)
? cur_dispbuf : NULL,
@@ -7177,7 +7195,8 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id)
0,
0,
0,
0) == 1)
0,
VD1_PATH) == 1)
break;
#endif
vsync_toggle_frame(vf, __LINE__);
@@ -7262,7 +7281,6 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id)
break;
#endif
#if defined(CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_VECM)
refresh_on_vs(vf);
if (amvecm_on_vs(
(cur_dispbuf != &vf_local)
? cur_dispbuf : NULL,
@@ -7272,7 +7290,8 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id)
0,
0,
0,
0) == 1)
0,
VD1_PATH) == 1)
break;
#endif
vf = video_vf_get();
@@ -7319,7 +7338,8 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id)
} else
vsync_toggle_frame(cur_dispbuf,
__LINE__);
if (is_dolby_vision_enable()) {
if (is_dolby_vision_enable()
&& is_dolby_vision_video_on()) {
pause_vf = cur_dispbuf;
video_pause_global = 1;
} else {
@@ -7331,8 +7351,10 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id)
&& is_dolby_vision_enable()) {
toggle_vf = pause_vf;
dolby_vision_parse_metadata(
cur_dispbuf, 0, false);
cur_dispbuf, 2, false);
dolby_vision_set_toggle_flag(1);
//use previous setting
//pr_info("DOLBY: pause frame %p\n", toggle_vf);
}
break;
}
@@ -7361,11 +7383,38 @@ SET_FILTER:
pip_toggle_frame(cur_pipbuf);
while (vf) {
vf = pip_vf_get();
if (vf) {
if (!vf->frame_dirty)
if (!vf->frame_dirty) {
if (amvecm_on_vs(
vf,
vf, CSC_FLAG_CHECK_OUTPUT,
cur_frame_par ?
cur_frame_par->supsc1_hori_ratio
: 0,
cur_frame_par ?
cur_frame_par->supsc1_vert_ratio
: 0,
cur_frame_par ?
cur_frame_par->spsc1_w_in :
0,
cur_frame_par ?
cur_frame_par->spsc1_h_in :
0,
cur_frame_par ?
cur_frame_par->cm_input_w :
0,
cur_frame_par ?
cur_frame_par->cm_input_h :
0,
VD2_PATH) == 1)
break;
vf = pip_vf_get();
if (vf) {
pip_toggle_frame(vf);
else
toggle_pip_frame = vf;
}
} else {
vf = pip_vf_get();
if (vf)
pip_vf_put(vf);
}
vf = pip_vf_peek();
@@ -7379,29 +7428,62 @@ SET_FILTER:
}
#if defined(CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_VECM)
amvecm_on_vs(
(cur_dispbuf != &vf_local)
? cur_dispbuf : NULL,
toggle_frame,
toggle_frame ? CSC_FLAG_TOGGLE_FRAME : 0,
cur_frame_par ?
cur_frame_par->supsc1_hori_ratio :
0,
cur_frame_par ?
cur_frame_par->supsc1_vert_ratio :
0,
cur_frame_par ?
cur_frame_par->spsc1_w_in :
0,
cur_frame_par ?
cur_frame_par->spsc1_h_in :
0,
cur_frame_par ?
cur_frame_par->cm_input_w :
0,
cur_frame_par ?
cur_frame_par->cm_input_h :
0);
if (toggle_frame)
refresh_on_vs(toggle_frame);
else if (cur_dispbuf)
refresh_on_vs(cur_dispbuf);
amvecm_on_vs(
(cur_dispbuf != &vf_local)
? cur_dispbuf : NULL,
toggle_frame,
toggle_frame ? CSC_FLAG_TOGGLE_FRAME : 0,
cur_frame_par ?
cur_frame_par->supsc1_hori_ratio :
0,
cur_frame_par ?
cur_frame_par->supsc1_vert_ratio :
0,
cur_frame_par ?
cur_frame_par->spsc1_w_in :
0,
cur_frame_par ?
cur_frame_par->spsc1_h_in :
0,
cur_frame_par ?
cur_frame_par->cm_input_w :
0,
cur_frame_par ?
cur_frame_par->cm_input_h :
0,
VD1_PATH);
#ifdef VIDEO_PIP
amvecm_on_vs(
(cur_pipbuf != &local_pip)
? cur_pipbuf : NULL,
toggle_pip_frame,
toggle_pip_frame ? CSC_FLAG_TOGGLE_FRAME : 0,
cur_frame_par ?
cur_frame_par->supsc1_hori_ratio :
0,
cur_frame_par ?
cur_frame_par->supsc1_vert_ratio :
0,
cur_frame_par ?
cur_frame_par->spsc1_w_in :
0,
cur_frame_par ?
cur_frame_par->spsc1_h_in :
0,
cur_frame_par ?
cur_frame_par->cm_input_w :
0,
cur_frame_par ?
cur_frame_par->cm_input_h :
0,
VD2_PATH);
#endif
#endif
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
@@ -7412,11 +7494,13 @@ SET_FILTER:
/* force toggle when keeping frame after playing */
if ((cur_dispbuf == &vf_local)
&& !toggle_vf
&& is_dolby_vision_on()) {
&& is_dolby_vision_video_on()
&& get_video_enabled()) {
toggle_vf = cur_dispbuf;
dolby_vision_parse_metadata(
cur_dispbuf, 2, false);
toggle_vf, 2, false);
dolby_vision_set_toggle_flag(1);
//pr_info("DOLBY: keep frame %p", toggle_vf);
}
/* pause mode was moved to video display property */
#if 0
@@ -7473,7 +7557,8 @@ SET_FILTER:
toggle_vf->compHeight : toggle_vf->height;
frame_size = (h_size << 16) | v_size;
}
dolby_vision_process(toggle_vf, frame_size, pps_state);
dolby_vision_process((cur_dispbuf != &vf_local)
? cur_dispbuf : toggle_vf, frame_size, pps_state);
dolby_vision_update_setting();
}
#endif
@@ -13059,6 +13144,12 @@ int vout_notify_callback(struct notifier_block *block, unsigned long cmd,
vsync_pts_inc_scale_base = vinfo->sync_duration_num;
spin_unlock_irqrestore(&lock, flags);
new_vmode = vinfo->mode;
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
pr_info("vout_notify_callback: VOUT_EVENT_MODE_CHANGE");
/* make sure dolby policy process runs atleast once */
if (is_dolby_vision_enable())
dolby_vision_set_toggle_flag(1);
#endif
break;
case VOUT_EVENT_OSD_PREBLEND_ENABLE:
break;

View File

@@ -73,13 +73,14 @@ static int set_disp_mode_auto(void);
static void hdmitx_get_edid(struct hdmitx_dev *hdev);
static void hdmitx_set_drm_pkt(struct master_display_info_s *data);
static void hdmitx_set_vsif_pkt(enum eotf_type type, enum mode_type
tunnel_mode, struct dv_vsif_para *data);
tunnel_mode, struct dv_vsif_para *data, bool switch_to_sdr);
static void hdmitx_set_hdr10plus_pkt(unsigned int flag,
struct hdr10plus_para *data);
static void hdmitx_set_emp_pkt(unsigned char *data,
unsigned int type, unsigned int size);
static int check_fbc_special(unsigned char *edid_dat);
static struct vinfo_s *hdmitx_get_current_vinfo(void);
static void hdmitx_fmt_attr(struct hdmitx_dev *hdev);
static DEFINE_MUTEX(setclk_mutex);
static DEFINE_MUTEX(getedid_mutex);
@@ -607,8 +608,12 @@ static ssize_t show_attr(struct device *dev,
struct device_attribute *attr, char *buf)
{
int pos = 0;
pos += snprintf(buf+pos, PAGE_SIZE, "%s\n\r", hdmitx_device.fmt_attr);
if (!memcmp(hdmitx_device.fmt_attr, "default,", 7)) {
memset(hdmitx_device.fmt_attr, 0,
sizeof(hdmitx_device.fmt_attr));
hdmitx_fmt_attr(&hdmitx_device);
}
pos += snprintf(buf+pos, PAGE_SIZE, "%s\n", hdmitx_device.fmt_attr);
return pos;
}
@@ -617,6 +622,14 @@ ssize_t store_attr(struct device *dev,
{
strncpy(hdmitx_device.fmt_attr, buf, sizeof(hdmitx_device.fmt_attr));
hdmitx_device.fmt_attr[15] = '\0';
if (!memcmp(hdmitx_device.fmt_attr, "rgb", 3))
hdmitx_device.para->cs = COLORSPACE_RGB444;
else if (!memcmp(hdmitx_device.fmt_attr, "422", 3))
hdmitx_device.para->cs = COLORSPACE_YUV422;
else if (!memcmp(hdmitx_device.fmt_attr, "420", 3))
hdmitx_device.para->cs = COLORSPACE_YUV420;
else
hdmitx_device.para->cs = COLORSPACE_YUV444;
return count;
}
/*aud_mode attr*/
@@ -1387,7 +1400,7 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data)
}
static void hdmitx_set_vsif_pkt(enum eotf_type type,
enum mode_type tunnel_mode, struct dv_vsif_para *data)
enum mode_type tunnel_mode, struct dv_vsif_para *data, bool signal_sdr)
{
struct hdmitx_dev *hdev = &hdmitx_device;
struct dv_vsif_para para = {0};
@@ -1484,14 +1497,17 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type,
else
hdev->HWOp.SetPacket(
HDMI_PACKET_VEND, NULL, NULL);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_RGBYCC_INDIC, hdev->para->cs);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_Q01, RGB_RANGE_LIM);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_YQ01, YCC_RANGE_LIM);
hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020,
CLR_AVI_BT2020);/*BT709*/
if (signal_sdr) {
pr_info("hdmitx: H14b VSIF, switching signal to SDR\n");
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_RGBYCC_INDIC, hdev->para->cs);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_Q01, RGB_RANGE_DEFAULT);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_YQ01, YCC_RANGE_LIM);
hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020,
CLR_AVI_BT2020);/*BT709*/
}
}
}
@@ -1503,6 +1519,8 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type,
if (data == NULL)
data = &para;
len = 0x1b;
/*4k vsif package */
if ((vic == HDMI_3840x2160p30_16x9) ||
(vic == HDMI_3840x2160p25_16x9) ||
@@ -1513,14 +1531,13 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type,
switch (type) {
case EOTF_T_DOLBYVISION:
case EOTF_T_LL_MODE:
len = 0x1b;
hdev->dv_src_feature = 1;
break;
case EOTF_T_HDR10:
case EOTF_T_SDR:
case EOTF_T_NULL:
default:
len = 0x5;
hdev->dv_src_feature = 0;
break;
}
@@ -1605,14 +1622,18 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type,
} else
hdev->HWOp.SetPacket(
HDMI_PACKET_VEND, NULL, NULL);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_RGBYCC_INDIC, hdev->para->cs);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_Q01, RGB_RANGE_LIM);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_YQ01, YCC_RANGE_LIM);
hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020,
if (signal_sdr) {
pr_info("hdmitx: Dolby VSIF, switching signal to SDR\n");
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_RGBYCC_INDIC, hdev->para->cs);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_Q01, RGB_RANGE_DEFAULT);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_YQ01, YCC_RANGE_LIM);
hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020,
CLR_AVI_BT2020);/*BT709*/
}
}
}
}
@@ -2049,7 +2070,7 @@ static ssize_t store_config(struct device *dev,
data.features = 0x00091200;
hdmitx_set_drm_pkt(&data);
} else if (strncmp(buf, "vsif", 4) == 0)
hdmitx_set_vsif_pkt(buf[4] - '0', buf[5] == '1', NULL);
hdmitx_set_vsif_pkt(buf[4] - '0', buf[5] == '1', NULL, true);
else if (strncmp(buf, "emp", 3) == 0) {
if (hdmitx_device.chip_type >= MESON_CPU_ID_G12A)
hdmitx_set_emp_pkt(NULL, 1, 1);
@@ -4100,7 +4121,7 @@ static void hdmitx_hpd_plugout_handler(struct work_struct *work)
return;
}
/*after plugout, DV mode can't be supported*/
hdmitx_set_vsif_pkt(0, 0, NULL);
hdmitx_set_vsif_pkt(0, 0, NULL, true);
hdmitx_set_hdr10plus_pkt(0, NULL);
hdev->ready = 0;
if (hdev->repeater_tx)
@@ -4271,7 +4292,7 @@ static int get_dt_vend_init_data(struct device_node *np,
return 0;
}
static void hdmitx_init_fmt_attr(struct hdmitx_dev *hdev)
static void hdmitx_fmt_attr(struct hdmitx_dev *hdev)
{
if (strlen(hdev->fmt_attr) >= 8) {
pr_info(SYS "fmt_attr %s\n", hdev->fmt_attr);
@@ -4317,6 +4338,20 @@ static void hdmitx_init_fmt_attr(struct hdmitx_dev *hdev)
pr_info(SYS "fmt_attr %s\n", hdev->fmt_attr);
}
static void hdmitx_init_fmt_attr(struct hdmitx_dev *hdev)
{
if (strlen(hdev->fmt_attr) >= 8) {
pr_info(SYS "fmt_attr %s\n", hdev->fmt_attr);
return;
}
if ((hdev->para->cd == COLORDEPTH_RESERVED) &&
(hdev->para->cs == COLORSPACE_RESERVED)) {
strcpy(hdev->fmt_attr, "default");
} else
hdmitx_fmt_attr(hdev);
pr_info(SYS "fmt_attr %s\n", hdev->fmt_attr);
}
/* for notify to cec */
static BLOCKING_NOTIFIER_HEAD(hdmitx_event_notify_list);
int hdmitx_event_notifier_regist(struct notifier_block *nb)

View File

@@ -23,9 +23,34 @@
#include <linux/types.h>
#define DOLBY_VISION_OUTPUT_MODE_IPT 0
#define DOLBY_VISION_OUTPUT_MODE_IPT_TUNNEL 1
#define DOLBY_VISION_OUTPUT_MODE_HDR10 2
#define DOLBY_VISION_OUTPUT_MODE_SDR10 3
#define DOLBY_VISION_OUTPUT_MODE_SDR8 4
#define DOLBY_VISION_OUTPUT_MODE_BYPASS 5
/* STB: if sink support DV, always output DV*/
/* else always output SDR/HDR */
/* TV: when source is DV, convert to SDR */
#define DOLBY_VISION_FOLLOW_SINK 0
/* STB: output DV only if source is DV*/
/* and sink support DV*/
/* else always output SDR/HDR */
/* TV: when source is DV or HDR, convert to SDR */
#define DOLBY_VISION_FOLLOW_SOURCE 1
/* STB: always follow dolby_vision_mode */
/* TV: if set dolby_vision_mode to SDR8,*/
/* convert all format to SDR by TV core,*/
/* else bypass Dolby Vision */
#define DOLBY_VISION_FORCE_OUTPUT_MODE 2
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);
@@ -60,6 +85,8 @@ 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(
u32 tbl_id, uint64_t value);
extern void tv_dolby_vision_efuse_info(void);
@@ -75,6 +102,8 @@ 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 int get_dolby_vision_policy(void);
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);
#endif

View File

@@ -97,9 +97,13 @@
#define MTX_BYPASS_RGB_OGO (1 << 0)
#define MTX_RGB2YUVL_RGB_OGO (1 << 1)
#define SDR_SOURCE (1 << 0)
#define HDR10_SOURCE (1 << 1)
#define HLG_SOURCE (1 << 2)
#define UNKNOWN_SOURCE 0
#define HDR10_SOURCE 1
#define HDR10PLUS_SOURCE 2
#define DOVI_SOURCE 3
#define PRIMESL_SOURCE 4
#define HLG_SOURCE 5
#define SDR_SOURCE 6
enum cm_hist_e {
CM_HUE_HIST = 0,
@@ -270,11 +274,12 @@ enum vpp_matrix_csc_e {
};
enum hdr_type_e {
HDRTYPE_NONE = 0,
HDRTYPE_SDR = 0x1,
HDRTYPE_HDR10 = 0x2,
HDRTYPE_HLG = 0x4,
HDRTYPE_MAX,
HDRTYPE_NONE = UNKNOWN_SOURCE,
HDRTYPE_SDR = SDR_SOURCE,
HDRTYPE_HDR10 = HDR10_SOURCE,
HDRTYPE_HLG = HLG_SOURCE,
HDRTYPE_HDR10PLUS = HDR10PLUS_SOURCE,
HDRTYPE_DOVI = DOVI_SOURCE
};
enum vpp_transfer_characteristic_e {
@@ -351,6 +356,12 @@ struct vecm_match_data_s {
u32 vlk_pll_sel;/*independent panel pll and hdmitx pll*/
};
enum vd_path_e {
VD1_PATH = 0,
VD2_PATH = 1,
VD_PATH_MAX = 2
};
/*overscan:
*length 0~31bit :number of crop;
*src_timing: bit31: on: load/save all crop
@@ -464,7 +475,8 @@ extern int amvecm_on_vs(
unsigned int sps_w_in,
unsigned int sps_h_in,
unsigned int cm_in_w,
unsigned int cm_in_h);
unsigned int cm_in_h,
enum vd_path_e vd_path);
extern void refresh_on_vs(struct vframe_s *vf);
extern void pc_mode_process(void);
extern void pq_user_latch_process(void);

View File

@@ -102,6 +102,7 @@ struct hdr10_plus_info {
struct hdr_info {
/* RX EDID hdr support types */
u32 hdr_support;
unsigned char rawdata[7];
/*
*dynamic_info[0] expresses type1's parameters certainly
*dynamic_info[1] expresses type2's parameters certainly
@@ -219,7 +220,8 @@ struct vout_device_s {
const struct dv_info *dv_info;
void (*fresh_tx_hdr_pkt)(struct master_display_info_s *data);
void (*fresh_tx_vsif_pkt)(enum eotf_type type,
enum mode_type tunnel_mode, struct dv_vsif_para *data);
enum mode_type tunnel_mode, struct dv_vsif_para *data,
bool signal_sdr);
void (*fresh_tx_hdr10plus_pkt)(unsigned int flag,
struct hdr10plus_para *data);
void (*fresh_tx_emp_pkt)(unsigned char *data, unsigned int type,