[COMMON] media: mfc: parse default 10bit format for decoding
authorJeonghee Kim <jhhhh.kim@samsung.com>
Fri, 8 Jun 2018 05:44:18 +0000 (14:44 +0900)
committerSunyoung Kang <sy0816.kang@samsung.com>
Mon, 23 Jul 2018 06:12:18 +0000 (15:12 +0900)
Change-Id: I991532cd6f68a434109af8f84c66570c1f09498c
Signed-off-by: Jeonghee Kim <jhhhh.kim@samsung.com>
drivers/media/platform/exynos/mfc/s5p_mfc.c
drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h
drivers/media/platform/exynos/mfc/s5p_mfc_dec.c
drivers/media/platform/exynos/mfc/s5p_mfc_dec_internal.h
drivers/media/platform/exynos/mfc/s5p_mfc_enc_internal.h
drivers/media/platform/exynos/mfc/s5p_mfc_reg.c

index 28018fa038c05c92a79de76e0871eb6d5df445e4..e458dda19962df91cdc7dc273bc3dfe52f3f9f97 100644 (file)
@@ -972,6 +972,9 @@ static void mfc_parse_dt(struct device_node *np, struct s5p_mfc_dev *mfc)
        of_property_read_u32_array(np, "color_aspect_enc", &pdata->color_aspect_enc.support, 2);
        of_property_read_u32_array(np, "static_info_enc", &pdata->static_info_enc.support, 2);
 
+       /* Default 10bit format for decoding */
+       of_property_read_u32(np, "P010_decoding", &pdata->P010_decoding);
+
        /* Encoder default parameter */
        of_property_read_u32(np, "enc_param_num", &pdata->enc_param_num);
        if (pdata->enc_param_num) {
index 47d02b6761eb9fe9d8f6c5259bd9f904452e7fe3..1d238b533f419d246178af0eac01174ffb16629f 100644 (file)
@@ -392,6 +392,8 @@ struct s5p_mfc_platdata {
        struct s5p_mfc_feature static_info_dec;
        struct s5p_mfc_feature color_aspect_enc;
        struct s5p_mfc_feature static_info_enc;
+       /* Default 10bit format for decoding */
+       unsigned int P010_decoding;
        /* Encoder default parameter */
        unsigned int enc_param_num;
        unsigned int enc_param_addr[MFC_MAX_DEFAULT_PARAM];
index 3ed7ad86fc9e4b78f1779ae5f9011d9d40c919c1..bc5a400c0f8aae5ed497c05075492dcdd8ccaaa0 100644 (file)
@@ -144,6 +144,7 @@ static int vidioc_enum_fmt_vid_out_mplane(struct file *file, void *prov,
 
 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) {
@@ -187,7 +188,10 @@ static void mfc_dec_change_format(struct s5p_mfc_ctx *ctx)
                        case V4L2_PIX_FMT_NV16M:
                        case V4L2_PIX_FMT_NV16M_S10B:
                        case V4L2_PIX_FMT_NV16M_P210:
-                               ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010);
+                               if (dev->pdata->P010_decoding)
+                                       ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010);
+                               else
+                                       ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_S10B);
                                break;
                        case V4L2_PIX_FMT_NV21M:
                        case V4L2_PIX_FMT_NV61M:
@@ -196,7 +200,10 @@ static void mfc_dec_change_format(struct s5p_mfc_ctx *ctx)
                                ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV21M_S10B);
                                break;
                        default:
-                               ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010);
+                               if (dev->pdata->P010_decoding)
+                                       ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010);
+                               else
+                                       ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_S10B);
                                break;
                        }
                }
index 0a19cb38c63afa0f57236c7e1d650e9e1d1f2ee0..7e471795789d0f64a7863128fec4c7bdc3a327a0 100644 (file)
@@ -57,7 +57,7 @@ struct s5p_mfc_fmt dec_formats[] = {
                .mem_planes = 1,
        },
        {
-               .name = "4:2:0 2 Planes Y/CbCr 10bit",
+               .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,
@@ -89,7 +89,7 @@ struct s5p_mfc_fmt dec_formats[] = {
                .mem_planes = 2,
        },
        {
-               .name = "4:2:0 2 Planes Y/CrCb 10bit",
+               .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,
@@ -113,7 +113,7 @@ struct s5p_mfc_fmt dec_formats[] = {
                .mem_planes = 2,
        },
        {
-               .name = "4:2:2 2 Planes Y/CbCr 10bit",
+               .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,
@@ -137,7 +137,7 @@ struct s5p_mfc_fmt dec_formats[] = {
                .mem_planes = 2,
        },
        {
-               .name = "4:2:2 2 Planes Y/CrCb 10bit",
+               .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,
index b21397bcb1bfbbdbd13984c571196d1ddb97ab0f..6a176b86c940cd085ac63015d62604d7e22ff259 100644 (file)
@@ -66,7 +66,7 @@ struct s5p_mfc_fmt enc_formats[] = {
                .mem_planes = 1,
        },
        {
-               .name = "4:2:0 2 Planes Y/CbCr 10bit",
+               .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,
@@ -90,7 +90,7 @@ struct s5p_mfc_fmt enc_formats[] = {
                .mem_planes = 2,
        },
        {
-               .name = "4:2:0 2 Planes Y/CrCb 10bit",
+               .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,
@@ -114,7 +114,7 @@ struct s5p_mfc_fmt enc_formats[] = {
                .mem_planes = 2,
        },
        {
-               .name = "4:2:2 2 Planes Y/CbCr 10bit",
+               .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,
@@ -122,7 +122,7 @@ struct s5p_mfc_fmt enc_formats[] = {
                .mem_planes = 2,
        },
        {
-               .name = "4:2:2 2 Planes Y/CrCb 10bit",
+               .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,
index 09ad25ffca01be29f43f3bcea23226e61b8dd095..7a525e15d05ddaf1ff68d21e220a1984144af192 100644 (file)
@@ -495,7 +495,10 @@ int s5p_mfc_set_dynamic_dpb(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *dst_mb)
 void s5p_mfc_set_pixel_format(struct s5p_mfc_dev *dev, unsigned int format)
 {
        unsigned int reg = 0;
-       unsigned int pix_val, mem_type_10bit = 1;
+       unsigned int pix_val, mem_type_10bit = 0;
+
+       if (dev->pdata->P010_decoding)
+               mem_type_10bit = 1;
 
        switch (format) {
        case V4L2_PIX_FMT_NV12M:
@@ -524,6 +527,7 @@ void s5p_mfc_set_pixel_format(struct s5p_mfc_dev *dev, unsigned int format)
                break;
        case V4L2_PIX_FMT_NV12M_P010:
        case V4L2_PIX_FMT_NV16M_P210:
+               mem_type_10bit = 1;
                pix_val = 0;
                break;
        case V4L2_PIX_FMT_NV21M_S10B:
@@ -533,6 +537,7 @@ void s5p_mfc_set_pixel_format(struct s5p_mfc_dev *dev, unsigned int format)
                break;
        case V4L2_PIX_FMT_NV21M_P010:
        case V4L2_PIX_FMT_NV61M_P210:
+               mem_type_10bit = 1;
                pix_val = 1;
                break;
        default: