video: driver: Remove inst check in video driver
Remove inst check from all the functions in video driver. Inst check is present in most of the functions in video driver which is not required. Keep check only at root level functions and remove from rest all of the functions. Change-Id: Ib310cd3df5e8612a9fc3a5aa654dff4203a12906 Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
This commit is contained in:
@@ -24,10 +24,6 @@ static u32 msm_vidc_decoder_bin_size_iris3(struct msm_vidc_inst *inst)
|
||||
bool is_interlaced;
|
||||
u32 vpp_delay;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
core = inst->core;
|
||||
|
||||
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||
@@ -66,11 +62,6 @@ 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) {
|
||||
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;
|
||||
@@ -124,10 +115,6 @@ static u32 msm_vidc_decoder_non_comv_size_iris3(struct msm_vidc_inst* inst)
|
||||
struct msm_vidc_core* core;
|
||||
struct v4l2_format* f;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
core = inst->core;
|
||||
|
||||
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||
@@ -154,10 +141,6 @@ static u32 msm_vidc_decoder_line_size_iris3(struct msm_vidc_inst *inst)
|
||||
bool is_opb;
|
||||
u32 color_fmt;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
core = inst->core;
|
||||
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||
|
||||
@@ -205,11 +188,6 @@ static u32 msm_vidc_decoder_partial_data_size_iris3(struct msm_vidc_inst *inst)
|
||||
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;
|
||||
@@ -226,11 +204,6 @@ static u32 msm_vidc_decoder_persist_size_iris3(struct msm_vidc_inst *inst)
|
||||
u32 size = 0;
|
||||
u32 rpu_enabled = 0;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
|
||||
if (inst->capabilities[META_DOLBY_RPU].value)
|
||||
rpu_enabled = 1;
|
||||
|
||||
@@ -268,11 +241,6 @@ static u32 msm_vidc_decoder_dpb_size_iris3(struct msm_vidc_inst *inst)
|
||||
u32 width, height;
|
||||
struct v4l2_format *f;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
* For legacy codecs (non-AV1), DPB is calculated only
|
||||
* for linear formats. For AV1, DPB is needed for film-grain
|
||||
@@ -330,10 +298,6 @@ 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) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
core = inst->core;
|
||||
|
||||
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||
@@ -389,11 +353,6 @@ 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) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
|
||||
f = &inst->fmts[OUTPUT_PORT];
|
||||
width = f->fmt.pix_mp.width;
|
||||
height = f->fmt.pix_mp.height;
|
||||
@@ -415,10 +374,6 @@ static u32 msm_vidc_encoder_non_comv_size_iris3(struct msm_vidc_inst* inst)
|
||||
u32 width, height, num_vpp_pipes;
|
||||
struct v4l2_format* f;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
core = inst->core;
|
||||
|
||||
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||
@@ -443,10 +398,6 @@ static u32 msm_vidc_encoder_line_size_iris3(struct msm_vidc_inst *inst)
|
||||
bool is_tenbit = false;
|
||||
struct v4l2_format *f;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return size;
|
||||
}
|
||||
core = inst->core;
|
||||
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||
pixfmt = inst->capabilities[PIX_FMTS].value;
|
||||
@@ -472,11 +423,6 @@ static u32 msm_vidc_encoder_dpb_size_iris3(struct msm_vidc_inst *inst)
|
||||
struct v4l2_format *f;
|
||||
bool is_tenbit;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f = &inst->fmts[OUTPUT_PORT];
|
||||
width = f->fmt.pix_mp.width;
|
||||
height = f->fmt.pix_mp.height;
|
||||
@@ -497,11 +443,6 @@ static u32 msm_vidc_encoder_arp_size_iris3(struct msm_vidc_inst *inst)
|
||||
{
|
||||
u32 size = 0;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HFI_BUFFER_ARP_ENC(size);
|
||||
i_vpr_l(inst, "%s: size %d\n", __func__, size);
|
||||
return size;
|
||||
@@ -515,11 +456,6 @@ 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) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ds_enable = is_scaling_enabled(inst);
|
||||
msm_vidc_v4l2_to_hfi_enum(inst, ROTATION, &rotation_val);
|
||||
|
||||
@@ -558,11 +494,6 @@ 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) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
f = &inst->fmts[OUTPUT_PORT];
|
||||
codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
|
||||
if (codec == MSM_VIDC_HEVC || codec == MSM_VIDC_HEIC)
|
||||
@@ -660,11 +591,6 @@ 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) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_decode_session(inst)) {
|
||||
input_min_count = MIN_DEC_INPUT_BUFFERS;
|
||||
} else if (is_encode_session(inst)) {
|
||||
@@ -692,11 +618,6 @@ static int msm_buffer_dpb_count(struct msm_vidc_inst *inst)
|
||||
int count = 0;
|
||||
u32 color_fmt;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* decoder dpb buffer count */
|
||||
if (is_decode_session(inst)) {
|
||||
color_fmt = inst->capabilities[PIX_FMTS].value;
|
||||
@@ -722,11 +643,6 @@ static int msm_buffer_delivery_mode_based_min_count_iris3(struct msm_vidc_inst *
|
||||
u32 slice_mode = 0;
|
||||
u32 delivery_mode = 0;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return count;
|
||||
}
|
||||
|
||||
slice_mode = inst->capabilities[SLICE_MODE].value;
|
||||
delivery_mode = inst->capabilities[DELIVERY_MODE].value;
|
||||
|
||||
@@ -756,11 +672,6 @@ int msm_buffer_min_count_iris3(struct msm_vidc_inst *inst,
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (buffer_type) {
|
||||
case MSM_VIDC_BUF_INPUT:
|
||||
case MSM_VIDC_BUF_INPUT_META:
|
||||
@@ -797,11 +708,6 @@ int msm_buffer_extra_count_iris3(struct msm_vidc_inst *inst,
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (buffer_type) {
|
||||
case MSM_VIDC_BUF_INPUT:
|
||||
case MSM_VIDC_BUF_INPUT_META:
|
||||
|
@@ -862,11 +862,6 @@ int msm_vidc_decide_work_mode_iris3(struct msm_vidc_inst* inst)
|
||||
u32 width, height;
|
||||
bool res_ok = false;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
work_mode = MSM_VIDC_STAGE_2;
|
||||
inp_f = &inst->fmts[INPUT_PORT];
|
||||
|
||||
@@ -922,11 +917,6 @@ int msm_vidc_decide_work_route_iris3(struct msm_vidc_inst* inst)
|
||||
u32 work_route;
|
||||
struct msm_vidc_core* core;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
core = inst->core;
|
||||
work_route = core->capabilities[NUM_VPP_PIPE].value;
|
||||
|
||||
@@ -964,11 +954,6 @@ int msm_vidc_decide_quality_mode_iris3(struct msm_vidc_inst* inst)
|
||||
u32 mbpf, mbps, max_hq_mbpf, max_hq_mbps;
|
||||
u32 mode = MSM_VIDC_POWER_SAVE_MODE;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!is_encode_session(inst))
|
||||
return 0;
|
||||
|
||||
@@ -1018,11 +1003,6 @@ 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) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
adjusted_value = ctrl ? ctrl->val :
|
||||
inst->capabilities[BITRATE_BOOST].value;
|
||||
|
||||
|
@@ -293,11 +293,6 @@ 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) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return freq;
|
||||
}
|
||||
|
||||
core = inst->core;
|
||||
|
||||
mbpf = msm_vidc_get_mbs_per_frame(inst);
|
||||
@@ -362,11 +357,6 @@ u64 msm_vidc_calc_freq_iris3(struct msm_vidc_inst *inst, u32 data_size)
|
||||
{
|
||||
u64 freq = 0;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return freq;
|
||||
}
|
||||
|
||||
if (ENABLE_LEGACY_POWER_CALCULATIONS)
|
||||
freq = msm_vidc_calc_freq_iris3_legacy(inst, data_size);
|
||||
else
|
||||
@@ -387,10 +377,6 @@ 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) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return freq;
|
||||
}
|
||||
core = inst->core;
|
||||
|
||||
if (!core->resource || !core->resource->freq_set.freq_tbl ||
|
||||
|
Reference in New Issue
Block a user