|
@@ -226,6 +226,28 @@ static int hva_open_encoder(struct hva_ctx *ctx, u32 streamformat,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+void hva_dbg_summary(struct hva_ctx *ctx)
|
|
|
+{
|
|
|
+ struct device *dev = ctx_to_dev(ctx);
|
|
|
+ struct hva_streaminfo *stream = &ctx->streaminfo;
|
|
|
+ struct hva_frameinfo *frame = &ctx->frameinfo;
|
|
|
+
|
|
|
+ if (!(ctx->flags & HVA_FLAG_STREAMINFO))
|
|
|
+ return;
|
|
|
+
|
|
|
+ dev_dbg(dev, "%s %4.4s %dx%d > %4.4s %dx%d %s %s: %d frames encoded, %d system errors, %d encoding errors, %d frame errors\n",
|
|
|
+ ctx->name,
|
|
|
+ (char *)&frame->pixelformat,
|
|
|
+ frame->aligned_width, frame->aligned_height,
|
|
|
+ (char *)&stream->streamformat,
|
|
|
+ stream->width, stream->height,
|
|
|
+ stream->profile, stream->level,
|
|
|
+ ctx->encoded_frames,
|
|
|
+ ctx->sys_errors,
|
|
|
+ ctx->encode_errors,
|
|
|
+ ctx->frame_errors);
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* V4L2 ioctl operations
|
|
|
*/
|
|
@@ -614,19 +636,17 @@ static int hva_s_ctrl(struct v4l2_ctrl *ctrl)
|
|
|
break;
|
|
|
case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
|
|
|
ctx->ctrls.profile = ctrl->val;
|
|
|
- if (ctx->flags & HVA_FLAG_STREAMINFO)
|
|
|
- snprintf(ctx->streaminfo.profile,
|
|
|
- sizeof(ctx->streaminfo.profile),
|
|
|
- "%s profile",
|
|
|
- v4l2_ctrl_get_menu(ctrl->id)[ctrl->val]);
|
|
|
+ snprintf(ctx->streaminfo.profile,
|
|
|
+ sizeof(ctx->streaminfo.profile),
|
|
|
+ "%s profile",
|
|
|
+ v4l2_ctrl_get_menu(ctrl->id)[ctrl->val]);
|
|
|
break;
|
|
|
case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
|
|
|
ctx->ctrls.level = ctrl->val;
|
|
|
- if (ctx->flags & HVA_FLAG_STREAMINFO)
|
|
|
- snprintf(ctx->streaminfo.level,
|
|
|
- sizeof(ctx->streaminfo.level),
|
|
|
- "level %s",
|
|
|
- v4l2_ctrl_get_menu(ctrl->id)[ctrl->val]);
|
|
|
+ snprintf(ctx->streaminfo.level,
|
|
|
+ sizeof(ctx->streaminfo.level),
|
|
|
+ "level %s",
|
|
|
+ v4l2_ctrl_get_menu(ctrl->id)[ctrl->val]);
|
|
|
break;
|
|
|
case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE:
|
|
|
ctx->ctrls.entropy_mode = ctrl->val;
|
|
@@ -812,6 +832,8 @@ static void hva_run_work(struct work_struct *work)
|
|
|
dst_buf->field = V4L2_FIELD_NONE;
|
|
|
dst_buf->sequence = ctx->stream_num - 1;
|
|
|
|
|
|
+ ctx->encoded_frames++;
|
|
|
+
|
|
|
v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
|
|
|
v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_DONE);
|
|
|
}
|
|
@@ -1026,6 +1048,8 @@ err:
|
|
|
v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_QUEUED);
|
|
|
}
|
|
|
|
|
|
+ ctx->sys_errors++;
|
|
|
+
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
@@ -1150,6 +1174,7 @@ static int hva_open(struct file *file)
|
|
|
if (ret) {
|
|
|
dev_err(dev, "%s [x:x] failed to setup controls\n",
|
|
|
HVA_PREFIX);
|
|
|
+ ctx->sys_errors++;
|
|
|
goto err_fh;
|
|
|
}
|
|
|
ctx->fh.ctrl_handler = &ctx->ctrl_handler;
|
|
@@ -1162,6 +1187,7 @@ static int hva_open(struct file *file)
|
|
|
ret = PTR_ERR(ctx->fh.m2m_ctx);
|
|
|
dev_err(dev, "%s failed to initialize m2m context (%d)\n",
|
|
|
HVA_PREFIX, ret);
|
|
|
+ ctx->sys_errors++;
|
|
|
goto err_ctrls;
|
|
|
}
|
|
|
|
|
@@ -1206,6 +1232,9 @@ static int hva_release(struct file *file)
|
|
|
hva->nb_of_instances--;
|
|
|
}
|
|
|
|
|
|
+ /* trace a summary of instance before closing (debug purpose) */
|
|
|
+ hva_dbg_summary(ctx);
|
|
|
+
|
|
|
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
|
|
|
|
|
|
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
|