LF-628:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:export frame threshold of frame mode
export frame threshold of frame mode, and then we can modify the threshold without update firmware. It can be used for debug Signed-off-by: ming_qian <ming.qian@nxp.com> Acked-by: <shijie.qin@nxp.com>5.4-rM2-2.2.x-imx-squashed
parent
b3b0eac7bd
commit
23bd461be4
|
@ -67,6 +67,8 @@ static int vpu_show_perf_ena;
|
|||
static int vpu_show_perf_idx = (1 << VPU_MAX_NUM_STREAMS) - 1;
|
||||
static int vpu_show_perf_ent;
|
||||
static int vpu_datadump_ena;
|
||||
static unsigned short frame_threshold[VPU_MAX_NUM_STREAMS];
|
||||
module_param_array(frame_threshold, ushort, NULL, 0644);
|
||||
|
||||
/* Generic End of content startcodes to differentiate from those naturally in the stream/file */
|
||||
#define EOS_GENERIC_HEVC 0x7c010000
|
||||
|
@ -2295,6 +2297,62 @@ static int add_custom_g_ctrl(struct vpu_ctx *This)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int set_frame_threshold(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct vpu_ctx *ctx = v4l2_ctrl_to_ctx(ctrl);
|
||||
|
||||
ctrl->val = max_t(s32, ctrl->val, ctrl->minimum);
|
||||
ctrl->val = min_t(s32, ctrl->val, ctrl->maximum);
|
||||
frame_threshold[ctx->str_index] = ctrl->val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_frame_threshold(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct vpu_ctx *ctx = v4l2_ctrl_to_ctx(ctrl);
|
||||
|
||||
ctrl->val = frame_threshold[ctx->str_index];
|
||||
ctrl->val = max_t(s32, ctrl->val, ctrl->minimum);
|
||||
ctrl->val = min_t(s32, ctrl->val, ctrl->maximum);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_ctrl_frame_threshold(struct vpu_ctx *ctx)
|
||||
{
|
||||
static const struct v4l2_ctrl_ops ctrl_frame_threshold_ops = {
|
||||
.s_ctrl = set_frame_threshold,
|
||||
.g_volatile_ctrl = get_frame_threshold,
|
||||
};
|
||||
struct v4l2_ctrl_config ctrl_config = {
|
||||
.id = V4L2_CID_USER_FRAME_THRESHOLD,
|
||||
.name = "stream frame threshold",
|
||||
.type = V4L2_CTRL_TYPE_INTEGER,
|
||||
.min = 0,
|
||||
.max = USHRT_MAX,
|
||||
.step = 1,
|
||||
.ops = &ctrl_frame_threshold_ops,
|
||||
};
|
||||
struct v4l2_ctrl *ctrl;
|
||||
|
||||
if (!ctx)
|
||||
return -EINVAL;
|
||||
|
||||
ctrl_config.def = frame_threshold[ctx->str_index];
|
||||
ctrl = v4l2_ctrl_new_custom(&ctx->ctrl_handler,
|
||||
&ctrl_config,
|
||||
NULL);
|
||||
if (ctx->ctrl_handler.error || !ctrl) {
|
||||
vpu_err("add frame threshold ctrl fail : %d\n",
|
||||
ctx->ctrl_handler.error);
|
||||
return ctx->ctrl_handler.error;
|
||||
}
|
||||
|
||||
ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
|
||||
ctrl->flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_dec_ctrl(struct vpu_ctx *This)
|
||||
{
|
||||
if (!This)
|
||||
|
@ -2303,6 +2361,7 @@ static int add_dec_ctrl(struct vpu_ctx *This)
|
|||
add_stand_g_ctrl(This);
|
||||
add_custom_s_ctrl(This);
|
||||
add_custom_g_ctrl(This);
|
||||
add_ctrl_frame_threshold(This);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3227,16 +3286,22 @@ static void fill_stream_buffer_info(struct vpu_ctx *ctx)
|
|||
{
|
||||
pDEC_RPC_HOST_IFACE pSharedInterface;
|
||||
pBUFFER_INFO_TYPE buffer_info;
|
||||
int idx;
|
||||
|
||||
if (!ctx)
|
||||
if (!ctx || ctx->str_index < 0 || ctx->str_index >= VPU_MAX_NUM_STREAMS)
|
||||
return;
|
||||
|
||||
idx = ctx->str_index;
|
||||
pSharedInterface = ctx->dev->shared_mem.pSharedInterface;
|
||||
buffer_info = &pSharedInterface->StreamBuffInfo[ctx->str_index];
|
||||
buffer_info = &pSharedInterface->StreamBuffInfo[idx];
|
||||
|
||||
buffer_info->stream_input_mode = ctx->stream_input_mode;
|
||||
if (ctx->stream_input_mode == NON_FRAME_LVL)
|
||||
buffer_info->stream_buffer_threshold = stream_buffer_threshold;
|
||||
else if (frame_threshold[idx] > 0)
|
||||
buffer_info->stream_buffer_threshold = frame_threshold[idx];
|
||||
else
|
||||
buffer_info->stream_buffer_threshold = 0;
|
||||
|
||||
buffer_info->stream_pic_input_count = ctx->frm_total_num;
|
||||
}
|
||||
|
|
|
@ -159,6 +159,7 @@ typedef enum{
|
|||
#define V4L2_CID_USER_FRAME_VUIPRESENT (V4L2_CID_USER_BASE + 0x1108)
|
||||
|
||||
#define V4L2_CID_USER_STREAM_INPUT_MODE (V4L2_CID_USER_BASE + 0x1109)
|
||||
#define V4L2_CID_USER_FRAME_THRESHOLD (V4L2_CID_USER_BASE + 0x110A)
|
||||
|
||||
#define IMX_V4L2_DEC_CMD_START (0x09000000)
|
||||
#define IMX_V4L2_DEC_CMD_RESET (IMX_V4L2_DEC_CMD_START + 1)
|
||||
|
|
Loading…
Reference in New Issue