video: driver: remove capability pointer
Remove capability pointer and allocate memory with max cap size. Change-Id: I7f53e3b35439f91b72f057695b6e63f71bfecc0a Signed-off-by: Ankush Mitra <quic_ankumitr@quicinc.com>
This commit is contained in:
@@ -24,7 +24,7 @@ static u32 msm_vidc_decoder_bin_size_iris3(struct msm_vidc_inst *inst)
|
||||
bool is_interlaced;
|
||||
u32 vpp_delay;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ static u32 msm_vidc_decoder_bin_size_iris3(struct msm_vidc_inst *inst)
|
||||
vpp_delay = inst->decode_vpp_delay.size;
|
||||
else
|
||||
vpp_delay = DEFAULT_BSE_VPP_DELAY;
|
||||
if (inst->capabilities->cap[CODED_FRAMES].value ==
|
||||
if (inst->capabilities[CODED_FRAMES].value ==
|
||||
CODED_FRAMES_PROGRESSIVE)
|
||||
is_interlaced = false;
|
||||
else
|
||||
@@ -70,7 +70,7 @@ static u32 msm_vidc_decoder_comv_size_iris3(struct msm_vidc_inst* inst)
|
||||
u32 width, height, num_comv, vpp_delay;
|
||||
struct v4l2_format *f;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ static u32 msm_vidc_decoder_comv_size_iris3(struct msm_vidc_inst* inst)
|
||||
* should not be allocated separately.
|
||||
* When DRAP is disabled, COMV buffer must be allocated.
|
||||
*/
|
||||
if (inst->capabilities->cap[DRAP].value)
|
||||
if (inst->capabilities[DRAP].value)
|
||||
size = 0;
|
||||
else
|
||||
HFI_BUFFER_COMV_AV1D(size, width, height, num_comv);
|
||||
@@ -242,7 +242,7 @@ static u32 msm_vidc_decoder_persist_size_iris3(struct msm_vidc_inst *inst)
|
||||
return size;
|
||||
}
|
||||
|
||||
if (inst->capabilities->cap[META_DOLBY_RPU].value)
|
||||
if (inst->capabilities[META_DOLBY_RPU].value)
|
||||
rpu_enabled = 1;
|
||||
|
||||
if (inst->codec == MSM_VIDC_H264) {
|
||||
@@ -259,10 +259,10 @@ static u32 msm_vidc_decoder_persist_size_iris3(struct msm_vidc_inst *inst)
|
||||
* When DRAP is disabled, COMV buffer should not be included in PERSIST
|
||||
* buffer.
|
||||
*/
|
||||
if (inst->capabilities->cap[DRAP].value)
|
||||
if (inst->capabilities[DRAP].value)
|
||||
HFI_BUFFER_PERSIST_AV1D(size,
|
||||
inst->capabilities->cap[FRAME_WIDTH].max,
|
||||
inst->capabilities->cap[FRAME_HEIGHT].max, 16);
|
||||
inst->capabilities[FRAME_WIDTH].max,
|
||||
inst->capabilities[FRAME_HEIGHT].max, 16);
|
||||
else
|
||||
HFI_BUFFER_PERSIST_AV1D(size, 0, 0, 0);
|
||||
}
|
||||
@@ -289,13 +289,13 @@ static u32 msm_vidc_decoder_dpb_size_iris3(struct msm_vidc_inst *inst)
|
||||
* for linear formats. For AV1, DPB is needed for film-grain
|
||||
* enabled bitstreams (UBWC & linear).
|
||||
*/
|
||||
color_fmt = inst->capabilities->cap[PIX_FMTS].value;
|
||||
color_fmt = inst->capabilities[PIX_FMTS].value;
|
||||
if (!is_linear_colorformat(color_fmt)) {
|
||||
if (inst->codec != MSM_VIDC_AV1)
|
||||
return size;
|
||||
|
||||
if (inst->codec == MSM_VIDC_AV1 &&
|
||||
!inst->capabilities->cap[FILM_GRAIN].value)
|
||||
!inst->capabilities[FILM_GRAIN].value)
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ static u32 msm_vidc_encoder_bin_size_iris3(struct msm_vidc_inst *inst)
|
||||
u32 width, height, num_vpp_pipes, stage, profile;
|
||||
struct v4l2_format *f;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
@@ -351,11 +351,11 @@ static u32 msm_vidc_encoder_bin_size_iris3(struct msm_vidc_inst *inst)
|
||||
return size;
|
||||
}
|
||||
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||
stage = inst->capabilities->cap[STAGE].value;
|
||||
stage = inst->capabilities[STAGE].value;
|
||||
f = &inst->fmts[OUTPUT_PORT];
|
||||
width = f->fmt.pix_mp.width;
|
||||
height = f->fmt.pix_mp.height;
|
||||
profile = inst->capabilities->cap[PROFILE].value;
|
||||
profile = inst->capabilities[PROFILE].value;
|
||||
|
||||
if (inst->codec == MSM_VIDC_H264)
|
||||
HFI_BUFFER_BIN_H264E(size, inst->hfi_rc_type, width,
|
||||
@@ -375,13 +375,13 @@ static u32 msm_vidc_get_recon_buf_count(struct msm_vidc_inst *inst)
|
||||
bool is_hybrid_hp = false;
|
||||
u32 hfi_codec = 0;
|
||||
|
||||
n_bframe = inst->capabilities->cap[B_FRAME].value;
|
||||
ltr_count = inst->capabilities->cap[LTR_COUNT].value;
|
||||
n_bframe = inst->capabilities[B_FRAME].value;
|
||||
ltr_count = inst->capabilities[LTR_COUNT].value;
|
||||
|
||||
if (inst->hfi_layer_type == HFI_HIER_B) {
|
||||
hb_layers = inst->capabilities->cap[ENH_LAYER_COUNT].value + 1;
|
||||
hb_layers = inst->capabilities[ENH_LAYER_COUNT].value + 1;
|
||||
} else {
|
||||
hp_layers = inst->capabilities->cap[ENH_LAYER_COUNT].value + 1;
|
||||
hp_layers = inst->capabilities[ENH_LAYER_COUNT].value + 1;
|
||||
if (inst->hfi_layer_type == HFI_HIER_P_HYBRID_LTR)
|
||||
is_hybrid_hp = true;
|
||||
}
|
||||
@@ -403,7 +403,7 @@ static u32 msm_vidc_encoder_comv_size_iris3(struct msm_vidc_inst* inst)
|
||||
u32 width, height, num_recon = 0;
|
||||
struct v4l2_format* f;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
@@ -465,12 +465,12 @@ static u32 msm_vidc_encoder_line_size_iris3(struct msm_vidc_inst *inst)
|
||||
return size;
|
||||
}
|
||||
core = inst->core;
|
||||
if (!core->capabilities || !inst->capabilities) {
|
||||
if (!core->capabilities) {
|
||||
i_vpr_e(inst, "%s: invalid capabilities\n", __func__);
|
||||
return size;
|
||||
}
|
||||
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||
pixfmt = inst->capabilities->cap[PIX_FMTS].value;
|
||||
pixfmt = inst->capabilities[PIX_FMTS].value;
|
||||
|
||||
f = &inst->fmts[OUTPUT_PORT];
|
||||
width = f->fmt.pix_mp.width;
|
||||
@@ -493,7 +493,7 @@ static u32 msm_vidc_encoder_dpb_size_iris3(struct msm_vidc_inst *inst)
|
||||
struct v4l2_format *f;
|
||||
bool is_tenbit;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
@@ -502,7 +502,7 @@ static u32 msm_vidc_encoder_dpb_size_iris3(struct msm_vidc_inst *inst)
|
||||
width = f->fmt.pix_mp.width;
|
||||
height = f->fmt.pix_mp.height;
|
||||
|
||||
pixfmt = inst->capabilities->cap[PIX_FMTS].value;
|
||||
pixfmt = inst->capabilities[PIX_FMTS].value;
|
||||
is_tenbit = (pixfmt == MSM_VIDC_FMT_P010 || pixfmt == MSM_VIDC_FMT_TP10C);
|
||||
|
||||
if (inst->codec == MSM_VIDC_H264)
|
||||
@@ -536,7 +536,7 @@ static u32 msm_vidc_encoder_vpss_size_iris3(struct msm_vidc_inst* inst)
|
||||
u32 width, height, driver_colorfmt;
|
||||
struct v4l2_format* f;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
@@ -562,7 +562,7 @@ static u32 msm_vidc_encoder_vpss_size_iris3(struct msm_vidc_inst* inst)
|
||||
driver_colorfmt = v4l2_colorformat_to_driver(inst,
|
||||
f->fmt.pix_mp.pixelformat, __func__);
|
||||
is_tenbit = is_10bit_colorformat(driver_colorfmt);
|
||||
if (inst->capabilities->cap[BLUR_TYPES].value != MSM_VIDC_BLUR_NONE)
|
||||
if (inst->capabilities[BLUR_TYPES].value != MSM_VIDC_BLUR_NONE)
|
||||
blur = true;
|
||||
|
||||
HFI_BUFFER_VPSS_ENC(size, width, height, ds_enable, blur, is_tenbit);
|
||||
@@ -579,7 +579,7 @@ static u32 msm_vidc_encoder_output_size_iris3(struct msm_vidc_inst *inst)
|
||||
u32 hfi_rc_type = HFI_RC_VBR_CFR;
|
||||
enum msm_vidc_codec_type codec;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -589,8 +589,8 @@ static u32 msm_vidc_encoder_output_size_iris3(struct msm_vidc_inst *inst)
|
||||
if (codec == MSM_VIDC_HEVC || codec == MSM_VIDC_HEIC)
|
||||
is_ten_bit = true;
|
||||
|
||||
bitrate_mode = inst->capabilities->cap[BITRATE_MODE].value;
|
||||
frame_rc = inst->capabilities->cap[FRAME_RC_ENABLE].value;
|
||||
bitrate_mode = inst->capabilities[BITRATE_MODE].value;
|
||||
frame_rc = inst->capabilities[FRAME_RC_ENABLE].value;
|
||||
if (!frame_rc && !is_image_session(inst))
|
||||
hfi_rc_type = HFI_RC_OFF;
|
||||
else if (bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CQ)
|
||||
@@ -681,7 +681,7 @@ static int msm_vidc_input_min_count_iris3(struct msm_vidc_inst* inst)
|
||||
u32 input_min_count = 0;
|
||||
u32 total_hb_layer = 0;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
@@ -690,9 +690,9 @@ static int msm_vidc_input_min_count_iris3(struct msm_vidc_inst* inst)
|
||||
input_min_count = MIN_DEC_INPUT_BUFFERS;
|
||||
} else if (is_encode_session(inst)) {
|
||||
total_hb_layer = is_hierb_type_requested(inst) ?
|
||||
inst->capabilities->cap[ENH_LAYER_COUNT].value + 1 : 0;
|
||||
inst->capabilities[ENH_LAYER_COUNT].value + 1 : 0;
|
||||
if (inst->codec == MSM_VIDC_H264 &&
|
||||
!inst->capabilities->cap[LAYER_ENABLE].value) {
|
||||
!inst->capabilities[LAYER_ENABLE].value) {
|
||||
total_hb_layer = 0;
|
||||
}
|
||||
HFI_IRIS3_ENC_MIN_INPUT_BUF_COUNT(input_min_count,
|
||||
@@ -720,10 +720,10 @@ static int msm_buffer_dpb_count(struct msm_vidc_inst *inst)
|
||||
|
||||
/* decoder dpb buffer count */
|
||||
if (is_decode_session(inst)) {
|
||||
color_fmt = inst->capabilities->cap[PIX_FMTS].value;
|
||||
color_fmt = inst->capabilities[PIX_FMTS].value;
|
||||
if (is_linear_colorformat(color_fmt) ||
|
||||
(inst->codec == MSM_VIDC_AV1 &&
|
||||
(inst->capabilities->cap[FILM_GRAIN].value)))
|
||||
(inst->capabilities[FILM_GRAIN].value)))
|
||||
count = inst->buffers.output.min_count;
|
||||
|
||||
return count;
|
||||
@@ -743,13 +743,13 @@ static int msm_buffer_delivery_mode_based_min_count_iris3(struct msm_vidc_inst *
|
||||
u32 slice_mode = 0;
|
||||
u32 delivery_mode = 0;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return count;
|
||||
}
|
||||
|
||||
slice_mode = inst->capabilities->cap[SLICE_MODE].value;
|
||||
delivery_mode = inst->capabilities->cap[DELIVERY_MODE].value;
|
||||
slice_mode = inst->capabilities[SLICE_MODE].value;
|
||||
delivery_mode = inst->capabilities[DELIVERY_MODE].value;
|
||||
|
||||
if (slice_mode != V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB ||
|
||||
(!delivery_mode))
|
||||
@@ -759,7 +759,7 @@ static int msm_buffer_delivery_mode_based_min_count_iris3(struct msm_vidc_inst *
|
||||
width = f->fmt.pix_mp.width;
|
||||
height = f->fmt.pix_mp.height;
|
||||
|
||||
max_mbs_per_slice = inst->capabilities->cap[SLICE_MAX_MB].value;
|
||||
max_mbs_per_slice = inst->capabilities[SLICE_MAX_MB].value;
|
||||
|
||||
if (inst->codec == MSM_VIDC_H264)
|
||||
hfi_codec = HFI_CODEC_ENCODE_AVC;
|
||||
|
@@ -862,7 +862,7 @@ int msm_vidc_decide_work_mode_iris3(struct msm_vidc_inst* inst)
|
||||
u32 width, height;
|
||||
bool res_ok = false;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -880,9 +880,9 @@ int msm_vidc_decide_work_mode_iris3(struct msm_vidc_inst* inst)
|
||||
height = inp_f->fmt.pix_mp.height;
|
||||
width = inp_f->fmt.pix_mp.width;
|
||||
res_ok = res_is_less_than(width, height, 1280, 720);
|
||||
if (inst->capabilities->cap[CODED_FRAMES].value ==
|
||||
if (inst->capabilities[CODED_FRAMES].value ==
|
||||
CODED_FRAMES_INTERLACE ||
|
||||
inst->capabilities->cap[LOWLATENCY_MODE].value ||
|
||||
inst->capabilities[LOWLATENCY_MODE].value ||
|
||||
res_ok) {
|
||||
work_mode = MSM_VIDC_STAGE_1;
|
||||
}
|
||||
@@ -891,17 +891,17 @@ int msm_vidc_decide_work_mode_iris3(struct msm_vidc_inst* inst)
|
||||
width = inst->crop.width;
|
||||
res_ok = !res_is_greater_than(width, height, 4096, 2160);
|
||||
if (res_ok &&
|
||||
(inst->capabilities->cap[LOWLATENCY_MODE].value)) {
|
||||
(inst->capabilities[LOWLATENCY_MODE].value)) {
|
||||
work_mode = MSM_VIDC_STAGE_1;
|
||||
}
|
||||
if (inst->capabilities->cap[SLICE_MODE].value ==
|
||||
if (inst->capabilities[SLICE_MODE].value ==
|
||||
V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES) {
|
||||
work_mode = MSM_VIDC_STAGE_1;
|
||||
}
|
||||
if (inst->capabilities->cap[LOSSLESS].value)
|
||||
if (inst->capabilities[LOSSLESS].value)
|
||||
work_mode = MSM_VIDC_STAGE_2;
|
||||
|
||||
if (!inst->capabilities->cap[GOP_SIZE].value)
|
||||
if (!inst->capabilities[GOP_SIZE].value)
|
||||
work_mode = MSM_VIDC_STAGE_2;
|
||||
} else {
|
||||
i_vpr_e(inst, "%s: invalid session type\n", __func__);
|
||||
@@ -910,8 +910,8 @@ int msm_vidc_decide_work_mode_iris3(struct msm_vidc_inst* inst)
|
||||
|
||||
exit:
|
||||
i_vpr_h(inst, "Configuring work mode = %u low latency = %u, gop size = %u\n",
|
||||
work_mode, inst->capabilities->cap[LOWLATENCY_MODE].value,
|
||||
inst->capabilities->cap[GOP_SIZE].value);
|
||||
work_mode, inst->capabilities[LOWLATENCY_MODE].value,
|
||||
inst->capabilities[GOP_SIZE].value);
|
||||
msm_vidc_update_cap_value(inst, STAGE, work_mode, __func__);
|
||||
|
||||
return 0;
|
||||
@@ -934,13 +934,13 @@ int msm_vidc_decide_work_route_iris3(struct msm_vidc_inst* inst)
|
||||
goto exit;
|
||||
|
||||
if (is_decode_session(inst)) {
|
||||
if (inst->capabilities->cap[CODED_FRAMES].value ==
|
||||
if (inst->capabilities[CODED_FRAMES].value ==
|
||||
CODED_FRAMES_INTERLACE)
|
||||
work_route = MSM_VIDC_PIPE_1;
|
||||
} else if (is_encode_session(inst)) {
|
||||
u32 slice_mode;
|
||||
|
||||
slice_mode = inst->capabilities->cap[SLICE_MODE].value;
|
||||
slice_mode = inst->capabilities[SLICE_MODE].value;
|
||||
|
||||
/*TODO Pipe=1 for legacy CBR*/
|
||||
if (slice_mode == V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES)
|
||||
@@ -960,30 +960,27 @@ exit:
|
||||
|
||||
int msm_vidc_decide_quality_mode_iris3(struct msm_vidc_inst* inst)
|
||||
{
|
||||
struct msm_vidc_inst_capability* capability = NULL;
|
||||
struct msm_vidc_core *core;
|
||||
u32 mbpf, mbps, max_hq_mbpf, max_hq_mbps;
|
||||
u32 mode = MSM_VIDC_POWER_SAVE_MODE;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
capability = inst->capabilities;
|
||||
|
||||
if (!is_encode_session(inst))
|
||||
return 0;
|
||||
|
||||
/* image or lossless or all intra runs at quality mode */
|
||||
if (is_image_session(inst) || capability->cap[LOSSLESS].value ||
|
||||
capability->cap[ALL_INTRA].value) {
|
||||
if (is_image_session(inst) || inst->capabilities[LOSSLESS].value ||
|
||||
inst->capabilities[ALL_INTRA].value) {
|
||||
mode = MSM_VIDC_MAX_QUALITY_MODE;
|
||||
goto decision_done;
|
||||
}
|
||||
|
||||
/* for lesser complexity, make LP for all resolution */
|
||||
if (capability->cap[COMPLEXITY].value < DEFAULT_COMPLEXITY) {
|
||||
if (inst->capabilities[COMPLEXITY].value < DEFAULT_COMPLEXITY) {
|
||||
mode = MSM_VIDC_POWER_SAVE_MODE;
|
||||
goto decision_done;
|
||||
}
|
||||
@@ -995,8 +992,8 @@ int msm_vidc_decide_quality_mode_iris3(struct msm_vidc_inst* inst)
|
||||
max_hq_mbps = core->capabilities[MAX_MBPS_HQ].value;;
|
||||
|
||||
if (!is_realtime_session(inst)) {
|
||||
if (((capability->cap[COMPLEXITY].flags & CAP_FLAG_CLIENT_SET) &&
|
||||
(capability->cap[COMPLEXITY].value >= DEFAULT_COMPLEXITY)) ||
|
||||
if (((inst->capabilities[COMPLEXITY].flags & CAP_FLAG_CLIENT_SET) &&
|
||||
(inst->capabilities[COMPLEXITY].value >= DEFAULT_COMPLEXITY)) ||
|
||||
mbpf <= max_hq_mbpf) {
|
||||
mode = MSM_VIDC_MAX_QUALITY_MODE;
|
||||
goto decision_done;
|
||||
@@ -1014,7 +1011,6 @@ decision_done:
|
||||
|
||||
int msm_vidc_adjust_bitrate_boost_iris3(void* instance, struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct msm_vidc_inst_capability* capability = NULL;
|
||||
s32 adjusted_value;
|
||||
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
||||
s32 rc_type = -1;
|
||||
@@ -1022,15 +1018,13 @@ int msm_vidc_adjust_bitrate_boost_iris3(void* instance, struct v4l2_ctrl *ctrl)
|
||||
struct v4l2_format *f;
|
||||
u32 max_bitrate = 0, bitrate = 0;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
capability = inst->capabilities;
|
||||
|
||||
adjusted_value = ctrl ? ctrl->val :
|
||||
capability->cap[BITRATE_BOOST].value;
|
||||
inst->capabilities[BITRATE_BOOST].value;
|
||||
|
||||
if (inst->bufq[OUTPUT_PORT].vb2q->streaming)
|
||||
return 0;
|
||||
@@ -1048,7 +1042,7 @@ int msm_vidc_adjust_bitrate_boost_iris3(void* instance, struct v4l2_ctrl *ctrl)
|
||||
goto adjust;
|
||||
}
|
||||
|
||||
frame_rate = inst->capabilities->cap[FRAME_RATE].value >> 16;
|
||||
frame_rate = inst->capabilities[FRAME_RATE].value >> 16;
|
||||
f= &inst->fmts[OUTPUT_PORT];
|
||||
width = f->fmt.pix_mp.width;
|
||||
height = f->fmt.pix_mp.height;
|
||||
@@ -1058,7 +1052,7 @@ int msm_vidc_adjust_bitrate_boost_iris3(void* instance, struct v4l2_ctrl *ctrl)
|
||||
* if client did not set, keep max bitrate boost upto 4k@60fps
|
||||
* and remove bitrate boost after 4k@60fps
|
||||
*/
|
||||
if (capability->cap[BITRATE_BOOST].flags & CAP_FLAG_CLIENT_SET) {
|
||||
if (inst->capabilities[BITRATE_BOOST].flags & CAP_FLAG_CLIENT_SET) {
|
||||
/* accept client set bitrate boost value as is */
|
||||
} else {
|
||||
if (res_is_less_than_or_equal_to(width, height, 4096, 2176) &&
|
||||
@@ -1069,7 +1063,7 @@ int msm_vidc_adjust_bitrate_boost_iris3(void* instance, struct v4l2_ctrl *ctrl)
|
||||
}
|
||||
|
||||
max_bitrate = msm_vidc_get_max_bitrate(inst);
|
||||
bitrate = inst->capabilities->cap[BIT_RATE].value;
|
||||
bitrate = inst->capabilities[BIT_RATE].value;
|
||||
if (adjusted_value) {
|
||||
if ((bitrate + bitrate / (100 / adjusted_value)) > max_bitrate) {
|
||||
i_vpr_h(inst,
|
||||
|
@@ -37,7 +37,7 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
|
||||
if (inst->codec == MSM_VIDC_H264) {
|
||||
codec_input->codec = CODEC_H264;
|
||||
codec_input->lcu_size = 16;
|
||||
if (inst->capabilities->cap[ENTROPY_MODE].value ==
|
||||
if (inst->capabilities[ENTROPY_MODE].value ==
|
||||
V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC)
|
||||
codec_input->entropy_coding_mode = CODEC_ENTROPY_CODING_CABAC;
|
||||
else
|
||||
@@ -56,24 +56,24 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
codec_input->pipe_num = inst->capabilities->cap[PIPE].value;
|
||||
codec_input->pipe_num = inst->capabilities[PIPE].value;
|
||||
codec_input->frame_rate = inst->max_rate;
|
||||
|
||||
port = inst->domain == MSM_VIDC_DECODER ? INPUT_PORT : OUTPUT_PORT;
|
||||
codec_input->frame_width = inst->fmts[port].fmt.pix_mp.width;
|
||||
codec_input->frame_height = inst->fmts[port].fmt.pix_mp.height;
|
||||
|
||||
if (inst->capabilities->cap[STAGE].value == MSM_VIDC_STAGE_1) {
|
||||
if (inst->capabilities[STAGE].value == MSM_VIDC_STAGE_1) {
|
||||
codec_input->vsp_vpp_mode = CODEC_VSPVPP_MODE_1S;
|
||||
} else if (inst->capabilities->cap[STAGE].value == MSM_VIDC_STAGE_2) {
|
||||
} else if (inst->capabilities[STAGE].value == MSM_VIDC_STAGE_2) {
|
||||
codec_input->vsp_vpp_mode = CODEC_VSPVPP_MODE_2S;
|
||||
} else {
|
||||
d_vpr_e("%s: invalid stage %d\n", __func__,
|
||||
inst->capabilities->cap[STAGE].value);
|
||||
inst->capabilities[STAGE].value);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (inst->capabilities->cap[BIT_DEPTH].value == BIT_DEPTH_8)
|
||||
if (inst->capabilities[BIT_DEPTH].value == BIT_DEPTH_8)
|
||||
codec_input->bitdepth = CODEC_BITDEPTH_8;
|
||||
else
|
||||
codec_input->bitdepth = CODEC_BITDEPTH_10;
|
||||
@@ -81,7 +81,7 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
|
||||
/*
|
||||
* Used for calculating Encoder GOP Complexity
|
||||
* hierachical_layer=0..7 used as Array Index
|
||||
* inst->capabilities->cap[B_FRAME].value=[ 0 1 2 ]
|
||||
* inst->capabilities[B_FRAME].value=[ 0 1 2]
|
||||
* TODO how to map?
|
||||
*/
|
||||
|
||||
@@ -155,15 +155,15 @@ static int msm_vidc_init_codec_input_bus(struct msm_vidc_inst *inst, struct vidc
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (inst->capabilities->cap[ENTROPY_MODE].value ==
|
||||
if (inst->capabilities[ENTROPY_MODE].value ==
|
||||
V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC) {
|
||||
codec_input->entropy_coding_mode = CODEC_ENTROPY_CODING_CABAC;
|
||||
} else if (inst->capabilities->cap[ENTROPY_MODE].value ==
|
||||
} else if (inst->capabilities[ENTROPY_MODE].value ==
|
||||
V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC) {
|
||||
codec_input->entropy_coding_mode = CODEC_ENTROPY_CODING_CAVLC;
|
||||
} else {
|
||||
d_vpr_e("%s: invalid entropy %d\n", __func__,
|
||||
inst->capabilities->cap[ENTROPY_MODE].value);
|
||||
inst->capabilities[ENTROPY_MODE].value);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ static u64 msm_vidc_calc_freq_iris3_new(struct msm_vidc_inst *inst, u32 data_siz
|
||||
struct api_calculation_freq_output codec_output;
|
||||
u32 fps, mbpf;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return freq;
|
||||
}
|
||||
@@ -362,7 +362,7 @@ u64 msm_vidc_calc_freq_iris3(struct msm_vidc_inst *inst, u32 data_size)
|
||||
{
|
||||
u64 freq = 0;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return freq;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
|
||||
u32 base_cycles = 0;
|
||||
u32 fps, mbpf;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return freq;
|
||||
}
|
||||
@@ -408,26 +408,26 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
|
||||
* Even though, most part is common now, in future it may change
|
||||
* between them.
|
||||
*/
|
||||
fw_cycles = fps * inst->capabilities->cap[MB_CYCLES_FW].value;
|
||||
fw_vpp_cycles = fps * inst->capabilities->cap[MB_CYCLES_FW_VPP].value;
|
||||
fw_cycles = fps * inst->capabilities[MB_CYCLES_FW].value;
|
||||
fw_vpp_cycles = fps * inst->capabilities[MB_CYCLES_FW_VPP].value;
|
||||
|
||||
if (inst->domain == MSM_VIDC_ENCODER) {
|
||||
vpp_cycles_per_mb = is_low_power_session(inst) ?
|
||||
inst->capabilities->cap[MB_CYCLES_LP].value :
|
||||
inst->capabilities->cap[MB_CYCLES_VPP].value;
|
||||
inst->capabilities[MB_CYCLES_LP].value :
|
||||
inst->capabilities[MB_CYCLES_VPP].value;
|
||||
|
||||
vpp_cycles = mbs_per_second * vpp_cycles_per_mb /
|
||||
inst->capabilities->cap[PIPE].value;
|
||||
inst->capabilities[PIPE].value;
|
||||
|
||||
/* Factor 1.25 for IbP and 1.375 for I1B2b1P GOP structure */
|
||||
if (inst->capabilities->cap[B_FRAME].value > 1)
|
||||
if (inst->capabilities[B_FRAME].value > 1)
|
||||
vpp_cycles += (vpp_cycles / 4) + (vpp_cycles / 8);
|
||||
else if (inst->capabilities->cap[B_FRAME].value)
|
||||
else if (inst->capabilities[B_FRAME].value)
|
||||
vpp_cycles += vpp_cycles / 4;
|
||||
/* 21 / 20 is minimum overhead factor */
|
||||
vpp_cycles += max(div_u64(vpp_cycles, 20), fw_vpp_cycles);
|
||||
/* 1.01 is multi-pipe overhead */
|
||||
if (inst->capabilities->cap[PIPE].value > 1)
|
||||
if (inst->capabilities[PIPE].value > 1)
|
||||
vpp_cycles += div_u64(vpp_cycles, 100);
|
||||
/*
|
||||
* 1080p@480fps usecase needs exactly 338MHz
|
||||
@@ -445,25 +445,25 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
|
||||
vpp_cycles += div_u64(vpp_cycles * 5, 100);
|
||||
|
||||
/* increase vpp_cycles by 50% for preprocessing */
|
||||
if (inst->capabilities->cap[REQUEST_PREPROCESS].value)
|
||||
if (inst->capabilities[REQUEST_PREPROCESS].value)
|
||||
vpp_cycles = vpp_cycles + vpp_cycles / 2;
|
||||
|
||||
/* VSP */
|
||||
/* bitrate is based on fps, scale it using operating rate */
|
||||
operating_rate = inst->capabilities->cap[OPERATING_RATE].value >> 16;
|
||||
operating_rate = inst->capabilities[OPERATING_RATE].value >> 16;
|
||||
if (operating_rate >
|
||||
(inst->capabilities->cap[FRAME_RATE].value >> 16) &&
|
||||
(inst->capabilities->cap[FRAME_RATE].value >> 16)) {
|
||||
(inst->capabilities[FRAME_RATE].value >> 16) &&
|
||||
(inst->capabilities[FRAME_RATE].value >> 16)) {
|
||||
vsp_factor_num = operating_rate;
|
||||
vsp_factor_den = inst->capabilities->cap[FRAME_RATE].value >> 16;
|
||||
vsp_factor_den = inst->capabilities[FRAME_RATE].value >> 16;
|
||||
}
|
||||
vsp_cycles = div_u64(((u64)inst->capabilities->cap[BIT_RATE].value *
|
||||
vsp_cycles = div_u64(((u64)inst->capabilities[BIT_RATE].value *
|
||||
vsp_factor_num), vsp_factor_den);
|
||||
|
||||
base_cycles = inst->capabilities->cap[MB_CYCLES_VSP].value;
|
||||
base_cycles = inst->capabilities[MB_CYCLES_VSP].value;
|
||||
if (inst->codec == MSM_VIDC_VP9) {
|
||||
vsp_cycles = div_u64(vsp_cycles * 170, 100);
|
||||
} else if (inst->capabilities->cap[ENTROPY_MODE].value ==
|
||||
} else if (inst->capabilities[ENTROPY_MODE].value ==
|
||||
V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC) {
|
||||
vsp_cycles = div_u64(vsp_cycles * 135, 100);
|
||||
} else {
|
||||
@@ -473,18 +473,18 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
|
||||
/* VSP FW Overhead 1.05 */
|
||||
vsp_cycles = div_u64(vsp_cycles * 21, 20);
|
||||
|
||||
if (inst->capabilities->cap[STAGE].value == MSM_VIDC_STAGE_1)
|
||||
if (inst->capabilities[STAGE].value == MSM_VIDC_STAGE_1)
|
||||
vsp_cycles = vsp_cycles * 3;
|
||||
|
||||
vsp_cycles += mbs_per_second * base_cycles;
|
||||
|
||||
} else if (inst->domain == MSM_VIDC_DECODER) {
|
||||
/* VPP */
|
||||
vpp_cycles = mbs_per_second * inst->capabilities->cap[MB_CYCLES_VPP].value /
|
||||
inst->capabilities->cap[PIPE].value;
|
||||
vpp_cycles = mbs_per_second * inst->capabilities[MB_CYCLES_VPP].value /
|
||||
inst->capabilities[PIPE].value;
|
||||
/* 21 / 20 is minimum overhead factor */
|
||||
vpp_cycles += max(vpp_cycles / 20, fw_vpp_cycles);
|
||||
if (inst->capabilities->cap[PIPE].value > 1) {
|
||||
if (inst->capabilities[PIPE].value > 1) {
|
||||
if (inst->codec == MSM_VIDC_AV1) {
|
||||
/*
|
||||
* Additional vpp_cycles are required for bitstreams with
|
||||
@@ -493,7 +493,7 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
|
||||
* non-recommended tiles: 1080P_V4XH2_V4X1, UHD_V8X4_V8X1,
|
||||
* 8KUHD_V8X8_V8X1
|
||||
*/
|
||||
if (inst->capabilities->cap[SUPER_BLOCK].value)
|
||||
if (inst->capabilities[SUPER_BLOCK].value)
|
||||
vpp_cycles += div_u64(vpp_cycles * 1464, 1000);
|
||||
else
|
||||
vpp_cycles += div_u64(vpp_cycles * 410, 1000);
|
||||
@@ -536,7 +536,7 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
|
||||
input_bitrate_mbps = fps * data_size * 8 / (1024 * 1024);
|
||||
vsp_hw_min_frequency = freq_tbl_value * 1000 * input_bitrate_mbps;
|
||||
|
||||
if (inst->capabilities->cap[STAGE].value == MSM_VIDC_STAGE_2) {
|
||||
if (inst->capabilities[STAGE].value == MSM_VIDC_STAGE_2) {
|
||||
vsp_hw_min_frequency +=
|
||||
(bitrate_2stage[bitrate_entry] * fw_sw_vsp_offset - 1);
|
||||
vsp_hw_min_frequency = div_u64(vsp_hw_min_frequency,
|
||||
@@ -553,13 +553,13 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
|
||||
vsp_cycles = vsp_hw_min_frequency * 1000000;
|
||||
} else {
|
||||
base_cycles = inst->has_bframe ?
|
||||
80 : inst->capabilities->cap[MB_CYCLES_VSP].value;
|
||||
80 : inst->capabilities[MB_CYCLES_VSP].value;
|
||||
bitrate = fps * data_size * 8;
|
||||
vsp_cycles = bitrate;
|
||||
|
||||
if (inst->codec == MSM_VIDC_VP9) {
|
||||
vsp_cycles = div_u64(vsp_cycles * 170, 100);
|
||||
} else if (inst->capabilities->cap[ENTROPY_MODE].value ==
|
||||
} else if (inst->capabilities[ENTROPY_MODE].value ==
|
||||
V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC) {
|
||||
vsp_cycles = div_u64(vsp_cycles * 135, 100);
|
||||
} else {
|
||||
@@ -569,7 +569,7 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
|
||||
/* VSP FW overhead 1.05 */
|
||||
vsp_cycles = div_u64(vsp_cycles * 21, 20);
|
||||
|
||||
if (inst->capabilities->cap[STAGE].value == MSM_VIDC_STAGE_1)
|
||||
if (inst->capabilities[STAGE].value == MSM_VIDC_STAGE_1)
|
||||
vsp_cycles = vsp_cycles * 3;
|
||||
|
||||
vsp_cycles += mbs_per_second * base_cycles;
|
||||
@@ -584,9 +584,9 @@ static u64 msm_vidc_calc_freq_iris3_legacy(struct msm_vidc_inst *inst, u32 data_
|
||||
}
|
||||
|
||||
if (inst->codec == MSM_VIDC_VP9 &&
|
||||
inst->capabilities->cap[STAGE].value ==
|
||||
inst->capabilities[STAGE].value ==
|
||||
MSM_VIDC_STAGE_2 &&
|
||||
inst->capabilities->cap[PIPE].value == 4 &&
|
||||
inst->capabilities[PIPE].value == 4 &&
|
||||
bitrate > 90000000)
|
||||
vsp_cycles = msm_vidc_max_freq(inst);
|
||||
}
|
||||
|
Reference in New Issue
Block a user