MFC driver returns the error when the set format is not supported.
In addition, it does not change the format after header parsing if it is not supported.
Change-Id: Id7927f62c9348d5ca362039e3526f1a199d1014d
Signed-off-by: Jeonghee Kim <jhhhh.kim@samsung.com>
/* Default 10bit format for decoding */
of_property_read_u32(np, "P010_decoding", &pdata->P010_decoding);
+ /* Formats */
+ of_property_read_u32(np, "support_10bit", &pdata->support_10bit);
+ of_property_read_u32(np, "support_422", &pdata->support_422);
+ of_property_read_u32(np, "support_rgb", &pdata->support_rgb);
+
/* Encoder default parameter */
of_property_read_u32(np, "enc_param_num", &pdata->enc_param_num);
if (pdata->enc_param_num) {
enc->chroma_dpb_size + enc->me_buffer_size));
break;
case S5P_FIMV_CODEC_VP9_ENC:
- if (ctx->is_10bit || ctx->is_422format) {
+ if (ctx->is_10bit || ctx->is_422) {
enc->luma_dpb_size =
ALIGN(ENC_VP9_LUMA_DPB_10B_SIZE(ctx->crop_width, ctx->crop_height), 64);
enc->chroma_dpb_size =
break;
case S5P_FIMV_CODEC_HEVC_ENC:
case S5P_FIMV_CODEC_BPG_ENC:
- if (ctx->is_10bit || ctx->is_422format) {
+ if (ctx->is_10bit || ctx->is_422) {
enc->luma_dpb_size =
ALIGN(ENC_HEVC_LUMA_DPB_10B_SIZE(ctx->crop_width, ctx->crop_height), 64);
enc->chroma_dpb_size =
#define MFC_CTRL_TYPE_SRC (MFC_CTRL_TYPE_SET | MFC_CTRL_TYPE_GET_SRC)
#define MFC_CTRL_TYPE_DST (MFC_CTRL_TYPE_GET_DST)
-#define MFC_FMT_DEC 0
-#define MFC_FMT_ENC 1
-#define MFC_FMT_RAW 2
+#define MFC_FMT_STREAM (1 << 0)
+#define MFC_FMT_FRAME (1 << 1)
+#define MFC_FMT_10BIT (1 << 2)
+#define MFC_FMT_422 (1 << 3)
+#define MFC_FMT_RGB (1 << 4)
/* node check */
#define IS_DEC_NODE(n) ((n == EXYNOS_VIDEONODE_MFC_DEC) || \
struct s5p_mfc_feature static_info_enc;
/* Default 10bit format for decoding */
unsigned int P010_decoding;
+ /* Formats */
+ unsigned int support_10bit;
+ unsigned int support_422;
+ unsigned int support_rgb;
/* Encoder default parameter */
unsigned int enc_param_num;
unsigned int enc_param_addr[MFC_MAX_DEFAULT_PARAM];
/* Profile infomation */
int is_10bit;
- int is_422format;
+ int is_422;
/* for DRM */
int is_drm;
seq_printf(s, " static_info_dec: %d(0x%x), enc: %d(0x%x)\n",
dev->pdata->static_info_dec.support, dev->pdata->static_info_dec.version,
dev->pdata->static_info_enc.support, dev->pdata->static_info_enc.version);
+ seq_printf(s, "[FORMATS] 10bit: %s, 422: %s, RGB: %s\n",
+ dev->pdata->support_10bit ? "supported" : "not supported",
+ dev->pdata->support_422 ? "supported" : "not supported",
+ dev->pdata->support_rgb ? "supported" : "not supported");
if (dev->nal_q_handle)
seq_printf(s, "[NAL-Q] state: %d\n", dev->nal_q_handle->nal_q_state);
#define MAX_FRAME_SIZE (2*1024*1024)
/* Find selected format description */
-static struct s5p_mfc_fmt *mfc_dec_find_format(unsigned int pixelformat)
+static struct s5p_mfc_fmt *mfc_dec_find_format(struct s5p_mfc_ctx *ctx,
+ unsigned int pixelformat)
{
+ struct s5p_mfc_dev *dev = ctx->dev;
+ struct s5p_mfc_fmt *fmt = NULL;
unsigned long i;
for (i = 0; i < NUM_FORMATS; i++) {
- if (dec_formats[i].fourcc == pixelformat)
- return (struct s5p_mfc_fmt *)&dec_formats[i];
+ if (dec_formats[i].fourcc == pixelformat) {
+ fmt = (struct s5p_mfc_fmt *)&dec_formats[i];
+ break;
+ }
}
- return NULL;
+ if (!dev->pdata->support_10bit && (fmt->type & MFC_FMT_10BIT)) {
+ mfc_err_ctx("10bit is not supported\n");
+ fmt = NULL;
+ }
+ if (!dev->pdata->support_422 && (fmt->type & MFC_FMT_422)) {
+ mfc_err_ctx("422 is not supported\n");
+ fmt = NULL;
+ }
+
+ return fmt;
}
static struct v4l2_queryctrl *mfc_dec_get_ctrl(int id)
return 0;
}
-/* Enumerate format */
-static int mfc_dec_enum_fmt(struct v4l2_fmtdesc *f, bool mplane, bool out)
+static int mfc_dec_enum_fmt(struct s5p_mfc_dev *dev, struct v4l2_fmtdesc *f,
+ unsigned int type)
{
struct s5p_mfc_fmt *fmt;
unsigned long i, j = 0;
for (i = 0; i < NUM_FORMATS; ++i) {
- if (mplane && dec_formats[i].mem_planes == 1)
- continue;
- else if (!mplane && dec_formats[i].mem_planes > 1)
+ if (!(dec_formats[i].type & type))
continue;
- if (out && dec_formats[i].type != MFC_FMT_DEC)
+ if (!dev->pdata->support_10bit && (dec_formats[i].type & MFC_FMT_10BIT))
continue;
- else if (!out && dec_formats[i].type != MFC_FMT_RAW)
+ if (!dev->pdata->support_422 && (dec_formats[i].type & MFC_FMT_422))
continue;
- if (j == f->index)
- break;
- ++j;
- }
- if (i == NUM_FORMATS)
- return -EINVAL;
+ if (j == f->index) {
+ fmt = &dec_formats[i];
+ strlcpy(f->description, fmt->name,
+ sizeof(f->description));
+ f->pixelformat = fmt->fourcc;
- fmt = &dec_formats[i];
- strlcpy(f->description, fmt->name, sizeof(f->description));
- f->pixelformat = fmt->fourcc;
+ return 0;
+ }
- return 0;
-}
+ ++j;
+ }
-static int vidioc_enum_fmt_vid_cap(struct file *file, void *pirv,
- struct v4l2_fmtdesc *f)
-{
- return mfc_dec_enum_fmt(f, false, false);
+ return -EINVAL;
}
static int vidioc_enum_fmt_vid_cap_mplane(struct file *file, void *pirv,
- struct v4l2_fmtdesc *f)
+ struct v4l2_fmtdesc *f)
{
- return mfc_dec_enum_fmt(f, true, false);
-}
+ struct s5p_mfc_dev *dev = video_drvdata(file);
-static int vidioc_enum_fmt_vid_out(struct file *file, void *prov,
- struct v4l2_fmtdesc *f)
-{
- return mfc_dec_enum_fmt(f, false, true);
+ return mfc_dec_enum_fmt(dev, f, MFC_FMT_FRAME);
}
static int vidioc_enum_fmt_vid_out_mplane(struct file *file, void *prov,
- struct v4l2_fmtdesc *f)
+ struct v4l2_fmtdesc *f)
{
- return mfc_dec_enum_fmt(f, true, true);
+ struct s5p_mfc_dev *dev = video_drvdata(file);
+
+ return mfc_dec_enum_fmt(dev, f, MFC_FMT_STREAM);
}
static void mfc_dec_change_format(struct s5p_mfc_ctx *ctx)
struct s5p_mfc_dev *dev = ctx->dev;
u32 org_fmt = ctx->dst_fmt->fourcc;
- if (ctx->is_10bit && ctx->is_422format) {
+ if (ctx->is_10bit && ctx->is_422) {
switch (org_fmt) {
case V4L2_PIX_FMT_NV16M_S10B:
case V4L2_PIX_FMT_NV61M_S10B:
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV12M_S10B:
case V4L2_PIX_FMT_NV12M_P010:
- ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV16M_S10B);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, 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 = mfc_dec_find_format(V4L2_PIX_FMT_NV61M_S10B);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV61M_S10B);
break;
default:
- ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV16M_S10B);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV16M_S10B);
break;
}
ctx->raw_buf.num_planes = 2;
- } else if (ctx->is_10bit && !ctx->is_422format) {
+ } else if (ctx->is_10bit && !ctx->is_422) {
if (ctx->dst_fmt->mem_planes == 1) {
/* YUV420 only supports the single plane */
- ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12N_10B);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV12N_10B);
} else {
switch (org_fmt) {
case V4L2_PIX_FMT_NV12M_S10B:
case V4L2_PIX_FMT_NV16M_S10B:
case V4L2_PIX_FMT_NV16M_P210:
if (dev->pdata->P010_decoding)
- ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV12M_P010);
else
- ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_S10B);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV12M_S10B);
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 = mfc_dec_find_format(V4L2_PIX_FMT_NV21M_S10B);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV21M_S10B);
break;
default:
if (dev->pdata->P010_decoding)
- ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV12M_P010);
else
- ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_S10B);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV12M_S10B);
break;
}
}
ctx->raw_buf.num_planes = 2;
- } else if (!ctx->is_10bit && ctx->is_422format) {
+ } else if (!ctx->is_10bit && ctx->is_422) {
switch (org_fmt) {
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV61M:
case V4L2_PIX_FMT_NV16M_S10B:
case V4L2_PIX_FMT_NV12M_P010:
case V4L2_PIX_FMT_NV16M_P210:
- ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV16M);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, 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 = mfc_dec_find_format(V4L2_PIX_FMT_NV61M);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV61M);
break;
default:
- ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV16M);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, 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 = mfc_dec_find_format(V4L2_PIX_FMT_NV12M);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, 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 = mfc_dec_find_format(V4L2_PIX_FMT_NV21M);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, V4L2_PIX_FMT_NV21M);
break;
default:
/* It is right format */
{
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
struct s5p_mfc_dec *dec;
- struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
+ struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
struct s5p_mfc_raw_info *raw;
int i;
rectangle. */
s5p_mfc_dec_calc_dpb_size(ctx);
- pix_mp->width = ctx->img_width;
- pix_mp->height = ctx->img_height;
- pix_mp->num_planes = ctx->dst_fmt->mem_planes;
+ pix_fmt_mp->width = ctx->img_width;
+ pix_fmt_mp->height = ctx->img_height;
+ pix_fmt_mp->num_planes = ctx->dst_fmt->mem_planes;
if (dec->is_interlaced)
- pix_mp->field = V4L2_FIELD_INTERLACED;
+ pix_fmt_mp->field = V4L2_FIELD_INTERLACED;
else
- pix_mp->field = V4L2_FIELD_NONE;
+ pix_fmt_mp->field = V4L2_FIELD_NONE;
/* Set pixelformat to the format in which MFC
outputs the decoded frame */
- pix_mp->pixelformat = ctx->dst_fmt->fourcc;
+ pix_fmt_mp->pixelformat = ctx->dst_fmt->fourcc;
for (i = 0; i < ctx->dst_fmt->mem_planes; i++) {
- pix_mp->plane_fmt[i].bytesperline = raw->stride[i];
+ pix_fmt_mp->plane_fmt[i].bytesperline = raw->stride[i];
if (ctx->dst_fmt->mem_planes == 1) {
- pix_mp->plane_fmt[i].sizeimage = raw->total_plane_size;
+ pix_fmt_mp->plane_fmt[i].sizeimage = raw->total_plane_size;
} else {
if (ctx->is_10bit)
- pix_mp->plane_fmt[i].sizeimage = raw->plane_size[i]
+ pix_fmt_mp->plane_fmt[i].sizeimage = raw->plane_size[i]
+ raw->plane_size_2bits[i];
else
- pix_mp->plane_fmt[i].sizeimage = raw->plane_size[i];
+ pix_fmt_mp->plane_fmt[i].sizeimage = raw->plane_size[i];
}
}
}
{
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
struct s5p_mfc_dec *dec;
- struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
+ struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
mfc_debug_enter();
/* This is run on OUTPUT
The buffer contains compressed image
so width and height have no meaning */
- pix_mp->width = 0;
- pix_mp->height = 0;
- pix_mp->field = V4L2_FIELD_NONE;
- pix_mp->plane_fmt[0].bytesperline = dec->src_buf_size;
- pix_mp->plane_fmt[0].sizeimage = dec->src_buf_size;
- pix_mp->pixelformat = ctx->src_fmt->fourcc;
- pix_mp->num_planes = ctx->src_fmt->mem_planes;
+ pix_fmt_mp->width = 0;
+ pix_fmt_mp->height = 0;
+ pix_fmt_mp->field = V4L2_FIELD_NONE;
+ pix_fmt_mp->plane_fmt[0].bytesperline = dec->src_buf_size;
+ pix_fmt_mp->plane_fmt[0].sizeimage = dec->src_buf_size;
+ pix_fmt_mp->pixelformat = ctx->src_fmt->fourcc;
+ pix_fmt_mp->num_planes = ctx->src_fmt->mem_planes;
mfc_debug_leave();
/* Try format */
static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
{
- struct s5p_mfc_dev *dev = video_drvdata(file);
+ struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
struct s5p_mfc_fmt *fmt;
+ struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
+ fmt = mfc_dec_find_format(ctx, pix_fmt_mp->pixelformat);
+ if (!fmt) {
+ mfc_err_dev("Unsupported format for %s\n",
+ V4L2_TYPE_IS_OUTPUT(f->type) ? "source" : "destination");
return -EINVAL;
}
- mfc_debug(2, "Type is %d\n", f->type);
- if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
- 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->fmt.pix_mp.pixelformat);
- if (!fmt) {
- mfc_err_dev("Unsupported format for destination.\n");
- return -EINVAL;
- }
- }
return 0;
}
static int vidioc_s_fmt_vid_cap_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct s5p_mfc_dev *dev = video_drvdata(file);
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
- int ret = 0;
+ struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
if (ctx->vq_dst.streaming) {
mfc_err_ctx("queue busy\n");
return -EBUSY;
}
- ret = vidioc_try_fmt(file, priv, f);
- if (ret)
- return ret;
-
- ctx->dst_fmt = mfc_dec_find_format(f->fmt.pix_mp.pixelformat);
+ ctx->dst_fmt = mfc_dec_find_format(ctx, pix_fmt_mp->pixelformat);
if (!ctx->dst_fmt) {
mfc_err_ctx("Unsupported format for destination.\n");
return -EINVAL;
{
struct s5p_mfc_dev *dev = video_drvdata(file);
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
- struct s5p_mfc_dec *dec;
+ struct s5p_mfc_dec *dec = ctx->dec_priv;
+ struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
int ret = 0;
- struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
-
if (ctx->vq_src.streaming) {
mfc_err_ctx("queue busy\n");
return -EBUSY;
}
- ret = vidioc_try_fmt(file, priv, f);
- if (ret)
- return ret;
+ ctx->src_fmt = mfc_dec_find_format(ctx, pix_fmt_mp->pixelformat);
+ if (!ctx->src_fmt) {
+ mfc_err_ctx("Unsupported format for source.\n");
+ return -EINVAL;
+ }
- 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);
- ctx->pix_format = pix_mp->pixelformat;
- if ((pix_mp->width > 0) && (pix_mp->height > 0)) {
- ctx->img_height = pix_mp->height;
- ctx->img_width = pix_mp->width;
+
+ ctx->pix_format = pix_fmt_mp->pixelformat;
+ if ((pix_fmt_mp->width > 0) && (pix_fmt_mp->height > 0)) {
+ ctx->img_height = pix_fmt_mp->height;
+ ctx->img_width = pix_fmt_mp->width;
}
+
/* As this buffer will contain compressed data, the size is set
* to the maximum size. */
- if (pix_mp->plane_fmt[0].sizeimage)
- dec->src_buf_size = pix_mp->plane_fmt[0].sizeimage;
+ if (pix_fmt_mp->plane_fmt[0].sizeimage)
+ dec->src_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage;
else
dec->src_buf_size = MAX_FRAME_SIZE;
- mfc_debug(2, "sizeimage: %d\n", pix_mp->plane_fmt[0].sizeimage);
- pix_mp->plane_fmt[0].bytesperline = 0;
+ mfc_debug(2, "sizeimage: %d\n", pix_fmt_mp->plane_fmt[0].sizeimage);
+ pix_fmt_mp->plane_fmt[0].bytesperline = 0;
+
MFC_TRACE_CTX_HWLOCK("**DEC s_fmt\n");
ret = s5p_mfc_get_hwlock_ctx(ctx);
if (ret < 0) {
/* v4l2_ioctl_ops */
static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
- .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
.vidioc_enum_fmt_vid_cap_mplane = vidioc_enum_fmt_vid_cap_mplane,
- .vidioc_enum_fmt_vid_out = vidioc_enum_fmt_vid_out,
.vidioc_enum_fmt_vid_out_mplane = vidioc_enum_fmt_vid_out_mplane,
.vidioc_g_fmt_vid_cap_mplane = vidioc_g_fmt_vid_cap_mplane,
.vidioc_g_fmt_vid_out_mplane = vidioc_g_fmt_vid_out_mplane,
.name = "4:2:0 3 Planes Y/Cb/Cr",
.fourcc = V4L2_PIX_FMT_YUV420M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 3,
.mem_planes = 3,
},
.name = "4:2:0 3 Planes Y/Cb/Cr single",
.fourcc = V4L2_PIX_FMT_YUV420N,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 3,
.mem_planes = 1,
},
.name = "4:2:0 3 Planes Y/Cr/Cb",
.fourcc = V4L2_PIX_FMT_YVU420M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 3,
.mem_planes = 3,
},
.name = "4:2:0 2 Planes Y/CbCr",
.fourcc = V4L2_PIX_FMT_NV12M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CbCr single",
.fourcc = V4L2_PIX_FMT_NV12N,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 2,
.mem_planes = 1,
},
.name = "4:2:0 2 Planes Y/CbCr 8+2 10bit",
.fourcc = V4L2_PIX_FMT_NV12M_S10B,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CbCr 10bit single",
.fourcc = V4L2_PIX_FMT_NV12N_10B,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT,
.num_planes = 2,
.mem_planes = 1,
},
.name = "4:2:0 2 Planes Y/CbCr P010 10bit",
.fourcc = V4L2_PIX_FMT_NV12M_P010,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CrCb",
.fourcc = V4L2_PIX_FMT_NV21M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CrCb 8+2 10bit",
.fourcc = V4L2_PIX_FMT_NV21M_S10B,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CrCb P010 10bit",
.fourcc = V4L2_PIX_FMT_NV21M_P010,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CbCr",
.fourcc = V4L2_PIX_FMT_NV16M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CbCr 8+2 10bit",
.fourcc = V4L2_PIX_FMT_NV16M_S10B,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CbCr P210 10bit",
.fourcc = V4L2_PIX_FMT_NV16M_P210,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CrCb",
.fourcc = V4L2_PIX_FMT_NV61M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CrCb 8+2 10bit",
.fourcc = V4L2_PIX_FMT_NV61M_S10B,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CrCb P210 10bit",
.fourcc = V4L2_PIX_FMT_NV61M_P210,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "H264 Encoded Stream",
.fourcc = V4L2_PIX_FMT_H264,
.codec_mode = S5P_FIMV_CODEC_H264_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "H264/MVC Encoded Stream",
.fourcc = V4L2_PIX_FMT_H264_MVC,
.codec_mode = S5P_FIMV_CODEC_H264_MVC_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "H263 Encoded Stream",
.fourcc = V4L2_PIX_FMT_H263,
.codec_mode = S5P_FIMV_CODEC_H263_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "MPEG1 Encoded Stream",
.fourcc = V4L2_PIX_FMT_MPEG1,
.codec_mode = S5P_FIMV_CODEC_MPEG2_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "MPEG2 Encoded Stream",
.fourcc = V4L2_PIX_FMT_MPEG2,
.codec_mode = S5P_FIMV_CODEC_MPEG2_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "MPEG4 Encoded Stream",
.fourcc = V4L2_PIX_FMT_MPEG4,
.codec_mode = S5P_FIMV_CODEC_MPEG4_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "FIMV Encoded Stream",
.fourcc = V4L2_PIX_FMT_FIMV,
.codec_mode = S5P_FIMV_CODEC_MPEG4_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "FIMV1 Encoded Stream",
.fourcc = V4L2_PIX_FMT_FIMV1,
.codec_mode = S5P_FIMV_CODEC_FIMV1_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "FIMV2 Encoded Stream",
.fourcc = V4L2_PIX_FMT_FIMV2,
.codec_mode = S5P_FIMV_CODEC_FIMV2_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "FIMV3 Encoded Stream",
.fourcc = V4L2_PIX_FMT_FIMV3,
.codec_mode = S5P_FIMV_CODEC_FIMV3_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "FIMV4 Encoded Stream",
.fourcc = V4L2_PIX_FMT_FIMV4,
.codec_mode = S5P_FIMV_CODEC_FIMV4_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "XviD Encoded Stream",
.fourcc = V4L2_PIX_FMT_XVID,
.codec_mode = S5P_FIMV_CODEC_MPEG4_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "VC1 Encoded Stream",
.fourcc = V4L2_PIX_FMT_VC1_ANNEX_G,
.codec_mode = S5P_FIMV_CODEC_VC1_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "VC1 RCV Encoded Stream",
.fourcc = V4L2_PIX_FMT_VC1_ANNEX_L,
.codec_mode = S5P_FIMV_CODEC_VC1_RCV_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "VP8 Encoded Stream",
.fourcc = V4L2_PIX_FMT_VP8,
.codec_mode = S5P_FIMV_CODEC_VP8_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "VP9 Encoded Stream",
.fourcc = V4L2_PIX_FMT_VP9,
.codec_mode = S5P_FIMV_CODEC_VP9_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "HEVC Encoded Stream",
.fourcc = V4L2_PIX_FMT_HEVC,
.codec_mode = S5P_FIMV_CODEC_HEVC_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "BPG Encoded Stream",
.fourcc = V4L2_PIX_FMT_BPG,
.codec_mode = S5P_FIMV_CODEC_BPG_DEC,
- .type = MFC_FMT_DEC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
#include "s5p_mfc_buf.h"
#include "s5p_mfc_mem.h"
-static struct s5p_mfc_fmt *mfc_enc_find_format(unsigned int pixelformat)
+static struct s5p_mfc_fmt *mfc_enc_find_format(struct s5p_mfc_ctx *ctx,
+ unsigned int pixelformat)
{
+ struct s5p_mfc_dev *dev = ctx->dev;
+ struct s5p_mfc_fmt *fmt = NULL;
unsigned long i;
for (i = 0; i < NUM_FORMATS; i++) {
- if (enc_formats[i].fourcc == pixelformat)
- return (struct s5p_mfc_fmt *)&enc_formats[i];
+ if (enc_formats[i].fourcc == pixelformat) {
+ fmt = (struct s5p_mfc_fmt *)&enc_formats[i];
+ break;
+ }
}
- return NULL;
+ if (!dev->pdata->support_10bit && (fmt->type & MFC_FMT_10BIT)) {
+ mfc_err_ctx("10bit is not supported\n");
+ fmt = NULL;
+ }
+ if (!dev->pdata->support_422 && (fmt->type & MFC_FMT_422)) {
+ mfc_err_ctx("422 is not supported\n");
+ fmt = NULL;
+ }
+ if (!dev->pdata->support_rgb && (fmt->type & MFC_FMT_RGB)) {
+ mfc_err_ctx("RGB is not supported\n");
+ fmt = NULL;
+ }
+
+ return fmt;
}
static struct v4l2_queryctrl *mfc_enc_get_ctrl(int id)
return 0;
}
-static int mfc_enc_enum_fmt(struct v4l2_fmtdesc *f, bool mplane, bool out)
+static int mfc_enc_enum_fmt(struct s5p_mfc_dev *dev, struct v4l2_fmtdesc *f,
+ unsigned int type)
{
struct s5p_mfc_fmt *fmt;
- unsigned long i;
- int j = 0;
+ unsigned long i, j = 0;
for (i = 0; i < NUM_FORMATS; ++i) {
- if (mplane && enc_formats[i].mem_planes == 1)
+ if (!(enc_formats[i].type & type))
continue;
- else if (!mplane && enc_formats[i].mem_planes > 1)
+ if (!dev->pdata->support_10bit && (enc_formats[i].type & MFC_FMT_10BIT))
continue;
- if (out && enc_formats[i].type != MFC_FMT_RAW)
+ if (!dev->pdata->support_422 && (enc_formats[i].type & MFC_FMT_422))
continue;
- else if (!out && enc_formats[i].type != MFC_FMT_ENC)
+ if (!dev->pdata->support_rgb && (enc_formats[i].type & MFC_FMT_RGB))
continue;
if (j == f->index) {
return -EINVAL;
}
-static int vidioc_enum_fmt_vid_cap(struct file *file, void *pirv,
- struct v4l2_fmtdesc *f)
-{
- return mfc_enc_enum_fmt(f, false, false);
-}
-
static int vidioc_enum_fmt_vid_cap_mplane(struct file *file, void *pirv,
- struct v4l2_fmtdesc *f)
+ struct v4l2_fmtdesc *f)
{
- return mfc_enc_enum_fmt(f, true, false);
-}
+ struct s5p_mfc_dev *dev = video_drvdata(file);
-static int vidioc_enum_fmt_vid_out(struct file *file, void *prov,
- struct v4l2_fmtdesc *f)
-{
- return mfc_enc_enum_fmt(f, false, true);
+ return mfc_enc_enum_fmt(dev, f, MFC_FMT_STREAM);
}
static int vidioc_enum_fmt_vid_out_mplane(struct file *file, void *prov,
- struct v4l2_fmtdesc *f)
+ struct v4l2_fmtdesc *f)
{
- return mfc_enc_enum_fmt(f, true, true);
+ struct s5p_mfc_dev *dev = video_drvdata(file);
+
+ return mfc_enc_enum_fmt(dev, f, MFC_FMT_FRAME);
}
static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
{
+ struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
struct s5p_mfc_fmt *fmt;
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->fmt.pix_mp.pixelformat);
- if (!fmt) {
- mfc_err_dev("failed to try capture format\n");
- return -EINVAL;
- }
-
- if (pix_fmt_mp->plane_fmt[0].sizeimage == 0) {
- mfc_err_dev("must be set encoding dst size\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->fmt.pix_mp.pixelformat);
- if (!fmt) {
- mfc_err_dev("failed to try output format\n");
- return -EINVAL;
- }
-
- if (fmt->mem_planes != pix_fmt_mp->num_planes) {
- mfc_err_dev("plane number is different (%d != %d)\n",
- fmt->mem_planes, pix_fmt_mp->num_planes);
- return -EINVAL;
- }
- } else {
- mfc_err_dev("invalid buf type (%d)\n", f->type);
+ fmt = mfc_enc_find_format(ctx, pix_fmt_mp->pixelformat);
+ if (!fmt) {
+ mfc_err_dev("Unsupported format for %s\n",
+ V4L2_TYPE_IS_OUTPUT(f->type) ? "source" : "destination");
return -EINVAL;
}
case V4L2_PIX_FMT_NV61M_P210:
mfc_debug(2, "is 422 and 10bit format\n");
ctx->is_10bit = 1;
- ctx->is_422format = 1;
+ ctx->is_422 = 1;
break;
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV61M:
mfc_debug(2, "is 422 format\n");
ctx->is_10bit = 0;
- ctx->is_422format = 1;
+ ctx->is_422 = 1;
break;
case V4L2_PIX_FMT_NV12M_S10B:
case V4L2_PIX_FMT_NV12M_P010:
case V4L2_PIX_FMT_NV21M_P010:
mfc_debug(2, "is 10bit format\n");
ctx->is_10bit = 1;
- ctx->is_422format = 0;
+ ctx->is_422 = 0;
break;
default:
ctx->is_10bit = 0;
- ctx->is_422format = 0;
+ ctx->is_422 = 0;
break;
}
- mfc_debug(2, "10bit: %d, 422: %d\n", ctx->is_10bit, ctx->is_422format);
+ mfc_debug(2, "10bit: %d, 422: %d\n", ctx->is_10bit, ctx->is_422);
}
static int vidioc_s_fmt_vid_cap_mplane(struct file *file, void *priv,
struct s5p_mfc_dev *dev = video_drvdata(file);
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
struct s5p_mfc_enc *enc = ctx->enc_priv;
- struct s5p_mfc_fmt *fmt;
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
int ret = 0;
mfc_debug_enter();
- ret = vidioc_try_fmt(file, priv, f);
- if (ret)
- return ret;
-
if (ctx->vq_dst.streaming) {
mfc_err_ctx("dst queue busy\n");
return -EBUSY;
}
- fmt = mfc_enc_find_format(f->fmt.pix_mp.pixelformat);
- if (!fmt) {
- mfc_err_ctx("failed to set capture format\n");
+ ctx->dst_fmt = mfc_enc_find_format(ctx, pix_fmt_mp->pixelformat);
+ if (!ctx->dst_fmt) {
+ mfc_err_ctx("Unsupported format for destination.\n");
return -EINVAL;
}
- ctx->dst_fmt = fmt;
ctx->codec_mode = ctx->dst_fmt->codec_mode;
mfc_info_ctx("Enc output codec(%d) : %s\n",
ctx->dst_fmt->codec_mode, ctx->dst_fmt->name);
struct v4l2_format *f)
{
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
- struct s5p_mfc_fmt *fmt;
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
- int ret = 0;
mfc_debug_enter();
- ret = vidioc_try_fmt(file, priv, f);
- if (ret)
- return ret;
-
if (ctx->vq_src.streaming) {
mfc_err_ctx("src queue busy\n");
return -EBUSY;
return 0;
}
- fmt = mfc_enc_find_format(f->fmt.pix_mp.pixelformat);
- if (!fmt) {
- mfc_err_ctx("failed to set output format\n");
+ ctx->src_fmt = mfc_enc_find_format(ctx, pix_fmt_mp->pixelformat);
+ if (!ctx->src_fmt) {
+ mfc_err_ctx("Unsupported format for source.\n");
return -EINVAL;
}
- if (fmt->mem_planes != pix_fmt_mp->num_planes) {
+ if (ctx->src_fmt->mem_planes != pix_fmt_mp->num_planes) {
mfc_err_ctx("plane number is different (%d != %d)\n",
- fmt->mem_planes, pix_fmt_mp->num_planes);
+ ctx->src_fmt->mem_planes, pix_fmt_mp->num_planes);
return -EINVAL;
}
- ctx->src_fmt = fmt;
ctx->raw_buf.num_planes = ctx->src_fmt->num_planes;
ctx->img_width = pix_fmt_mp->width;
ctx->img_height = pix_fmt_mp->height;
static const struct v4l2_ioctl_ops s5p_mfc_enc_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
- .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
.vidioc_enum_fmt_vid_cap_mplane = vidioc_enum_fmt_vid_cap_mplane,
- .vidioc_enum_fmt_vid_out = vidioc_enum_fmt_vid_out,
.vidioc_enum_fmt_vid_out_mplane = vidioc_enum_fmt_vid_out_mplane,
.vidioc_g_fmt_vid_cap_mplane = vidioc_g_fmt,
.vidioc_g_fmt_vid_out_mplane = vidioc_g_fmt,
.name = "4:2:0 3 Planes Y/Cb/Cr",
.fourcc = V4L2_PIX_FMT_YUV420M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 3,
.mem_planes = 3,
},
.name = "4:2:0 3 Planes Y/Cb/Cr single",
.fourcc = V4L2_PIX_FMT_YUV420N,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 3,
.mem_planes = 1,
},
.name = "4:2:0 3 Planes Y/Cr/Cb",
.fourcc = V4L2_PIX_FMT_YVU420M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 3,
.mem_planes = 3,
},
.name = "4:2:0 2 Planes",
.fourcc = V4L2_PIX_FMT_NV12M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CbCr single",
.fourcc = V4L2_PIX_FMT_NV12N,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 2,
.mem_planes = 1,
},
.name = "4:2:0 2 Planes Y/CbCr 8+2 10bit",
.fourcc = V4L2_PIX_FMT_NV12M_S10B,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CbCr P010 10bit",
.fourcc = V4L2_PIX_FMT_NV12M_P010,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CrCb",
.fourcc = V4L2_PIX_FMT_NV21M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CrCb 8+2 10bit",
.fourcc = V4L2_PIX_FMT_NV21M_S10B,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:0 2 Planes Y/CrCb P010 10bit",
.fourcc = V4L2_PIX_FMT_NV21M_P010,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CbCr",
.fourcc = V4L2_PIX_FMT_NV16M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CbCr 8+2 10bit",
.fourcc = V4L2_PIX_FMT_NV16M_S10B,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CrCb 8+2 10bit",
.fourcc = V4L2_PIX_FMT_NV61M_S10B,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CbCr P210 10bit",
.fourcc = V4L2_PIX_FMT_NV16M_P210,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CrCb P210 10bit",
.fourcc = V4L2_PIX_FMT_NV61M_P210,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_10BIT | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "4:2:2 2 Planes Y/CrCb",
.fourcc = V4L2_PIX_FMT_NV61M,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_422,
.num_planes = 2,
.mem_planes = 2,
},
.name = "RGB888 1 Plane 24bpp",
.fourcc = V4L2_PIX_FMT_RGB24,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_RGB,
.num_planes = 1,
.mem_planes = 1,
},
.name = "RGB565 1 Plane 16bpp",
.fourcc = V4L2_PIX_FMT_RGB565,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_RGB,
.num_planes = 1,
.mem_planes = 1,
},
.name = "RGBX8888 1 Plane 32bpp",
.fourcc = V4L2_PIX_FMT_RGB32X,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_RGB,
.num_planes = 1,
.mem_planes = 1,
},
.name = "BGRA8888 1 Plane 32bpp",
.fourcc = V4L2_PIX_FMT_BGR32,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_RGB,
.num_planes = 1,
.mem_planes = 1,
},
.name = "ARGB8888 1 Plane 32bpp",
.fourcc = V4L2_PIX_FMT_ARGB32,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME | MFC_FMT_RGB,
.num_planes = 1,
.mem_planes = 1,
},
.name = "H264 Encoded Stream",
.fourcc = V4L2_PIX_FMT_H264,
.codec_mode = S5P_FIMV_CODEC_H264_ENC,
- .type = MFC_FMT_ENC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "MPEG4 Encoded Stream",
.fourcc = V4L2_PIX_FMT_MPEG4,
.codec_mode = S5P_FIMV_CODEC_MPEG4_ENC,
- .type = MFC_FMT_ENC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "H263 Encoded Stream",
.fourcc = V4L2_PIX_FMT_H263,
.codec_mode = S5P_FIMV_CODEC_H263_ENC,
- .type = MFC_FMT_ENC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "VP8 Encoded Stream",
.fourcc = V4L2_PIX_FMT_VP8,
.codec_mode = S5P_FIMV_CODEC_VP8_ENC,
- .type = MFC_FMT_ENC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "VP9 Encoded Stream",
.fourcc = V4L2_PIX_FMT_VP9,
.codec_mode = S5P_FIMV_CODEC_VP9_ENC,
- .type = MFC_FMT_ENC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "HEVC Encoded Stream",
.fourcc = V4L2_PIX_FMT_HEVC,
.codec_mode = S5P_FIMV_CODEC_HEVC_ENC,
- .type = MFC_FMT_ENC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "BPG Encoded Stream",
.fourcc = V4L2_PIX_FMT_BPG,
.codec_mode = S5P_FIMV_CODEC_BPG_ENC,
- .type = MFC_FMT_ENC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
MFC_WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE);
/* for only information about wrong setting */
- if (ctx->is_422format) {
+ if (ctx->is_422) {
if ((p_vp9->vp9_version != S5P_FIMV_E_PROFILE_VP9_PROFILE1) &&
(p_vp9->vp9_version != S5P_FIMV_E_PROFILE_VP9_PROFILE3)) {
mfc_err_ctx("4:2:2 format is not matched with profile(%d)\n",
MFC_WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE);
/* for only information about wrong setting */
- if (ctx->is_422format) {
+ if (ctx->is_422) {
if ((p_hevc->profile != S5P_FIMV_E_PROFILE_HEVC_MAIN_422_10_INTRA) &&
(p_hevc->profile != S5P_FIMV_E_PROFILE_HEVC_MAIN_422_10)) {
mfc_err_ctx("4:2:2 format is not matched with profile(%d)\n",
reg |= (0x2 << 17);
reg |= (0x2 << 20);
/* fixed profile */
- if (ctx->is_422format)
+ if (ctx->is_422)
reg |= 0x1;
}
MFC_WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE);
.name = "4:2:0 2 Planes Y/CbCr single",
.fourcc = V4L2_PIX_FMT_NV12N,
.codec_mode = MFC_FORMATS_NO_CODEC,
- .type = MFC_FMT_RAW,
+ .type = MFC_FMT_FRAME,
.num_planes = 2,
.mem_planes = 1,
},
.name = "H264 Encoded Stream",
.fourcc = V4L2_PIX_FMT_H264,
.codec_mode = S5P_FIMV_CODEC_H264_ENC,
- .type = MFC_FMT_ENC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
.name = "HEVC Encoded Stream",
.fourcc = V4L2_PIX_FMT_HEVC,
.codec_mode = S5P_FIMV_CODEC_HEVC_ENC,
- .type = MFC_FMT_ENC,
+ .type = MFC_FMT_STREAM,
.num_planes = 1,
.mem_planes = 1,
},
s5p_mfc_dec_store_crop_info(ctx);
dec->mv_count = s5p_mfc_get_mv_count();
- if (CODEC_10BIT(ctx)) {
+ if (CODEC_10BIT(ctx) && dev->pdata->support_10bit) {
if (s5p_mfc_get_luma_bit_depth_minus8() ||
s5p_mfc_get_chroma_bit_depth_minus8() ||
s5p_mfc_get_profile() == S5P_FIMV_D_PROFILE_HEVC_MAIN_10) {
s5p_mfc_get_chroma_bit_depth_minus8() + 8);
}
}
- if (CODEC_422FORMAT(ctx)) {
+ if (CODEC_422FORMAT(ctx) && dev->pdata->support_422) {
if (s5p_mfc_get_chroma_format() == S5P_FIMV_D_CHROMA_422) {
- ctx->is_422format = 1;
+ ctx->is_422 = 1;
mfc_info_ctx("422 chroma format\n");
}
}
#include "s5p_mfc_buf.h"
#include "s5p_mfc_mem.h"
-static struct s5p_mfc_fmt *mfc_enc_hwfc_find_format(unsigned int format, unsigned int t)
+static struct s5p_mfc_fmt *mfc_enc_hwfc_find_format(unsigned int pixelformat)
{
unsigned long i;
mfc_debug_enter();
for (i = 0; i < NUM_FORMATS; i++) {
- if (enc_hwfc_formats[i].fourcc == format &&
- enc_hwfc_formats[i].type == t)
+ if (enc_hwfc_formats[i].fourcc == pixelformat)
return (struct s5p_mfc_fmt *)&enc_hwfc_formats[i];
}
mfc_debug_enter();
- ctx->src_fmt = mfc_enc_hwfc_find_format(buf_info->pixel_format, MFC_FMT_RAW);
+ ctx->src_fmt = mfc_enc_hwfc_find_format(buf_info->pixel_format);
if (!ctx->src_fmt) {
mfc_err_ctx("OTF: failed to set source format\n");
return -EINVAL;
} else {
if (ctx->is_10bit)
weight = (weight * 100) / MFC_QOS_WEIGHT_10BIT;
- else if (ctx->is_422format)
+ else if (ctx->is_422)
weight = (weight * 100) / MFC_QOS_WEIGHT_422_10INTRA;
}
break;
mfc_debug(3, "QoS weight: %d.%03d, codec: %d, num planes: %d, "
"10bit: %d, 422format: %d (mb: %ld)\n",
weight / 1000, weight % 1000, ctx->codec_mode,
- num_planes, ctx->is_10bit, ctx->is_422format,
+ num_planes, ctx->is_10bit, ctx->is_422,
weighted_mb);