[COMMON] media: mfc: change the default 10bit format
authorAyoung Sim <a.sim@samsung.com>
Tue, 15 May 2018 06:33:31 +0000 (15:33 +0900)
committerSunyoung Kang <sy0816.kang@samsung.com>
Mon, 23 Jul 2018 06:12:18 +0000 (15:12 +0900)
Default 10bit format is changed to P010 format and
default MEM_TYPE_10B is changed too,
because P010 format should set the MEM_TYPE_10B to 1.
Also, MEM_TYPE_10B should be set when SEQ_START.

Change-Id: I1c4d9748b1681dd485550a49614b772e0802a783
Signed-off-by: Ayoung Sim <a.sim@samsung.com>
drivers/media/platform/exynos/mfc/s5p_mfc_cmd.c
drivers/media/platform/exynos/mfc/s5p_mfc_dec.c
drivers/media/platform/exynos/mfc/s5p_mfc_reg.c

index 33ba1b88a24a7e4d1384be0db4da26024038e8f9..d8cc47840c85df8e0e6ca288486d3b447904089e 100644 (file)
@@ -153,7 +153,7 @@ int s5p_mfc_cmd_dec_init_buffers(struct s5p_mfc_ctx *ctx)
 {
        struct s5p_mfc_dev *dev;
        struct s5p_mfc_dec *dec;
-       unsigned int reg = 0, pix_val, mem_type = 0;
+       unsigned int reg = 0, pix_val;
        int ret;
 
        if (!ctx) {
@@ -166,61 +166,44 @@ int s5p_mfc_cmd_dec_init_buffers(struct s5p_mfc_ctx *ctx)
                mfc_err_ctx("no mfc device to run\n");
                return -EINVAL;
        }
-       /* Initializing decoding - parsing header */
-       /* Header was parsed now starting processing
-        * First set the output frame buffers
-        * s5p_mfc_alloc_dec_buffers(ctx); */
 
        switch (ctx->dst_fmt->fourcc) {
        case V4L2_PIX_FMT_NV12M:
        case V4L2_PIX_FMT_NV12N:
        case V4L2_PIX_FMT_NV12MT_16X16:
        case V4L2_PIX_FMT_NV16M:
-               pix_val = 0;
-               break;
-       case V4L2_PIX_FMT_NV21M:
-       case V4L2_PIX_FMT_NV61M:
-               pix_val = 1;
-               break;
-       case V4L2_PIX_FMT_YVU420M:
-               pix_val = 2;
-               break;
-       case V4L2_PIX_FMT_YUV420M:
-       case V4L2_PIX_FMT_YUV420N:
-               pix_val = 3;
-               break;
-       /* 10bit */
        case V4L2_PIX_FMT_NV12N_10B:
        case V4L2_PIX_FMT_NV12M_S10B:
        case V4L2_PIX_FMT_NV16M_S10B:
-               mem_type = 0;
-               pix_val = 0;
-               break;
        case V4L2_PIX_FMT_NV12M_P010:
        case V4L2_PIX_FMT_NV16M_P210:
-               mem_type = 1;
                pix_val = 0;
                break;
+       case V4L2_PIX_FMT_NV21M:
+       case V4L2_PIX_FMT_NV61M:
        case V4L2_PIX_FMT_NV21M_S10B:
        case V4L2_PIX_FMT_NV61M_S10B:
-               mem_type = 0;
-               pix_val = 1;
-               break;
        case V4L2_PIX_FMT_NV21M_P010:
        case V4L2_PIX_FMT_NV61M_P210:
-               mem_type = 1;
                pix_val = 1;
                break;
+       case V4L2_PIX_FMT_YVU420M:
+               pix_val = 2;
+               break;
+       case V4L2_PIX_FMT_YUV420M:
+       case V4L2_PIX_FMT_YUV420N:
+               pix_val = 3;
+               break;
        default:
                pix_val = 0;
                break;
        }
-       reg = 0;
-       reg |= pix_val;
-       reg |= (mem_type << 4);
+       reg = MFC_READL(S5P_FIMV_PIXEL_FORMAT);
+       reg &= ~(0xF);
+       reg |= pix_val & 0xF;
        MFC_WRITEL(reg, S5P_FIMV_PIXEL_FORMAT);
-       mfc_debug(2, "pixel format: %d, mem_type for 10bit: %d (reg: %#x)\n",
-                       pix_val, mem_type, reg);
+       mfc_debug(2, "pixel format: %d, mem_type_10bit should be fixed on SEQ_START(reg: %#x)\n",
+                       pix_val, reg);
 
        s5p_mfc_clean_ctx_int_flags(ctx);
        ret = s5p_mfc_set_dec_codec_buffers(ctx);
index 8de947ab54701e2d783a705bbe16254f3d894c5c..2f5048b4cf20a76769182ea29fb5a779185fda48 100644 (file)
@@ -188,7 +188,7 @@ 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 = (struct s5p_mfc_fmt *)&dec_formats[7];
+                               ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[9];
                                break;
                        case V4L2_PIX_FMT_NV21M:
                        case V4L2_PIX_FMT_NV61M:
@@ -197,7 +197,7 @@ static void mfc_dec_change_format(struct s5p_mfc_ctx *ctx)
                                ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[11];
                                break;
                        default:
-                               ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[7];
+                               ctx->dst_fmt = (struct s5p_mfc_fmt *)&dec_formats[9];
                                break;
                        }
                }
index e4af9d98922a8cc6f7d16f35bdc4d4ca1d5bc7f9..09ad25ffca01be29f43f3bcea23226e61b8dd095 100644 (file)
@@ -495,7 +495,7 @@ 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 = 0;
+       unsigned int pix_val, mem_type_10bit = 1;
 
        switch (format) {
        case V4L2_PIX_FMT_NV12M:
@@ -515,26 +515,24 @@ void s5p_mfc_set_pixel_format(struct s5p_mfc_dev *dev, unsigned int format)
        case V4L2_PIX_FMT_YUV420N:
                pix_val = 3;
                break;
-       /* 10bit */
+       /* For 10bit direct set */
        case V4L2_PIX_FMT_NV12N_10B:
        case V4L2_PIX_FMT_NV12M_S10B:
        case V4L2_PIX_FMT_NV16M_S10B:
-               mem_type = 0;
+               mem_type_10bit = 0;
                pix_val = 0;
                break;
        case V4L2_PIX_FMT_NV12M_P010:
        case V4L2_PIX_FMT_NV16M_P210:
-               mem_type = 1;
                pix_val = 0;
                break;
        case V4L2_PIX_FMT_NV21M_S10B:
        case V4L2_PIX_FMT_NV61M_S10B:
-               mem_type = 0;
+               mem_type_10bit = 0;
                pix_val = 1;
                break;
        case V4L2_PIX_FMT_NV21M_P010:
        case V4L2_PIX_FMT_NV61M_P210:
-               mem_type = 1;
                pix_val = 1;
                break;
        default:
@@ -542,8 +540,8 @@ void s5p_mfc_set_pixel_format(struct s5p_mfc_dev *dev, unsigned int format)
                break;
        }
        reg |= pix_val;
-       reg |= (mem_type << 4);
+       reg |= (mem_type_10bit << 4);
        MFC_WRITEL(reg, S5P_FIMV_PIXEL_FORMAT);
-       mfc_debug(2, "pixel format: %d, mem_type for 10bit: %d (reg: %#x)\n",
-                       pix_val, mem_type, reg);
+       mfc_debug(2, "pixel format: %d, mem_type_10bit for 10bit: %d (reg: %#x)\n",
+                       pix_val, mem_type_10bit, reg);
 }