}
#ifdef CONFIG_VIDEO_EXYNOS_REPEATER
- if (s5p_mfc_is_encoder_otf_node(node))
- ret = s5p_mfc_otf_init(ctx);
- if (ret)
- mfc_err_ctx("OTF: failed otf init\n");
+ if (s5p_mfc_is_encoder_otf_node(node)) {
+ ret = s5p_mfc_otf_create(ctx);
+ if (ret)
+ mfc_err_ctx("OTF: otf_create failed\n");
+ }
#endif
s5p_mfc_perf_init(dev);
mfc_deinit_enc_ctx(ctx);
#ifdef CONFIG_VIDEO_EXYNOS_REPEATER
- if (ctx->otf_handle)
+ if (ctx->otf_handle) {
s5p_mfc_otf_deinit(ctx);
+ s5p_mfc_otf_destroy(ctx);
+ }
#endif
s5p_mfc_destroy_listable_wq_ctx(ctx);
mfc_info_ctx("Enc output codec(%d) : %s\n",
ctx->dst_fmt->codec_mode, ctx->dst_fmt->name);
- if (ctx->otf_handle && ctx->dst_fmt->fourcc != V4L2_PIX_FMT_H264 &&
- ctx->dst_fmt->fourcc != V4L2_PIX_FMT_HEVC) {
- mfc_err_ctx("OTF: only H.264 and HEVC is supported\n");
- return -EINVAL;
+ if (ctx->otf_handle) {
+ if (ctx->dst_fmt->fourcc != V4L2_PIX_FMT_H264 &&
+ ctx->dst_fmt->fourcc != V4L2_PIX_FMT_HEVC) {
+ mfc_err_ctx("OTF: only H.264 and HEVC is supported\n");
+ return -EINVAL;
+ }
+ if (s5p_mfc_otf_init(ctx)) {
+ mfc_err_ctx("OTF: otf_init failed\n");
+ s5p_mfc_otf_destroy(ctx);
+ return -EINVAL;
+ }
}
enc->dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage;
mfc_debug_leave();
}
-int s5p_mfc_otf_init(struct s5p_mfc_ctx *ctx)
+int s5p_mfc_otf_create(struct s5p_mfc_ctx *ctx)
{
struct s5p_mfc_dev *dev;
int i;
return -EINVAL;
}
- if (mfc_otf_init_hwfc_buf(ctx)) {
- mfc_err_dev("OTF: HWFC init failed\n");
- mfc_otf_destroy_handle(ctx);
- return -EINVAL;
- }
-
if (otf_dump) {
/* It is for debugging. Do not return error */
if (s5p_mfc_otf_alloc_stream_buf(ctx)) {
}
}
+ mfc_debug(2, "OTF: otf_create is completed\n");
+
+ mfc_debug_leave();
+
+ return 0;
+}
+
+void s5p_mfc_otf_destroy(struct s5p_mfc_ctx *ctx)
+{
+ mfc_debug_enter();
+
+ if (!ctx) {
+ mfc_err_dev("OTF: no mfc context to run\n");
+ return;
+ }
+
+ s5p_mfc_otf_release_stream_buf(ctx);
+ mfc_otf_destroy_handle(ctx);
+ mfc_debug(2, "OTF: otf_destroy is completed\n");
+
+ mfc_debug_leave();
+}
+
+int s5p_mfc_otf_init(struct s5p_mfc_ctx *ctx)
+{
+ mfc_debug_enter();
+
+ if (!ctx) {
+ mfc_err_dev("OTF: no mfc context to run\n");
+ return -EINVAL;
+ }
+
+ if (!ctx->otf_handle) {
+ mfc_err_dev("OTF: otf_handle was not created\n");
+ return -EINVAL;
+ }
+
+ if (mfc_otf_init_hwfc_buf(ctx)) {
+ mfc_err_dev("OTF: HWFC init failed\n");
+ return -EINVAL;
+ }
+
mfc_debug(2, "OTF: otf_init is completed\n");
mfc_debug_leave();
return;
}
- s5p_mfc_otf_release_stream_buf(ctx);
mfc_otf_deinit_hwfc_buf(ctx);
- mfc_otf_destroy_handle(ctx);
- s5p_mfc_qos_off(ctx);
mfc_debug(2, "OTF: deinit_otf is completed\n");
mfc_debug_leave();
extern struct s5p_mfc_dev *g_mfc_dev;
+int s5p_mfc_otf_create(struct s5p_mfc_ctx *ctx);
+void s5p_mfc_otf_destroy(struct s5p_mfc_ctx *ctx);
int s5p_mfc_otf_init(struct s5p_mfc_ctx *ctx);
void s5p_mfc_otf_deinit(struct s5p_mfc_ctx *ctx);
int s5p_mfc_otf_ctx_ready(struct s5p_mfc_ctx *ctx);