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_iris33(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_iris33(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_iris33(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_iris33(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_iris33(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_iris33(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_iris33(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_iris33(struct msm_vidc_inst *inst)
|
||||
u32 width, height, num_vpp_pipes, stage, profile, ring_buf_count;
|
||||
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,12 +351,12 @@ static u32 msm_vidc_encoder_bin_size_iris33(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;
|
||||
ring_buf_count = inst->capabilities->cap[ENC_RING_BUFFER_COUNT].value;
|
||||
profile = inst->capabilities[PROFILE].value;
|
||||
ring_buf_count = inst->capabilities[ENC_RING_BUFFER_COUNT].value;
|
||||
|
||||
if (inst->codec == MSM_VIDC_H264)
|
||||
HFI_BUFFER_BIN_H264E(size, inst->hfi_rc_type, width,
|
||||
@@ -376,13 +376,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;
|
||||
}
|
||||
@@ -404,7 +404,7 @@ static u32 msm_vidc_encoder_comv_size_iris33(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;
|
||||
}
|
||||
@@ -466,12 +466,12 @@ static u32 msm_vidc_encoder_line_size_iris33(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;
|
||||
@@ -494,7 +494,7 @@ static u32 msm_vidc_encoder_dpb_size_iris33(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;
|
||||
}
|
||||
@@ -503,7 +503,7 @@ static u32 msm_vidc_encoder_dpb_size_iris33(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)
|
||||
@@ -537,7 +537,7 @@ static u32 msm_vidc_encoder_vpss_size_iris33(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;
|
||||
}
|
||||
@@ -563,7 +563,7 @@ static u32 msm_vidc_encoder_vpss_size_iris33(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);
|
||||
@@ -580,7 +580,7 @@ static u32 msm_vidc_encoder_output_size_iris33(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;
|
||||
}
|
||||
@@ -590,8 +590,8 @@ static u32 msm_vidc_encoder_output_size_iris33(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)
|
||||
@@ -682,7 +682,7 @@ static int msm_vidc_input_min_count_iris33(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;
|
||||
}
|
||||
@@ -691,9 +691,9 @@ static int msm_vidc_input_min_count_iris33(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,
|
||||
@@ -721,10 +721,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;
|
||||
@@ -744,13 +744,13 @@ static int msm_buffer_delivery_mode_based_min_count_iris33(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))
|
||||
@@ -760,7 +760,7 @@ static int msm_buffer_delivery_mode_based_min_count_iris33(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;
|
||||
|
@@ -993,7 +993,7 @@ int msm_vidc_decide_work_mode_iris33(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;
|
||||
}
|
||||
@@ -1011,9 +1011,9 @@ int msm_vidc_decide_work_mode_iris33(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;
|
||||
}
|
||||
@@ -1022,17 +1022,17 @@ int msm_vidc_decide_work_mode_iris33(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__);
|
||||
@@ -1041,8 +1041,8 @@ int msm_vidc_decide_work_mode_iris33(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;
|
||||
@@ -1065,13 +1065,13 @@ int msm_vidc_decide_work_route_iris33(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)
|
||||
@@ -1091,30 +1091,27 @@ exit:
|
||||
|
||||
int msm_vidc_decide_quality_mode_iris33(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;
|
||||
}
|
||||
@@ -1126,8 +1123,8 @@ int msm_vidc_decide_quality_mode_iris33(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;
|
||||
@@ -1145,7 +1142,6 @@ decision_done:
|
||||
|
||||
int msm_vidc_adjust_bitrate_boost_iris33(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;
|
||||
@@ -1153,15 +1149,13 @@ int msm_vidc_adjust_bitrate_boost_iris33(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;
|
||||
@@ -1179,7 +1173,7 @@ int msm_vidc_adjust_bitrate_boost_iris33(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;
|
||||
@@ -1189,7 +1183,7 @@ int msm_vidc_adjust_bitrate_boost_iris33(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) &&
|
||||
@@ -1200,7 +1194,7 @@ int msm_vidc_adjust_bitrate_boost_iris33(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,
|
||||
|
@@ -25,17 +25,17 @@ static int msm_vidc_get_hier_layer_val(struct msm_vidc_inst *inst)
|
||||
int hierachical_layer = CODEC_GOP_IPP;
|
||||
|
||||
if (inst->domain == MSM_VIDC_ENCODER) {
|
||||
if (inst->capabilities->cap[ALL_INTRA].value) {
|
||||
if (inst->capabilities[ALL_INTRA].value) {
|
||||
/* no P and B frames case */
|
||||
hierachical_layer = CODEC_GOP_IONLY;
|
||||
} else if (inst->capabilities->cap[B_FRAME].value == 0) {
|
||||
} else if (inst->capabilities[B_FRAME].value == 0) {
|
||||
/* no B frames case */
|
||||
hierachical_layer = CODEC_GOP_IPP;
|
||||
} else { /* P and B frames enabled case */
|
||||
if (inst->capabilities->cap[ENH_LAYER_COUNT].value == 0 ||
|
||||
inst->capabilities->cap[ENH_LAYER_COUNT].value == 1)
|
||||
if (inst->capabilities[ENH_LAYER_COUNT].value == 0 ||
|
||||
inst->capabilities[ENH_LAYER_COUNT].value == 1)
|
||||
hierachical_layer = CODEC_GOP_IbP;
|
||||
else if (inst->capabilities->cap[ENH_LAYER_COUNT].value == 2)
|
||||
else if (inst->capabilities[ENH_LAYER_COUNT].value == 2)
|
||||
hierachical_layer = CODEC_GOP_I1B2b1P;
|
||||
else
|
||||
hierachical_layer = CODEC_GOP_I3B4b1P;
|
||||
@@ -65,7 +65,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;
|
||||
codec_input->codec = CODEC_H264;
|
||||
@@ -87,24 +87,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;
|
||||
@@ -126,7 +126,7 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
|
||||
(codec_input->frame_rate * data_size * 8) / 1000000;
|
||||
else
|
||||
codec_input->bitrate_mbps =
|
||||
inst->capabilities->cap[BIT_RATE].value / 1000000;
|
||||
inst->capabilities[BIT_RATE].value / 1000000;
|
||||
|
||||
/* disable av1d commercial tile */
|
||||
codec_input->av1d_commer_tile_enable = 0;
|
||||
@@ -157,17 +157,17 @@ static int msm_vidc_init_codec_input_bus(struct msm_vidc_inst *inst, struct vidc
|
||||
codec_input->chipset_gen = MSM_PINEAPPLE;
|
||||
|
||||
if (d->codec == MSM_VIDC_H264) {
|
||||
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;
|
||||
codec_input->codec = CODEC_H264;
|
||||
} 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;
|
||||
codec_input->codec = CODEC_H264_CAVLC;
|
||||
} else {
|
||||
d_vpr_e("%s: invalid entropy %d\n", __func__,
|
||||
inst->capabilities->cap[ENTROPY_MODE].value);
|
||||
inst->capabilities[ENTROPY_MODE].value);
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (d->codec == MSM_VIDC_HEVC) {
|
||||
@@ -366,7 +366,7 @@ static u64 msm_vidc_calc_freq_iris33_new(struct msm_vidc_inst *inst, u32 data_si
|
||||
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;
|
||||
}
|
||||
@@ -386,7 +386,7 @@ static u64 msm_vidc_calc_freq_iris33_new(struct msm_vidc_inst *inst, u32 data_si
|
||||
return freq;
|
||||
|
||||
if (inst->domain == MSM_VIDC_ENCODER) {
|
||||
if (!inst->capabilities->cap[ENC_RING_BUFFER_COUNT].value &&
|
||||
if (!inst->capabilities[ENC_RING_BUFFER_COUNT].value &&
|
||||
is_vpp_cycles_close_to_freq_corner(core,
|
||||
codec_output.vpp_min_freq)) {
|
||||
/*
|
||||
@@ -456,7 +456,7 @@ u64 msm_vidc_calc_freq_iris33(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;
|
||||
}
|
||||
@@ -481,7 +481,7 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
|
||||
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;
|
||||
}
|
||||
@@ -502,26 +502,26 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
|
||||
* 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
|
||||
@@ -539,25 +539,25 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
|
||||
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 {
|
||||
@@ -567,18 +567,18 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
|
||||
/* 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
|
||||
@@ -587,7 +587,7 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
|
||||
* 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);
|
||||
@@ -630,7 +630,7 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
|
||||
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,
|
||||
@@ -647,13 +647,13 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
|
||||
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 {
|
||||
@@ -663,7 +663,7 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
|
||||
/* 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;
|
||||
@@ -678,9 +678,9 @@ u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size)
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1277,7 +1277,7 @@ int msm_vidc_ring_buf_count_iris33(struct msm_vidc_inst *inst, u32 data_size)
|
||||
struct api_calculation_input codec_input;
|
||||
struct api_calculation_freq_output codec_output;
|
||||
|
||||
if (!inst || !inst->core || !inst->capabilities) {
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1305,10 +1305,10 @@ int msm_vidc_ring_buf_count_iris33(struct msm_vidc_inst *inst, u32 data_size)
|
||||
if (is_vpp_cycles_close_to_freq_corner(core,
|
||||
codec_output.vpp_min_freq))
|
||||
/* enables ring buffer */
|
||||
inst->capabilities->cap[ENC_RING_BUFFER_COUNT].value =
|
||||
inst->capabilities[ENC_RING_BUFFER_COUNT].value =
|
||||
MAX_ENC_RING_BUF_COUNT;
|
||||
else
|
||||
inst->capabilities->cap[ENC_RING_BUFFER_COUNT].value = 0;
|
||||
inst->capabilities[ENC_RING_BUFFER_COUNT].value = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user