#define MAX_FRAME_SIZE (2*1024*1024)
/* Find selected format description */
-static struct s5p_mfc_fmt *mfc_dec_find_format(struct v4l2_format *f, unsigned int t)
+static struct s5p_mfc_fmt *mfc_dec_find_format(unsigned int pixelformat)
{
unsigned long i;
for (i = 0; i < NUM_FORMATS; i++) {
- if (dec_formats[i].fourcc == f->fmt.pix_mp.pixelformat &&
- dec_formats[i].type == t)
+ if (dec_formats[i].fourcc == pixelformat)
return (struct s5p_mfc_fmt *)&dec_formats[i];
}
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV12M_S10B:
case V4L2_PIX_FMT_NV12M_P010:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[14];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV16M_S10B);
break;
case V4L2_PIX_FMT_NV21M:
case V4L2_PIX_FMT_NV61M:
case V4L2_PIX_FMT_NV21M_S10B:
case V4L2_PIX_FMT_NV21M_P010:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[17];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV61M_S10B);
break;
default:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[14];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV16M_S10B);
break;
}
ctx->raw_buf.num_planes = 2;
} else if (ctx->is_10bit && !ctx->is_422format) {
if (ctx->dst_fmt->mem_planes == 1) {
/* YUV420 only supports the single plane */
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[8];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12N_10B);
} else {
switch (org_fmt) {
case V4L2_PIX_FMT_NV12M_S10B:
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV16M_S10B:
case V4L2_PIX_FMT_NV16M_P210:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[9];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010);
break;
case V4L2_PIX_FMT_NV21M:
case V4L2_PIX_FMT_NV61M:
case V4L2_PIX_FMT_NV61M_S10B:
case V4L2_PIX_FMT_NV61M_P210:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[11];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV21M_S10B);
break;
default:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[9];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010);
break;
}
}
case V4L2_PIX_FMT_NV16M_S10B:
case V4L2_PIX_FMT_NV12M_P010:
case V4L2_PIX_FMT_NV16M_P210:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[13];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV16M);
break;
case V4L2_PIX_FMT_NV21M:
case V4L2_PIX_FMT_NV21M_S10B:
case V4L2_PIX_FMT_NV61M_S10B:
case V4L2_PIX_FMT_NV21M_P010:
case V4L2_PIX_FMT_NV61M_P210:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[16];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV61M);
break;
default:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[13];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV16M);
break;
}
ctx->raw_buf.num_planes = 2;
case V4L2_PIX_FMT_NV16M_S10B:
case V4L2_PIX_FMT_NV12M_P010:
case V4L2_PIX_FMT_NV16M_P210:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[5];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M);
break;
case V4L2_PIX_FMT_NV61M:
case V4L2_PIX_FMT_NV21M_S10B:
case V4L2_PIX_FMT_NV61M_S10B:
case V4L2_PIX_FMT_NV21M_P010:
case V4L2_PIX_FMT_NV61M_P210:
- ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[10];
+ ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV21M);
break;
default:
/* It is right format */
}
mfc_debug(2, "Type is %d\n", f->type);
if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
- fmt = mfc_dec_find_format(f, MFC_FMT_DEC);
+ fmt = mfc_dec_find_format(f->fmt.pix_mp.pixelformat);
if (!fmt) {
mfc_err_dev("Unsupported format for source.\n");
return -EINVAL;
}
} else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
- fmt = mfc_dec_find_format(f, MFC_FMT_RAW);
-
+ fmt = mfc_dec_find_format(f->fmt.pix_mp.pixelformat);
if (!fmt) {
mfc_err_dev("Unsupported format for destination.\n");
return -EINVAL;
}
-
- if (fmt->fourcc == V4L2_PIX_FMT_NV12MT) {
- mfc_err_dev("Not supported format: NV12MT\n");
- return -EINVAL;
- }
- else if(fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16) {
- mfc_err_dev("Not supported format: NV12MT_16X16\n");
- return -EINVAL;
- }
}
return 0;
if (ret)
return ret;
- ctx->dst_fmt = mfc_dec_find_format(f, MFC_FMT_RAW);
+ ctx->dst_fmt = mfc_dec_find_format(f->fmt.pix_mp.pixelformat);
if (!ctx->dst_fmt) {
mfc_err_ctx("Unsupported format for destination.\n");
return -EINVAL;
if (ret)
return ret;
- ctx->src_fmt = mfc_dec_find_format(f, MFC_FMT_DEC);
+ ctx->src_fmt = mfc_dec_find_format(f->fmt.pix_mp.pixelformat);
ctx->codec_mode = ctx->src_fmt->codec_mode;
mfc_info_ctx("Dec input codec(%d): %s\n",
ctx->codec_mode, ctx->src_fmt->name);
#include "s5p_mfc_buf.h"
#include "s5p_mfc_mem.h"
-static struct s5p_mfc_fmt *mfc_enc_find_format(struct v4l2_format *f, unsigned int t)
+static struct s5p_mfc_fmt *mfc_enc_find_format(unsigned int pixelformat)
{
unsigned long i;
for (i = 0; i < NUM_FORMATS; i++) {
- if (enc_formats[i].fourcc == f->fmt.pix_mp.pixelformat &&
- enc_formats[i].type == t)
+ if (enc_formats[i].fourcc == pixelformat)
return (struct s5p_mfc_fmt *)&enc_formats[i];
}
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
- fmt = mfc_enc_find_format(f, MFC_FMT_ENC);
+ fmt = mfc_enc_find_format(f->fmt.pix_mp.pixelformat);
if (!fmt) {
mfc_err_dev("failed to try capture format\n");
return -EINVAL;
pix_fmt_mp->plane_fmt[0].bytesperline =
pix_fmt_mp->plane_fmt[0].sizeimage;
} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
- fmt = mfc_enc_find_format(f, MFC_FMT_RAW);
+ fmt = mfc_enc_find_format(f->fmt.pix_mp.pixelformat);
if (!fmt) {
mfc_err_dev("failed to try output format\n");
return -EINVAL;
return -EBUSY;
}
- fmt = mfc_enc_find_format(f, MFC_FMT_ENC);
+ fmt = mfc_enc_find_format(f->fmt.pix_mp.pixelformat);
if (!fmt) {
mfc_err_ctx("failed to set capture format\n");
return -EINVAL;
return 0;
}
- fmt = mfc_enc_find_format(f, MFC_FMT_RAW);
+ fmt = mfc_enc_find_format(f->fmt.pix_mp.pixelformat);
if (!fmt) {
mfc_err_ctx("failed to set output format\n");
return -EINVAL;
}
- if (fmt->fourcc == V4L2_PIX_FMT_NV12MT) {
- mfc_err_ctx("Not supported format: NV12MT\n");
- return -EINVAL;
- } else if (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16) {
- mfc_err_ctx("Not supported format: NV12MT_16X16\n");
- return -EINVAL;
- }
if (fmt->mem_planes != pix_fmt_mp->num_planes) {
mfc_err_ctx("plane number is different (%d != %d)\n",