Merge "video: driver: Add support for AV1D IBC feature"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

melakukan
b5824aaaa4
@@ -1054,8 +1054,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
|
||||
num_vpp_pipes) \
|
||||
do \
|
||||
{ \
|
||||
HFI_U32 vpssLBSize, ibcBufSize, opbwr1BufSize, \
|
||||
opbwr8, opbwr10, ibc8, ibc10; \
|
||||
HFI_U32 vpssLBSize, opbwr1BufSize, opbwr8, opbwr10; \
|
||||
_size = HFI_ALIGN(SIZE_AV1D_LB_FE_TOP_DATA(frame_width, frame_height), \
|
||||
VENUS_DMA_ALIGNMENT) + \
|
||||
HFI_ALIGN(SIZE_AV1D_LB_FE_TOP_CTRL(frame_width, frame_height), \
|
||||
@@ -1086,13 +1085,14 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
|
||||
SIZE_VPSS_LB(vpssLBSize, frame_width, frame_height, num_vpp_pipes); \
|
||||
_size = HFI_ALIGN((_size + vpssLBSize), VENUS_DMA_ALIGNMENT); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
SIZE_AV1D_IBC_NV12_UBWC(ibc8, frame_width, frame_height); \
|
||||
SIZE_AV1D_IBC_TP10_UBWC(ibc10, frame_width, frame_height); \
|
||||
ibcBufSize = MAX(ibc8, ibc10); \
|
||||
_size = HFI_ALIGN((_size + ibcBufSize), VENUS_DMA_ALIGNMENT); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define HFI_BUFFER_IBC_AV1D(_size, frame_width, frame_height) \
|
||||
do { \
|
||||
HFI_U32 ibc8, ibc10; \
|
||||
SIZE_AV1D_IBC_NV12_UBWC(ibc8, frame_width, frame_height); \
|
||||
SIZE_AV1D_IBC_TP10_UBWC(ibc10, frame_width, frame_height); \
|
||||
_size = HFI_ALIGN(MAX(ibc8, ibc10), VENUS_DMA_ALIGNMENT); \
|
||||
} while (0)
|
||||
|
||||
#define AV1_CABAC_HDR_RATIO_HD_TOT 2
|
||||
|
@@ -165,11 +165,9 @@ static u32 msm_vidc_decoder_line_size_iris3(struct msm_vidc_inst *inst)
|
||||
is_opb = false;
|
||||
/*
|
||||
* assume worst case, since color format is unknown at this
|
||||
* time. The exception is AV1D, where line buffer size is larger
|
||||
* in DPB-only mode.
|
||||
* time.
|
||||
*/
|
||||
if (inst->codec != MSM_VIDC_AV1)
|
||||
is_opb = true;
|
||||
is_opb = true;
|
||||
|
||||
if (inst->decode_vpp_delay.enable)
|
||||
vpp_delay = inst->decode_vpp_delay.size;
|
||||
@@ -197,6 +195,28 @@ static u32 msm_vidc_decoder_line_size_iris3(struct msm_vidc_inst *inst)
|
||||
return size;
|
||||
}
|
||||
|
||||
static u32 msm_vidc_decoder_partial_data_size_iris3(struct msm_vidc_inst *inst)
|
||||
{
|
||||
u32 size = 0;
|
||||
u32 width, height;
|
||||
struct v4l2_format *f;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
|
||||
f = &inst->fmts[INPUT_PORT];
|
||||
width = f->fmt.pix_mp.width;
|
||||
height = f->fmt.pix_mp.height;
|
||||
|
||||
if (inst->codec == MSM_VIDC_AV1)
|
||||
HFI_BUFFER_IBC_AV1D(size, width, height);
|
||||
|
||||
i_vpr_l(inst, "%s: size %d\n", __func__, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
static u32 msm_vidc_decoder_persist_size_iris3(struct msm_vidc_inst *inst)
|
||||
{
|
||||
u32 size = 0;
|
||||
@@ -543,6 +563,7 @@ int msm_buffer_size_iris3(struct msm_vidc_inst *inst,
|
||||
{MSM_VIDC_BUF_LINE, msm_vidc_decoder_line_size_iris3 },
|
||||
{MSM_VIDC_BUF_PERSIST, msm_vidc_decoder_persist_size_iris3 },
|
||||
{MSM_VIDC_BUF_DPB, msm_vidc_decoder_dpb_size_iris3 },
|
||||
{MSM_VIDC_BUF_PARTIAL_DATA, msm_vidc_decoder_partial_data_size_iris3 },
|
||||
};
|
||||
static const struct msm_vidc_buf_type_handle enc_buf_type_handle[] = {
|
||||
{MSM_VIDC_BUF_INPUT, msm_vidc_encoder_input_size },
|
||||
@@ -675,6 +696,7 @@ int msm_buffer_min_count_iris3(struct msm_vidc_inst *inst,
|
||||
case MSM_VIDC_BUF_PERSIST:
|
||||
case MSM_VIDC_BUF_ARP:
|
||||
case MSM_VIDC_BUF_VPSS:
|
||||
case MSM_VIDC_BUF_PARTIAL_DATA:
|
||||
count = msm_vidc_internal_buffer_count(inst, buffer_type);
|
||||
break;
|
||||
case MSM_VIDC_BUF_DPB:
|
||||
|
@@ -88,18 +88,19 @@ enum hfi_packet_port_type {
|
||||
};
|
||||
|
||||
enum hfi_buffer_type {
|
||||
HFI_BUFFER_BITSTREAM = 0x00000001,
|
||||
HFI_BUFFER_RAW = 0x00000002,
|
||||
HFI_BUFFER_METADATA = 0x00000003,
|
||||
HFI_BUFFER_SUBCACHE = 0x00000004,
|
||||
HFI_BUFFER_DPB = 0x00000006,
|
||||
HFI_BUFFER_BIN = 0x00000007,
|
||||
HFI_BUFFER_LINE = 0x00000008,
|
||||
HFI_BUFFER_ARP = 0x00000009,
|
||||
HFI_BUFFER_COMV = 0x0000000A,
|
||||
HFI_BUFFER_NON_COMV = 0x0000000B,
|
||||
HFI_BUFFER_PERSIST = 0x0000000C,
|
||||
HFI_BUFFER_VPSS = 0x0000000D,
|
||||
HFI_BUFFER_BITSTREAM = 0x00000001,
|
||||
HFI_BUFFER_RAW = 0x00000002,
|
||||
HFI_BUFFER_METADATA = 0x00000003,
|
||||
HFI_BUFFER_SUBCACHE = 0x00000004,
|
||||
HFI_BUFFER_PARTIAL_DATA = 0x00000005,
|
||||
HFI_BUFFER_DPB = 0x00000006,
|
||||
HFI_BUFFER_BIN = 0x00000007,
|
||||
HFI_BUFFER_LINE = 0x00000008,
|
||||
HFI_BUFFER_ARP = 0x00000009,
|
||||
HFI_BUFFER_COMV = 0x0000000A,
|
||||
HFI_BUFFER_NON_COMV = 0x0000000B,
|
||||
HFI_BUFFER_PERSIST = 0x0000000C,
|
||||
HFI_BUFFER_VPSS = 0x0000000D,
|
||||
};
|
||||
|
||||
enum hfi_buffer_host_flags {
|
||||
|
@@ -96,7 +96,8 @@ static inline is_internal_buffer(enum msm_vidc_buffer_type buffer_type)
|
||||
buffer_type == MSM_VIDC_BUF_LINE ||
|
||||
buffer_type == MSM_VIDC_BUF_DPB ||
|
||||
buffer_type == MSM_VIDC_BUF_PERSIST ||
|
||||
buffer_type == MSM_VIDC_BUF_VPSS;
|
||||
buffer_type == MSM_VIDC_BUF_VPSS ||
|
||||
buffer_type == MSM_VIDC_BUF_PARTIAL_DATA;
|
||||
}
|
||||
|
||||
static inline bool is_input_meta_enabled(struct msm_vidc_inst *inst)
|
||||
|
@@ -38,6 +38,7 @@ struct msm_vidc_allocations_info {
|
||||
struct msm_vidc_allocations dpb;
|
||||
struct msm_vidc_allocations persist;
|
||||
struct msm_vidc_allocations vpss;
|
||||
struct msm_vidc_allocations partial_data;
|
||||
};
|
||||
|
||||
struct msm_vidc_mappings_info {
|
||||
@@ -53,6 +54,7 @@ struct msm_vidc_mappings_info {
|
||||
struct msm_vidc_mappings dpb;
|
||||
struct msm_vidc_mappings persist;
|
||||
struct msm_vidc_mappings vpss;
|
||||
struct msm_vidc_mappings partial_data;
|
||||
};
|
||||
|
||||
struct msm_vidc_buffers_info {
|
||||
@@ -70,6 +72,7 @@ struct msm_vidc_buffers_info {
|
||||
struct msm_vidc_buffers dpb;
|
||||
struct msm_vidc_buffers persist;
|
||||
struct msm_vidc_buffers vpss;
|
||||
struct msm_vidc_buffers partial_data;
|
||||
};
|
||||
|
||||
enum msm_vidc_inst_state {
|
||||
|
@@ -178,6 +178,7 @@ enum msm_vidc_buffer_type {
|
||||
MSM_VIDC_BUF_DPB = 12,
|
||||
MSM_VIDC_BUF_PERSIST = 13,
|
||||
MSM_VIDC_BUF_VPSS = 14,
|
||||
MSM_VIDC_BUF_PARTIAL_DATA = 15,
|
||||
};
|
||||
|
||||
/* always match with v4l2 flags V4L2_BUF_FLAG_* */
|
||||
|
@@ -76,6 +76,7 @@ u32 get_hfi_port_from_buffer_type(struct msm_vidc_inst *inst,
|
||||
case MSM_VIDC_BUF_COMV:
|
||||
case MSM_VIDC_BUF_NON_COMV:
|
||||
case MSM_VIDC_BUF_LINE:
|
||||
case MSM_VIDC_BUF_PARTIAL_DATA:
|
||||
hfi_port = HFI_PORT_BITSTREAM;
|
||||
break;
|
||||
case MSM_VIDC_BUF_OUTPUT:
|
||||
@@ -156,6 +157,8 @@ u32 hfi_buf_type_from_driver(enum msm_vidc_domain_type domain,
|
||||
return HFI_BUFFER_PERSIST;
|
||||
case MSM_VIDC_BUF_VPSS:
|
||||
return HFI_BUFFER_VPSS;
|
||||
case MSM_VIDC_BUF_PARTIAL_DATA:
|
||||
return HFI_BUFFER_PARTIAL_DATA;
|
||||
default:
|
||||
d_vpr_e("invalid buffer type %d\n",
|
||||
buffer_type);
|
||||
@@ -204,6 +207,8 @@ u32 hfi_buf_type_to_driver(enum msm_vidc_domain_type domain,
|
||||
return MSM_VIDC_BUF_PERSIST;
|
||||
case HFI_BUFFER_VPSS:
|
||||
return MSM_VIDC_BUF_VPSS;
|
||||
case HFI_BUFFER_PARTIAL_DATA:
|
||||
return MSM_VIDC_BUF_PARTIAL_DATA;
|
||||
default:
|
||||
d_vpr_e("invalid buffer type %d\n",
|
||||
buffer_type);
|
||||
|
@@ -86,6 +86,7 @@ static const u32 msm_vdec_internal_buffer_type[] = {
|
||||
MSM_VIDC_BUF_COMV,
|
||||
MSM_VIDC_BUF_NON_COMV,
|
||||
MSM_VIDC_BUF_LINE,
|
||||
MSM_VIDC_BUF_PARTIAL_DATA,
|
||||
};
|
||||
|
||||
struct msm_vdec_prop_type_handle {
|
||||
|
@@ -912,6 +912,7 @@ void *msm_vidc_open(void *vidc_core, u32 session_type)
|
||||
INIT_LIST_HEAD(&inst->buffers.dpb.list);
|
||||
INIT_LIST_HEAD(&inst->buffers.persist.list);
|
||||
INIT_LIST_HEAD(&inst->buffers.vpss.list);
|
||||
INIT_LIST_HEAD(&inst->buffers.partial_data.list);
|
||||
INIT_LIST_HEAD(&inst->allocations.bin.list);
|
||||
INIT_LIST_HEAD(&inst->allocations.arp.list);
|
||||
INIT_LIST_HEAD(&inst->allocations.comv.list);
|
||||
@@ -920,6 +921,7 @@ void *msm_vidc_open(void *vidc_core, u32 session_type)
|
||||
INIT_LIST_HEAD(&inst->allocations.dpb.list);
|
||||
INIT_LIST_HEAD(&inst->allocations.persist.list);
|
||||
INIT_LIST_HEAD(&inst->allocations.vpss.list);
|
||||
INIT_LIST_HEAD(&inst->allocations.partial_data.list);
|
||||
INIT_LIST_HEAD(&inst->mappings.input.list);
|
||||
INIT_LIST_HEAD(&inst->mappings.input_meta.list);
|
||||
INIT_LIST_HEAD(&inst->mappings.output.list);
|
||||
@@ -932,6 +934,7 @@ void *msm_vidc_open(void *vidc_core, u32 session_type)
|
||||
INIT_LIST_HEAD(&inst->mappings.dpb.list);
|
||||
INIT_LIST_HEAD(&inst->mappings.persist.list);
|
||||
INIT_LIST_HEAD(&inst->mappings.vpss.list);
|
||||
INIT_LIST_HEAD(&inst->mappings.partial_data.list);
|
||||
INIT_LIST_HEAD(&inst->children_list);
|
||||
INIT_LIST_HEAD(&inst->firmware_list);
|
||||
INIT_LIST_HEAD(&inst->enc_input_crs);
|
||||
|
@@ -181,7 +181,8 @@ u32 msm_vidc_internal_buffer_count(struct msm_vidc_inst *inst,
|
||||
if (is_decode_session(inst)) {
|
||||
if (buffer_type == MSM_VIDC_BUF_BIN ||
|
||||
buffer_type == MSM_VIDC_BUF_LINE ||
|
||||
buffer_type == MSM_VIDC_BUF_PERSIST) {
|
||||
buffer_type == MSM_VIDC_BUF_PERSIST ||
|
||||
buffer_type == MSM_VIDC_BUF_PARTIAL_DATA) {
|
||||
count = 1;
|
||||
} else if (buffer_type == MSM_VIDC_BUF_COMV ||
|
||||
buffer_type == MSM_VIDC_BUF_NON_COMV) {
|
||||
|
@@ -247,6 +247,7 @@ static const struct msm_vidc_buf_type_name buf_type_name_arr[] = {
|
||||
{MSM_VIDC_BUF_DPB, "DPB" },
|
||||
{MSM_VIDC_BUF_PERSIST, "PERSIST" },
|
||||
{MSM_VIDC_BUF_VPSS, "VPSS" },
|
||||
{MSM_VIDC_BUF_PARTIAL_DATA, "PARTIAL_DATA" },
|
||||
};
|
||||
|
||||
const char *buf_name(enum msm_vidc_buffer_type type)
|
||||
@@ -983,6 +984,7 @@ u32 msm_vidc_get_buffer_region(struct msm_vidc_inst *inst,
|
||||
break;
|
||||
case MSM_VIDC_BUF_DPB:
|
||||
case MSM_VIDC_BUF_VPSS:
|
||||
case MSM_VIDC_BUF_PARTIAL_DATA:
|
||||
region = MSM_VIDC_NON_SECURE_PIXEL;
|
||||
break;
|
||||
case MSM_VIDC_BUF_INPUT_META:
|
||||
@@ -1018,6 +1020,7 @@ u32 msm_vidc_get_buffer_region(struct msm_vidc_inst *inst,
|
||||
break;
|
||||
case MSM_VIDC_BUF_DPB:
|
||||
case MSM_VIDC_BUF_VPSS:
|
||||
case MSM_VIDC_BUF_PARTIAL_DATA:
|
||||
region = MSM_VIDC_SECURE_PIXEL;
|
||||
break;
|
||||
case MSM_VIDC_BUF_BIN:
|
||||
@@ -1070,6 +1073,8 @@ struct msm_vidc_buffers *msm_vidc_get_buffers(
|
||||
return &inst->buffers.persist;
|
||||
case MSM_VIDC_BUF_VPSS:
|
||||
return &inst->buffers.vpss;
|
||||
case MSM_VIDC_BUF_PARTIAL_DATA:
|
||||
return &inst->buffers.partial_data;
|
||||
case MSM_VIDC_BUF_QUEUE:
|
||||
return NULL;
|
||||
default:
|
||||
@@ -1108,6 +1113,8 @@ struct msm_vidc_mappings *msm_vidc_get_mappings(
|
||||
return &inst->mappings.persist;
|
||||
case MSM_VIDC_BUF_VPSS:
|
||||
return &inst->mappings.vpss;
|
||||
case MSM_VIDC_BUF_PARTIAL_DATA:
|
||||
return &inst->mappings.partial_data;
|
||||
default:
|
||||
i_vpr_e(inst, "%s: invalid driver buffer type %d\n",
|
||||
func, buffer_type);
|
||||
@@ -1136,6 +1143,8 @@ struct msm_vidc_allocations *msm_vidc_get_allocations(
|
||||
return &inst->allocations.persist;
|
||||
case MSM_VIDC_BUF_VPSS:
|
||||
return &inst->allocations.vpss;
|
||||
case MSM_VIDC_BUF_PARTIAL_DATA:
|
||||
return &inst->allocations.partial_data;
|
||||
default:
|
||||
i_vpr_e(inst, "%s: invalid driver buffer type %d\n",
|
||||
func, buffer_type);
|
||||
@@ -5266,6 +5275,7 @@ void msm_vidc_destroy_buffers(struct msm_vidc_inst *inst)
|
||||
MSM_VIDC_BUF_DPB,
|
||||
MSM_VIDC_BUF_PERSIST,
|
||||
MSM_VIDC_BUF_VPSS,
|
||||
MSM_VIDC_BUF_PARTIAL_DATA,
|
||||
};
|
||||
int i;
|
||||
|
||||
|
@@ -169,7 +169,8 @@ bool is_valid_hfi_buffer_type(struct msm_vidc_inst *inst,
|
||||
buffer_type != HFI_BUFFER_LINE &&
|
||||
buffer_type != HFI_BUFFER_DPB &&
|
||||
buffer_type != HFI_BUFFER_PERSIST &&
|
||||
buffer_type != HFI_BUFFER_VPSS) {
|
||||
buffer_type != HFI_BUFFER_VPSS &&
|
||||
buffer_type != HFI_BUFFER_PARTIAL_DATA) {
|
||||
i_vpr_e(inst, "%s: invalid buffer type %#x\n",
|
||||
func, buffer_type);
|
||||
return false;
|
||||
@@ -1217,6 +1218,7 @@ static int handle_session_buffer(struct msm_vidc_inst *inst,
|
||||
{HFI_BUFFER_NON_COMV, handle_release_internal_buffer },
|
||||
{HFI_BUFFER_LINE, handle_release_internal_buffer },
|
||||
{HFI_BUFFER_PERSIST, handle_release_internal_buffer },
|
||||
{HFI_BUFFER_PARTIAL_DATA, handle_release_internal_buffer },
|
||||
};
|
||||
static const struct msm_vidc_hfi_buffer_handle dec_output_hfi_handle[] = {
|
||||
{HFI_BUFFER_METADATA, handle_output_metadata_buffer },
|
||||
|
Reference in New Issue
Block a user