video: driver: Add support for VIDIOC_S_PARM and VIDIOC_G_PARM
Add support for S_PARM and G_PARM to enable client to set and get frame rate and operating rate to driver. Also includes some inst database grooming changes. Change-Id: I5b39537662faa56effa0ac63acdfc100d83bf403 Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
This commit is contained in:
@@ -159,21 +159,15 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
/* ((4096 * 2304) / 256) * 60 fps */
|
/* ((4096 * 2304) / 256) * 60 fps */
|
||||||
{POWER_SAVE_MBPS, ENC, CODECS_ALL, 0, 2211840, 1, 2211840},
|
{POWER_SAVE_MBPS, ENC, CODECS_ALL, 0, 2211840, 1, 2211840},
|
||||||
|
|
||||||
// TODO: Decide to store q16 or just int
|
{FRAME_RATE, ENC|DEC, CODECS_ALL,
|
||||||
{FRAME_RATE, ENC, CODECS_ALL,
|
|
||||||
(MINIMUM_FPS << 16), (MAXIMUM_FPS << 16),
|
(MINIMUM_FPS << 16), (MAXIMUM_FPS << 16),
|
||||||
1, (DEFAULT_FPS << 16),
|
1, (DEFAULT_FPS << 16),
|
||||||
0,
|
0,
|
||||||
HFI_PROP_FRAME_RATE,
|
HFI_PROP_FRAME_RATE,
|
||||||
CAP_FLAG_ROOT | CAP_FLAG_OUTPUT_PORT,
|
CAP_FLAG_ROOT | CAP_FLAG_OUTPUT_PORT},
|
||||||
{0}, {0},
|
|
||||||
NULL, msm_vidc_set_q16},
|
|
||||||
|
|
||||||
// Implement: Operating rate will accept any int value.
|
|
||||||
{OPERATING_RATE, ENC|DEC, CODECS_ALL,
|
{OPERATING_RATE, ENC|DEC, CODECS_ALL,
|
||||||
1, INT_MAX, 1, (DEFAULT_FPS << 16),
|
1, INT_MAX, 1, (DEFAULT_FPS << 16)},
|
||||||
0,
|
|
||||||
HFI_PROP_FRAME_RATE},
|
|
||||||
|
|
||||||
{SCALE_X, ENC, CODECS_ALL, 8192, 65536, 1, 8192},
|
{SCALE_X, ENC, CODECS_ALL, 8192, 65536, 1, 8192},
|
||||||
{SCALE_X, DEC, CODECS_ALL, 65536, 65536, 1, 65536},
|
{SCALE_X, DEC, CODECS_ALL, 65536, 65536, 1, 65536},
|
||||||
@@ -922,9 +916,19 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
CAP_FLAG_ROOT | CAP_FLAG_OUTPUT_PORT},
|
CAP_FLAG_ROOT | CAP_FLAG_OUTPUT_PORT},
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
{STAGE, DEC|ENC, CODECS_ALL, 1, 2, 1, 2},
|
{STAGE, DEC|ENC, CODECS_ALL,
|
||||||
{PIPE, DEC|ENC, CODECS_ALL, 1, 4, 1, 4},
|
MSM_VIDC_STAGE_1,
|
||||||
{POC, DEC, H264, 0, 1, 1, 0},
|
MSM_VIDC_STAGE_2, 1,
|
||||||
|
MSM_VIDC_STAGE_2},
|
||||||
|
{PIPE, DEC|ENC, CODECS_ALL,
|
||||||
|
MSM_VIDC_PIPE_1,
|
||||||
|
MSM_VIDC_PIPE_4, 1,
|
||||||
|
MSM_VIDC_PIPE_4},
|
||||||
|
{POC, DEC, H264, 0, 18, 1, 1},
|
||||||
|
{QUALITY_MODE, DEC|ENC, CODECS_ALL,
|
||||||
|
MSM_VIDC_MAX_QUALITY_MODE,
|
||||||
|
MSM_VIDC_POWER_SAVE_MODE, 1,
|
||||||
|
MSM_VIDC_MAX_QUALITY_MODE},
|
||||||
|
|
||||||
{CODED_FRAMES, DEC, CODECS_ALL, 0, 1, 1, 0,
|
{CODED_FRAMES, DEC, CODECS_ALL, 0, 1, 1, 0,
|
||||||
0,
|
0,
|
||||||
|
@@ -194,10 +194,10 @@ static u32 msm_vidc_encoder_bin_size_iris2(struct msm_vidc_inst *inst)
|
|||||||
{
|
{
|
||||||
struct msm_vidc_core *core;
|
struct msm_vidc_core *core;
|
||||||
u32 size = 0;
|
u32 size = 0;
|
||||||
u32 width, height, num_vpp_pipes;
|
u32 width, height, num_vpp_pipes, stage;
|
||||||
struct v4l2_format *f;
|
struct v4l2_format *f;
|
||||||
|
|
||||||
if (!inst || !inst->core) {
|
if (!inst || !inst->core || !inst->capabilities) {
|
||||||
d_vpr_e("%s: invalid params\n", __func__);
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
@@ -207,14 +207,15 @@ static u32 msm_vidc_encoder_bin_size_iris2(struct msm_vidc_inst *inst)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||||
|
stage = inst->capabilities->cap[STAGE].value;
|
||||||
f = &inst->fmts[OUTPUT_PORT];
|
f = &inst->fmts[OUTPUT_PORT];
|
||||||
width = f->fmt.pix_mp.width;
|
width = f->fmt.pix_mp.width;
|
||||||
height = f->fmt.pix_mp.height;
|
height = f->fmt.pix_mp.height;
|
||||||
|
|
||||||
if (inst->codec == MSM_VIDC_H264)
|
if (inst->codec == MSM_VIDC_H264)
|
||||||
HFI_BUFFER_BIN_H264E(size, width, height, inst->stage, num_vpp_pipes);
|
HFI_BUFFER_BIN_H264E(size, width, height, stage, num_vpp_pipes);
|
||||||
else if (inst->codec == MSM_VIDC_HEVC)
|
else if (inst->codec == MSM_VIDC_HEVC)
|
||||||
HFI_BUFFER_BIN_H265E(size, width, height, inst->stage, num_vpp_pipes);
|
HFI_BUFFER_BIN_H265E(size, width, height, stage, num_vpp_pipes);
|
||||||
|
|
||||||
s_vpr_l(inst->sid, "%s: size %d\n", __func__, size);
|
s_vpr_l(inst->sid, "%s: size %d\n", __func__, size);
|
||||||
return size;
|
return size;
|
||||||
|
@@ -65,13 +65,14 @@ u64 msm_vidc_calc_freq_iris2(struct msm_vidc_inst *inst, u32 data_size)
|
|||||||
|
|
||||||
/* VSP */
|
/* VSP */
|
||||||
/* bitrate is based on fps, scale it using operating rate */
|
/* bitrate is based on fps, scale it using operating rate */
|
||||||
operating_rate = inst->prop.operating_rate >> 16;
|
operating_rate = inst->capabilities->cap[OPERATING_RATE].value >> 16;
|
||||||
if (operating_rate > (inst->prop.frame_rate >> 16) &&
|
if (operating_rate >
|
||||||
(inst->prop.frame_rate >> 16)) {
|
(inst->capabilities->cap[FRAME_RATE].value >> 16) &&
|
||||||
|
(inst->capabilities->cap[FRAME_RATE].value >> 16)) {
|
||||||
vsp_factor_num = operating_rate;
|
vsp_factor_num = operating_rate;
|
||||||
vsp_factor_den = inst->prop.frame_rate >> 16;
|
vsp_factor_den = inst->capabilities->cap[FRAME_RATE].value >> 16;
|
||||||
}
|
}
|
||||||
vsp_cycles = div_u64(((u64)inst->prop.bitrate *
|
vsp_cycles = div_u64(((u64)inst->capabilities->cap[BIT_RATE].value *
|
||||||
vsp_factor_num), vsp_factor_den);
|
vsp_factor_num), vsp_factor_den);
|
||||||
|
|
||||||
base_cycles = core->capabilities[MB_CYCLES_VSP].value;
|
base_cycles = core->capabilities[MB_CYCLES_VSP].value;
|
||||||
|
@@ -18,6 +18,10 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
|
|||||||
int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
|
int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
|
||||||
int msm_vdec_s_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s);
|
int msm_vdec_s_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s);
|
||||||
int msm_vdec_g_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s);
|
int msm_vdec_g_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s);
|
||||||
|
int msm_vdec_s_param(struct msm_vidc_inst *inst,
|
||||||
|
struct v4l2_streamparm *s_parm);
|
||||||
|
int msm_vdec_g_param(struct msm_vidc_inst *inst,
|
||||||
|
struct v4l2_streamparm *s_parm);
|
||||||
int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f);
|
int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f);
|
||||||
int msm_vdec_inst_init(struct msm_vidc_inst *inst);
|
int msm_vdec_inst_init(struct msm_vidc_inst *inst);
|
||||||
int msm_vdec_inst_deinit(struct msm_vidc_inst *inst);
|
int msm_vdec_inst_deinit(struct msm_vidc_inst *inst);
|
||||||
|
@@ -18,6 +18,10 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
|
|||||||
int msm_venc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
|
int msm_venc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f);
|
||||||
int msm_venc_s_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s);
|
int msm_venc_s_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s);
|
||||||
int msm_venc_g_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s);
|
int msm_venc_g_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s);
|
||||||
|
int msm_venc_s_param(struct msm_vidc_inst *inst,
|
||||||
|
struct v4l2_streamparm *s_parm);
|
||||||
|
int msm_venc_g_param(struct msm_vidc_inst *inst,
|
||||||
|
struct v4l2_streamparm *s_parm);
|
||||||
int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f);
|
int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f);
|
||||||
int msm_venc_inst_init(struct msm_vidc_inst *inst);
|
int msm_venc_inst_init(struct msm_vidc_inst *inst);
|
||||||
int msm_venc_inst_deinit(struct msm_vidc_inst *inst);
|
int msm_venc_inst_deinit(struct msm_vidc_inst *inst);
|
||||||
|
@@ -23,6 +23,8 @@ int msm_vidc_s_fmt(void *instance, struct v4l2_format *f);
|
|||||||
int msm_vidc_g_fmt(void *instance, struct v4l2_format *f);
|
int msm_vidc_g_fmt(void *instance, struct v4l2_format *f);
|
||||||
int msm_vidc_s_selection(void* instance, struct v4l2_selection* s);
|
int msm_vidc_s_selection(void* instance, struct v4l2_selection* s);
|
||||||
int msm_vidc_g_selection(void* instance, struct v4l2_selection* s);
|
int msm_vidc_g_selection(void* instance, struct v4l2_selection* s);
|
||||||
|
int msm_vidc_s_param(void *instance, struct v4l2_streamparm *sp);
|
||||||
|
int msm_vidc_g_param(void *instance, struct v4l2_streamparm *sp);
|
||||||
int msm_vidc_s_ctrl(void *instance, struct v4l2_control *a);
|
int msm_vidc_s_ctrl(void *instance, struct v4l2_control *a);
|
||||||
int msm_vidc_s_ext_ctrl(void *instance, struct v4l2_ext_controls *a);
|
int msm_vidc_s_ext_ctrl(void *instance, struct v4l2_ext_controls *a);
|
||||||
int msm_vidc_g_ext_ctrl(void *instance, struct v4l2_ext_controls *a);
|
int msm_vidc_g_ext_ctrl(void *instance, struct v4l2_ext_controls *a);
|
||||||
|
@@ -105,10 +105,6 @@ struct msm_vidc_inst {
|
|||||||
struct vb2_queue vb2q[MAX_PORT];
|
struct vb2_queue vb2q[MAX_PORT];
|
||||||
struct msm_vidc_rectangle crop;
|
struct msm_vidc_rectangle crop;
|
||||||
struct msm_vidc_rectangle compose;
|
struct msm_vidc_rectangle compose;
|
||||||
struct msm_vidc_properties prop;
|
|
||||||
enum msm_vidc_stage_type stage;
|
|
||||||
enum msm_vidc_pipe_type pipe;
|
|
||||||
enum msm_vidc_quality_mode quality_mode;
|
|
||||||
struct msm_vidc_power power;
|
struct msm_vidc_power power;
|
||||||
enum msm_vidc_modes flags;
|
enum msm_vidc_modes flags;
|
||||||
struct vidc_bus_vote_data bus_data;
|
struct vidc_bus_vote_data bus_data;
|
||||||
|
@@ -336,6 +336,7 @@ enum msm_vidc_inst_capability_type {
|
|||||||
STAGE,
|
STAGE,
|
||||||
PIPE,
|
PIPE,
|
||||||
POC,
|
POC,
|
||||||
|
QUALITY_MODE,
|
||||||
CODED_FRAMES,
|
CODED_FRAMES,
|
||||||
BIT_DEPTH,
|
BIT_DEPTH,
|
||||||
CODEC_CONFIG,
|
CODEC_CONFIG,
|
||||||
|
@@ -26,6 +26,10 @@ int msm_v4l2_s_selection(struct file* file, void* fh,
|
|||||||
struct v4l2_selection* s);
|
struct v4l2_selection* s);
|
||||||
int msm_v4l2_g_selection(struct file* file, void* fh,
|
int msm_v4l2_g_selection(struct file* file, void* fh,
|
||||||
struct v4l2_selection* s);
|
struct v4l2_selection* s);
|
||||||
|
int msm_v4l2_s_parm(struct file *file, void *fh,
|
||||||
|
struct v4l2_streamparm *a);
|
||||||
|
int msm_v4l2_g_parm(struct file *file, void *fh,
|
||||||
|
struct v4l2_streamparm *a);
|
||||||
int msm_v4l2_s_ctrl(struct file *file, void *fh,
|
int msm_v4l2_s_ctrl(struct file *file, void *fh,
|
||||||
struct v4l2_control *a);
|
struct v4l2_control *a);
|
||||||
int msm_v4l2_g_ctrl(struct file *file, void *fh,
|
int msm_v4l2_g_ctrl(struct file *file, void *fh,
|
||||||
|
@@ -213,7 +213,12 @@ u32 get_hfi_quality_mode(struct msm_vidc_inst *inst)
|
|||||||
{
|
{
|
||||||
u32 hfi_mode = HFI_MODE_POWER_SAVE;
|
u32 hfi_mode = HFI_MODE_POWER_SAVE;
|
||||||
|
|
||||||
switch(inst->quality_mode) {
|
if (!inst || !inst->capabilities) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(inst->capabilities->cap[QUALITY_MODE].value) {
|
||||||
case MSM_VIDC_MAX_QUALITY_MODE:
|
case MSM_VIDC_MAX_QUALITY_MODE:
|
||||||
hfi_mode = HFI_MODE_MAX_QUALITY;
|
hfi_mode = HFI_MODE_MAX_QUALITY;
|
||||||
break;
|
break;
|
||||||
@@ -221,11 +226,12 @@ u32 get_hfi_quality_mode(struct msm_vidc_inst *inst)
|
|||||||
hfi_mode = HFI_MODE_POWER_SAVE;
|
hfi_mode = HFI_MODE_POWER_SAVE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
s_vpr_e(inst->sid, "%s: invalid qulity mode %d\n",
|
s_vpr_e(inst->sid, "%s: invalid qulity mode %d\n", __func__,
|
||||||
__func__, inst->quality_mode);
|
inst->capabilities->cap[QUALITY_MODE].value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
return hfi_mode;
|
return hfi_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -449,6 +449,7 @@ static int msm_vdec_set_stage(struct msm_vidc_inst *inst)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
u32 stage = 0;
|
u32 stage = 0;
|
||||||
struct msm_vidc_core *core = inst->core;
|
struct msm_vidc_core *core = inst->core;
|
||||||
|
struct msm_vidc_inst_capability *capability = inst->capabilities;
|
||||||
|
|
||||||
rc = call_session_op(core, decide_work_mode, inst);
|
rc = call_session_op(core, decide_work_mode, inst);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
@@ -457,7 +458,7 @@ static int msm_vdec_set_stage(struct msm_vidc_inst *inst)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
stage = inst->stage;
|
stage = capability->cap[STAGE].value;
|
||||||
s_vpr_h(inst->sid, "%s: stage: %d", __func__, stage);
|
s_vpr_h(inst->sid, "%s: stage: %d", __func__, stage);
|
||||||
rc = venus_hfi_session_property(inst,
|
rc = venus_hfi_session_property(inst,
|
||||||
HFI_PROP_STAGE,
|
HFI_PROP_STAGE,
|
||||||
@@ -477,6 +478,7 @@ static int msm_vdec_set_pipe(struct msm_vidc_inst *inst)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
u32 pipe;
|
u32 pipe;
|
||||||
struct msm_vidc_core *core = inst->core;
|
struct msm_vidc_core *core = inst->core;
|
||||||
|
struct msm_vidc_inst_capability *capability = inst->capabilities;
|
||||||
|
|
||||||
rc = call_session_op(core, decide_work_route, inst);
|
rc = call_session_op(core, decide_work_route, inst);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
@@ -485,14 +487,14 @@ static int msm_vdec_set_pipe(struct msm_vidc_inst *inst)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe = inst->pipe;
|
pipe = capability->cap[PIPE].value;
|
||||||
s_vpr_h(inst->sid, "%s: pipe: %d", __func__, pipe);
|
s_vpr_h(inst->sid, "%s: pipe: %d", __func__, pipe);
|
||||||
rc = venus_hfi_session_property(inst,
|
rc = venus_hfi_session_property(inst,
|
||||||
HFI_PROP_PIPE,
|
HFI_PROP_PIPE,
|
||||||
HFI_HOST_FLAGS_NONE,
|
HFI_HOST_FLAGS_NONE,
|
||||||
HFI_PORT_NONE,
|
HFI_PORT_NONE,
|
||||||
HFI_PAYLOAD_U32,
|
HFI_PAYLOAD_U32,
|
||||||
&inst->pipe,
|
&pipe,
|
||||||
sizeof(u32));
|
sizeof(u32));
|
||||||
if (rc)
|
if (rc)
|
||||||
s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
|
s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
|
||||||
@@ -1751,6 +1753,108 @@ int msm_vdec_g_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int msm_vdec_s_param(struct msm_vidc_inst *inst,
|
||||||
|
struct v4l2_streamparm *s_parm)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
struct msm_vidc_inst_capability *capability = NULL;
|
||||||
|
struct v4l2_fract *timeperframe = NULL;
|
||||||
|
u32 q16_rate, max_rate, default_rate;
|
||||||
|
u64 us_per_frame = 0, input_rate = 0;
|
||||||
|
bool is_frame_rate = false;
|
||||||
|
|
||||||
|
if (!inst || !s_parm) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
capability = inst->capabilities;
|
||||||
|
|
||||||
|
if (s_parm->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
|
||||||
|
timeperframe = &s_parm->parm.output.timeperframe;
|
||||||
|
max_rate = capability->cap[FRAME_RATE].max;
|
||||||
|
default_rate = capability->cap[FRAME_RATE].value;
|
||||||
|
is_frame_rate = true;
|
||||||
|
} else {
|
||||||
|
timeperframe = &s_parm->parm.capture.timeperframe;
|
||||||
|
max_rate = capability->cap[OPERATING_RATE].value;
|
||||||
|
default_rate = capability->cap[OPERATING_RATE].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!timeperframe->denominator || !timeperframe->numerator) {
|
||||||
|
s_vpr_e(inst->sid,
|
||||||
|
"%s: invalid rate for type %u\n",
|
||||||
|
__func__, s_parm->type);
|
||||||
|
input_rate = default_rate >> 16;
|
||||||
|
goto set_default;
|
||||||
|
}
|
||||||
|
|
||||||
|
us_per_frame = timeperframe->numerator * (u64)USEC_PER_SEC;
|
||||||
|
do_div(us_per_frame, timeperframe->denominator);
|
||||||
|
|
||||||
|
if (!us_per_frame) {
|
||||||
|
s_vpr_e(inst->sid, "%s: us_per_frame is zero\n",
|
||||||
|
__func__);
|
||||||
|
rc = -EINVAL;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
input_rate = (u64)USEC_PER_SEC;
|
||||||
|
do_div(input_rate, us_per_frame);
|
||||||
|
|
||||||
|
/* Check max allowed rate */
|
||||||
|
if (input_rate > max_rate) {
|
||||||
|
s_vpr_e(inst->sid,
|
||||||
|
"%s: Unsupported rate %u, max_fps %u, type: %u\n",
|
||||||
|
__func__, input_rate, max_rate, s_parm->type);
|
||||||
|
rc = -ENOTSUPP;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_default:
|
||||||
|
q16_rate = (u32)input_rate << 16;
|
||||||
|
s_vpr_h(inst->sid, "%s: type %u value %#x\n",
|
||||||
|
__func__, s_parm->type, q16_rate);
|
||||||
|
|
||||||
|
if (is_frame_rate) {
|
||||||
|
capability->cap[FRAME_RATE].value = q16_rate;
|
||||||
|
} else {
|
||||||
|
capability->cap[OPERATING_RATE].value = q16_rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int msm_vdec_g_param(struct msm_vidc_inst *inst,
|
||||||
|
struct v4l2_streamparm *s_parm)
|
||||||
|
{
|
||||||
|
struct msm_vidc_inst_capability *capability = NULL;
|
||||||
|
struct v4l2_fract *timeperframe = NULL;
|
||||||
|
|
||||||
|
if (!inst || !s_parm) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
capability = inst->capabilities;
|
||||||
|
|
||||||
|
if (s_parm->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
|
||||||
|
timeperframe = &s_parm->parm.output.timeperframe;
|
||||||
|
timeperframe->numerator = 1;
|
||||||
|
timeperframe->denominator =
|
||||||
|
capability->cap[FRAME_RATE].value >> 16;
|
||||||
|
} else {
|
||||||
|
timeperframe = &s_parm->parm.capture.timeperframe;
|
||||||
|
timeperframe->numerator = 1;
|
||||||
|
timeperframe->denominator =
|
||||||
|
capability->cap[OPERATING_RATE].value >> 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_vpr_h(inst->sid, "%s: type %u, num %u denom %u\n",
|
||||||
|
__func__, s_parm->type, timeperframe->numerator,
|
||||||
|
timeperframe->denominator);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
|
int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@@ -1894,11 +1998,6 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
|
|||||||
inst->buffers.output_meta.actual_count = inst->buffers.output.actual_count;
|
inst->buffers.output_meta.actual_count = inst->buffers.output.actual_count;
|
||||||
inst->buffers.output_meta.size = f->fmt.meta.buffersize;
|
inst->buffers.output_meta.size = f->fmt.meta.buffersize;
|
||||||
|
|
||||||
inst->prop.frame_rate = DEFAULT_FPS << 16;
|
|
||||||
inst->prop.operating_rate = DEFAULT_FPS << 16;
|
|
||||||
inst->stage = MSM_VIDC_STAGE_2;
|
|
||||||
inst->pipe = MSM_VIDC_PIPE_4;
|
|
||||||
|
|
||||||
rc = msm_vdec_codec_change(inst,
|
rc = msm_vdec_codec_change(inst,
|
||||||
inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat);
|
inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat);
|
||||||
|
|
||||||
|
@@ -272,6 +272,8 @@ static int msm_venc_set_stage(struct msm_vidc_inst *inst)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct msm_vidc_core *core = inst->core;
|
struct msm_vidc_core *core = inst->core;
|
||||||
|
struct msm_vidc_inst_capability *capability = inst->capabilities;
|
||||||
|
u32 stage;
|
||||||
|
|
||||||
rc = call_session_op(core, decide_work_mode, inst);
|
rc = call_session_op(core, decide_work_mode, inst);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
@@ -280,13 +282,14 @@ static int msm_venc_set_stage(struct msm_vidc_inst *inst)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_vpr_h(inst->sid, "%s: stage: %u\n", __func__, inst->stage);
|
stage = capability->cap[STAGE].value;
|
||||||
|
s_vpr_h(inst->sid, "%s: stage: %u\n", __func__, stage);
|
||||||
rc = venus_hfi_session_property(inst,
|
rc = venus_hfi_session_property(inst,
|
||||||
HFI_PROP_STAGE,
|
HFI_PROP_STAGE,
|
||||||
HFI_HOST_FLAGS_NONE,
|
HFI_HOST_FLAGS_NONE,
|
||||||
HFI_PORT_NONE,
|
HFI_PORT_NONE,
|
||||||
HFI_PAYLOAD_U32,
|
HFI_PAYLOAD_U32,
|
||||||
&inst->stage,
|
&stage,
|
||||||
sizeof(u32));
|
sizeof(u32));
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@@ -297,6 +300,8 @@ static int msm_venc_set_pipe(struct msm_vidc_inst *inst)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct msm_vidc_core *core = inst->core;
|
struct msm_vidc_core *core = inst->core;
|
||||||
|
struct msm_vidc_inst_capability *capability = inst->capabilities;
|
||||||
|
u32 pipe;
|
||||||
|
|
||||||
rc = call_session_op(core, decide_work_route, inst);
|
rc = call_session_op(core, decide_work_route, inst);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
@@ -305,13 +310,14 @@ static int msm_venc_set_pipe(struct msm_vidc_inst *inst)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_vpr_h(inst->sid, "%s: pipe: %u\n", __func__, inst->pipe);
|
pipe = capability->cap[PIPE].value;
|
||||||
|
s_vpr_h(inst->sid, "%s: pipe: %u\n", __func__, pipe);
|
||||||
rc = venus_hfi_session_property(inst,
|
rc = venus_hfi_session_property(inst,
|
||||||
HFI_PROP_PIPE,
|
HFI_PROP_PIPE,
|
||||||
HFI_HOST_FLAGS_NONE,
|
HFI_HOST_FLAGS_NONE,
|
||||||
HFI_PORT_NONE,
|
HFI_PORT_NONE,
|
||||||
HFI_PAYLOAD_U32,
|
HFI_PAYLOAD_U32,
|
||||||
&inst->pipe,
|
&pipe,
|
||||||
sizeof(u32));
|
sizeof(u32));
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@@ -321,20 +327,17 @@ static int msm_venc_set_pipe(struct msm_vidc_inst *inst)
|
|||||||
static int msm_venc_set_quality_mode(struct msm_vidc_inst *inst)
|
static int msm_venc_set_quality_mode(struct msm_vidc_inst *inst)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
struct msm_vidc_inst_capability *capability = inst->capabilities;
|
||||||
|
u32 mode;
|
||||||
|
|
||||||
if (!inst->quality_mode) {
|
mode = capability->cap[QUALITY_MODE].value;
|
||||||
s_vpr_e(inst->sid, "%s: invalid mode: %u\n",
|
s_vpr_h(inst->sid, "%s: quality_mode: %u\n", __func__, mode);
|
||||||
__func__, inst->quality_mode);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_vpr_h(inst->sid, "%s: quality_mode: %u\n", __func__, inst->quality_mode);
|
|
||||||
rc = venus_hfi_session_property(inst,
|
rc = venus_hfi_session_property(inst,
|
||||||
HFI_PROP_QUALITY_MODE,
|
HFI_PROP_QUALITY_MODE,
|
||||||
HFI_HOST_FLAGS_NONE,
|
HFI_HOST_FLAGS_NONE,
|
||||||
HFI_PORT_BITSTREAM,
|
HFI_PORT_BITSTREAM,
|
||||||
HFI_PAYLOAD_U32_ENUM,
|
HFI_PAYLOAD_U32_ENUM,
|
||||||
&inst->quality_mode,
|
&mode,
|
||||||
sizeof(u32));
|
sizeof(u32));
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@@ -1267,6 +1270,121 @@ int msm_venc_g_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int msm_venc_s_param(struct msm_vidc_inst *inst,
|
||||||
|
struct v4l2_streamparm *s_parm)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
struct msm_vidc_inst_capability *capability = NULL;
|
||||||
|
struct v4l2_fract *timeperframe = NULL;
|
||||||
|
u32 q16_rate, max_rate, default_rate;
|
||||||
|
u64 us_per_frame = 0, input_rate = 0;
|
||||||
|
bool is_frame_rate = false;
|
||||||
|
|
||||||
|
if (!inst || !s_parm) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
capability = inst->capabilities;
|
||||||
|
|
||||||
|
if (s_parm->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
|
||||||
|
timeperframe = &s_parm->parm.output.timeperframe;
|
||||||
|
max_rate = capability->cap[OPERATING_RATE].max;
|
||||||
|
default_rate = capability->cap[OPERATING_RATE].value;
|
||||||
|
} else {
|
||||||
|
timeperframe = &s_parm->parm.capture.timeperframe;
|
||||||
|
is_frame_rate = true;
|
||||||
|
max_rate = capability->cap[FRAME_RATE].value;
|
||||||
|
default_rate = capability->cap[FRAME_RATE].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!timeperframe->denominator || !timeperframe->numerator) {
|
||||||
|
s_vpr_e(inst->sid,
|
||||||
|
"%s: invalid rate for type %u\n",
|
||||||
|
__func__, s_parm->type);
|
||||||
|
input_rate = default_rate >> 16;
|
||||||
|
goto set_default;
|
||||||
|
}
|
||||||
|
|
||||||
|
us_per_frame = timeperframe->numerator * (u64)USEC_PER_SEC;
|
||||||
|
do_div(us_per_frame, timeperframe->denominator);
|
||||||
|
|
||||||
|
if (!us_per_frame) {
|
||||||
|
s_vpr_e(inst->sid, "%s: us_per_frame is zero\n",
|
||||||
|
__func__);
|
||||||
|
rc = -EINVAL;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
input_rate = (u64)USEC_PER_SEC;
|
||||||
|
do_div(input_rate, us_per_frame);
|
||||||
|
|
||||||
|
/* Check max allowed rate */
|
||||||
|
if (input_rate > max_rate) {
|
||||||
|
s_vpr_e(inst->sid,
|
||||||
|
"%s: Unsupported rate %u, max_fps %u, type: %u\n",
|
||||||
|
__func__, input_rate, max_rate, s_parm->type);
|
||||||
|
rc = -ENOTSUPP;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_default:
|
||||||
|
q16_rate = (u32)input_rate << 16;
|
||||||
|
s_vpr_h(inst->sid, "%s: type %u value %#x\n",
|
||||||
|
__func__, s_parm->type, q16_rate);
|
||||||
|
|
||||||
|
if (is_frame_rate) {
|
||||||
|
rc = venus_hfi_session_property(inst,
|
||||||
|
HFI_PROP_FRAME_RATE,
|
||||||
|
HFI_HOST_FLAGS_NONE,
|
||||||
|
HFI_PORT_BITSTREAM,
|
||||||
|
HFI_PAYLOAD_Q16,
|
||||||
|
&q16_rate,
|
||||||
|
sizeof(u32));
|
||||||
|
if (rc) {
|
||||||
|
s_vpr_e(inst->sid,
|
||||||
|
"%s: failed to set frame rate to fw\n",
|
||||||
|
__func__);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
capability->cap[FRAME_RATE].value = q16_rate;
|
||||||
|
} else {
|
||||||
|
capability->cap[OPERATING_RATE].value = q16_rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int msm_venc_g_param(struct msm_vidc_inst *inst,
|
||||||
|
struct v4l2_streamparm *s_parm)
|
||||||
|
{
|
||||||
|
struct msm_vidc_inst_capability *capability = NULL;
|
||||||
|
struct v4l2_fract *timeperframe = NULL;
|
||||||
|
|
||||||
|
if (!inst || !s_parm) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
capability = inst->capabilities;
|
||||||
|
|
||||||
|
if (s_parm->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
|
||||||
|
timeperframe = &s_parm->parm.output.timeperframe;
|
||||||
|
timeperframe->numerator = 1;
|
||||||
|
timeperframe->denominator =
|
||||||
|
capability->cap[OPERATING_RATE].value >> 16;
|
||||||
|
} else {
|
||||||
|
timeperframe = &s_parm->parm.capture.timeperframe;
|
||||||
|
timeperframe->numerator = 1;
|
||||||
|
timeperframe->denominator =
|
||||||
|
capability->cap[FRAME_RATE].value >> 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_vpr_h(inst->sid, "%s: type %u, num %u denom %u\n",
|
||||||
|
__func__, s_parm->type, timeperframe->numerator,
|
||||||
|
timeperframe->denominator);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
|
int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@@ -1409,12 +1527,6 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
|
|||||||
inst->buffers.input_meta.actual_count = inst->buffers.input.actual_count;
|
inst->buffers.input_meta.actual_count = inst->buffers.input.actual_count;
|
||||||
inst->buffers.input_meta.size = f->fmt.meta.buffersize;
|
inst->buffers.input_meta.size = f->fmt.meta.buffersize;
|
||||||
|
|
||||||
inst->prop.frame_rate = DEFAULT_FPS << 16;
|
|
||||||
inst->prop.operating_rate = DEFAULT_FPS << 16;
|
|
||||||
inst->stage = MSM_VIDC_STAGE_1;
|
|
||||||
inst->pipe = MSM_VIDC_PIPE_4;
|
|
||||||
inst->quality_mode = MSM_VIDC_MAX_QUALITY_MODE;
|
|
||||||
|
|
||||||
rc = msm_venc_codec_change(inst,
|
rc = msm_venc_codec_change(inst,
|
||||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat);
|
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat);
|
||||||
|
|
||||||
|
@@ -303,6 +303,52 @@ int msm_vidc_g_selection(void* instance, struct v4l2_selection* s)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(msm_vidc_g_selection);
|
EXPORT_SYMBOL(msm_vidc_g_selection);
|
||||||
|
|
||||||
|
int msm_vidc_s_param(void *instance, struct v4l2_streamparm *param)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
struct msm_vidc_inst *inst = instance;
|
||||||
|
|
||||||
|
if (!inst || !param) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE &&
|
||||||
|
param->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (is_decode_session(inst))
|
||||||
|
rc = msm_vdec_s_param(instance, param);
|
||||||
|
else if (is_encode_session(inst))
|
||||||
|
rc = msm_venc_s_param(instance, param);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(msm_vidc_s_param);
|
||||||
|
|
||||||
|
int msm_vidc_g_param(void *instance, struct v4l2_streamparm *param)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
struct msm_vidc_inst *inst = instance;
|
||||||
|
|
||||||
|
if (!inst || !param) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE &&
|
||||||
|
param->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (is_decode_session(inst))
|
||||||
|
rc = msm_vdec_g_param(instance, param);
|
||||||
|
else if (is_encode_session(inst))
|
||||||
|
rc = msm_venc_g_param(instance, param);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(msm_vidc_g_param);
|
||||||
|
|
||||||
int msm_vidc_s_ctrl(void *instance, struct v4l2_control *control)
|
int msm_vidc_s_ctrl(void *instance, struct v4l2_control *control)
|
||||||
{
|
{
|
||||||
struct msm_vidc_inst *inst = instance;
|
struct msm_vidc_inst *inst = instance;
|
||||||
|
@@ -850,12 +850,12 @@ int msm_vidc_set_bitrate_mode(void *instance,
|
|||||||
|
|
||||||
if (lossless) {
|
if (lossless) {
|
||||||
hfi_value = HFI_RC_LOSSLESS;
|
hfi_value = HFI_RC_LOSSLESS;
|
||||||
return rc;
|
goto set;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!frame_rc) {
|
if (!frame_rc) {
|
||||||
hfi_value = HFI_RC_OFF;
|
hfi_value = HFI_RC_OFF;
|
||||||
return rc;
|
goto set;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) {
|
if (bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) {
|
||||||
@@ -871,6 +871,7 @@ int msm_vidc_set_bitrate_mode(void *instance,
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
set:
|
||||||
rc = msm_vidc_packetize_control(inst, cap_id, HFI_PAYLOAD_U32_ENUM,
|
rc = msm_vidc_packetize_control(inst, cap_id, HFI_PAYLOAD_U32_ENUM,
|
||||||
&hfi_value, sizeof(u32), __func__);
|
&hfi_value, sizeof(u32), __func__);
|
||||||
|
|
||||||
|
@@ -1061,12 +1061,21 @@ int msm_vidc_get_mbs_per_frame(struct msm_vidc_inst *inst)
|
|||||||
int msm_vidc_get_fps(struct msm_vidc_inst *inst)
|
int msm_vidc_get_fps(struct msm_vidc_inst *inst)
|
||||||
{
|
{
|
||||||
int fps;
|
int fps;
|
||||||
|
u32 frame_rate, operating_rate;
|
||||||
|
|
||||||
if (inst->prop.operating_rate > inst->prop.frame_rate)
|
if (!inst || !inst->capabilities) {
|
||||||
fps = (inst->prop.operating_rate >> 16) ?
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
(inst->prop.operating_rate >> 16) : 1;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
frame_rate = inst->capabilities->cap[FRAME_RATE].value;
|
||||||
|
operating_rate = inst->capabilities->cap[OPERATING_RATE].value;
|
||||||
|
|
||||||
|
if (operating_rate > frame_rate)
|
||||||
|
fps = (operating_rate >> 16) ?
|
||||||
|
(operating_rate >> 16) : 1;
|
||||||
else
|
else
|
||||||
fps = inst->prop.frame_rate >> 16;
|
fps = frame_rate >> 16;
|
||||||
|
|
||||||
return fps;
|
return fps;
|
||||||
}
|
}
|
||||||
|
@@ -41,6 +41,8 @@ static struct v4l2_ioctl_ops msm_v4l2_ioctl_ops = {
|
|||||||
.vidioc_g_fmt_meta_cap = msm_v4l2_g_fmt,
|
.vidioc_g_fmt_meta_cap = msm_v4l2_g_fmt,
|
||||||
.vidioc_g_selection = msm_v4l2_g_selection,
|
.vidioc_g_selection = msm_v4l2_g_selection,
|
||||||
.vidioc_s_selection = msm_v4l2_s_selection,
|
.vidioc_s_selection = msm_v4l2_s_selection,
|
||||||
|
.vidioc_s_parm = msm_v4l2_s_parm,
|
||||||
|
.vidioc_g_parm = msm_v4l2_g_parm,
|
||||||
.vidioc_reqbufs = msm_v4l2_reqbufs,
|
.vidioc_reqbufs = msm_v4l2_reqbufs,
|
||||||
.vidioc_qbuf = msm_v4l2_qbuf,
|
.vidioc_qbuf = msm_v4l2_qbuf,
|
||||||
.vidioc_dqbuf = msm_v4l2_dqbuf,
|
.vidioc_dqbuf = msm_v4l2_dqbuf,
|
||||||
|
@@ -45,7 +45,7 @@ static int msm_vidc_get_mbps(struct msm_vidc_inst *inst,
|
|||||||
enum load_calc_quirks quirks)
|
enum load_calc_quirks quirks)
|
||||||
{
|
{
|
||||||
int input_port_mbs, output_port_mbs;
|
int input_port_mbs, output_port_mbs;
|
||||||
int fps;
|
int fps, operating_rate, frame_rate;
|
||||||
struct v4l2_format *f;
|
struct v4l2_format *f;
|
||||||
|
|
||||||
f = &inst->fmts[INPUT_PORT];
|
f = &inst->fmts[INPUT_PORT];
|
||||||
@@ -56,11 +56,14 @@ static int msm_vidc_get_mbps(struct msm_vidc_inst *inst,
|
|||||||
output_port_mbs = NUM_MBS_PER_FRAME(f->fmt.pix_mp.width,
|
output_port_mbs = NUM_MBS_PER_FRAME(f->fmt.pix_mp.width,
|
||||||
f->fmt.pix_mp.height);
|
f->fmt.pix_mp.height);
|
||||||
|
|
||||||
fps = inst->prop.frame_rate;
|
frame_rate = inst->capabilities->cap[FRAME_RATE].value;
|
||||||
|
operating_rate = inst->capabilities->cap[OPERATING_RATE].value;
|
||||||
|
|
||||||
|
fps = frame_rate;
|
||||||
|
|
||||||
/* For admission control operating rate is ignored */
|
/* For admission control operating rate is ignored */
|
||||||
if (quirks == LOAD_POWER)
|
if (quirks == LOAD_POWER)
|
||||||
fps = max(inst->prop.operating_rate, inst->prop.frame_rate);
|
fps = max(operating_rate, frame_rate);
|
||||||
|
|
||||||
/* In case of fps < 1 we assume 1 */
|
/* In case of fps < 1 we assume 1 */
|
||||||
fps = max(fps >> 16, 1);
|
fps = max(fps >> 16, 1);
|
||||||
@@ -73,6 +76,11 @@ int msm_vidc_get_inst_load(struct msm_vidc_inst *inst,
|
|||||||
{
|
{
|
||||||
int load = 0;
|
int load = 0;
|
||||||
|
|
||||||
|
if (!inst || !inst->capabilities) {
|
||||||
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (inst->state == MSM_VIDC_OPEN ||
|
if (inst->state == MSM_VIDC_OPEN ||
|
||||||
inst->state == MSM_VIDC_ERROR)
|
inst->state == MSM_VIDC_ERROR)
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -205,7 +213,7 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst)
|
|||||||
struct v4l2_format *inp_f;
|
struct v4l2_format *inp_f;
|
||||||
struct msm_vidc_buffer *vbuf;
|
struct msm_vidc_buffer *vbuf;
|
||||||
u32 data_size = 0;
|
u32 data_size = 0;
|
||||||
int codec = 0;
|
int codec = 0, frame_rate;
|
||||||
|
|
||||||
if (!inst || !inst->core || !inst->capabilities) {
|
if (!inst || !inst->core || !inst->capabilities) {
|
||||||
d_vpr_e("%s: invalid params: %pK\n", __func__, inst);
|
d_vpr_e("%s: invalid params: %pK\n", __func__, inst);
|
||||||
@@ -247,6 +255,7 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frame_rate = inst->capabilities->cap[FRAME_RATE].value;
|
||||||
vote_data->codec = inst->codec;
|
vote_data->codec = inst->codec;
|
||||||
vote_data->input_width = inp_f->fmt.pix_mp.width;
|
vote_data->input_width = inp_f->fmt.pix_mp.width;
|
||||||
vote_data->input_height = inp_f->fmt.pix_mp.height;
|
vote_data->input_height = inp_f->fmt.pix_mp.height;
|
||||||
@@ -262,10 +271,10 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst)
|
|||||||
vote_data->b_frames_enabled =
|
vote_data->b_frames_enabled =
|
||||||
inst->capabilities->cap[B_FRAME].value > 0;
|
inst->capabilities->cap[B_FRAME].value > 0;
|
||||||
/* scale bitrate if operating rate is larger than fps */
|
/* scale bitrate if operating rate is larger than fps */
|
||||||
if (vote_data->fps > (inst->prop.frame_rate >> 16) &&
|
if (vote_data->fps > (frame_rate >> 16) &&
|
||||||
(inst->prop.frame_rate >> 16)) {
|
(frame_rate >> 16)) {
|
||||||
vote_data->bitrate = vote_data->bitrate /
|
vote_data->bitrate = vote_data->bitrate /
|
||||||
(inst->prop.frame_rate >> 16) * vote_data->fps;
|
(frame_rate >> 16) * vote_data->fps;
|
||||||
}
|
}
|
||||||
vote_data->num_formats = 1;
|
vote_data->num_formats = 1;
|
||||||
vote_data->color_formats[0] = v4l2_colorformat_to_driver(
|
vote_data->color_formats[0] = v4l2_colorformat_to_driver(
|
||||||
@@ -293,7 +302,7 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst)
|
|||||||
vote_data->color_formats[0] = color_format;
|
vote_data->color_formats[0] = color_format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vote_data->work_mode = inst->stage;
|
vote_data->work_mode = inst->capabilities->cap[STAGE].value;
|
||||||
if (core->dt->sys_cache_res_set)
|
if (core->dt->sys_cache_res_set)
|
||||||
vote_data->use_sys_cache = true;
|
vote_data->use_sys_cache = true;
|
||||||
vote_data->num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
vote_data->num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
|
||||||
|
@@ -104,6 +104,22 @@ int msm_v4l2_g_selection(struct file* file, void* fh,
|
|||||||
return msm_vidc_g_selection((void*)vidc_inst, s);
|
return msm_vidc_g_selection((void*)vidc_inst, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int msm_v4l2_s_parm(struct file *file, void *fh,
|
||||||
|
struct v4l2_streamparm *a)
|
||||||
|
{
|
||||||
|
struct msm_vidc_inst *vidc_inst = get_vidc_inst(file, fh);
|
||||||
|
|
||||||
|
return msm_vidc_s_param((void *)vidc_inst, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
int msm_v4l2_g_parm(struct file *file, void *fh,
|
||||||
|
struct v4l2_streamparm *a)
|
||||||
|
{
|
||||||
|
struct msm_vidc_inst *vidc_inst = get_vidc_inst(file, fh);
|
||||||
|
|
||||||
|
return msm_vidc_g_param((void *)vidc_inst, a);
|
||||||
|
}
|
||||||
|
|
||||||
int msm_v4l2_s_ctrl(struct file *file, void *fh,
|
int msm_v4l2_s_ctrl(struct file *file, void *fh,
|
||||||
struct v4l2_control *a)
|
struct v4l2_control *a)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user