[COMMON] media: smfc: do not chroma subsampling for thumbnail with HWFC
authorCho KyongHo <pullip.cho@samsung.com>
Wed, 15 Jul 2015 04:46:48 +0000 (13:46 +0900)
committerSeungchul Kim <sc377.kim@samsung.com>
Mon, 28 May 2018 05:31:07 +0000 (14:31 +0900)
If Hardware Flow Control is enabled, we have observed that the SMFC
asserts the invalid thumbnail encoding configuration interrupt if the
chroma subsampling factor of the thumbnail JPEG stream is different
from the one of the main JPEG stream.

Change-Id: Ia003859ab08c89f2df3867da36789be476a84b26
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
drivers/media/platform/exynos/smfc/smfc-regs.c
drivers/media/platform/exynos/smfc/smfc.c
drivers/media/platform/exynos/smfc/smfc.h

index 09fc5391e178f466a942afcadc9f36a7496f0c71..0f6b4e4291fb3b4743e97058422c0276bd3fec2c 100644 (file)
@@ -243,7 +243,7 @@ static u32 smfc_get_jpeg_format(unsigned int hfactor, unsigned int vfactor)
        return 2 << 24; /* default: YUV422 */
 }
 
-void smfc_hwconfigure_2nd_image(struct smfc_ctx *ctx)
+void smfc_hwconfigure_2nd_image(struct smfc_ctx *ctx, bool hwfc_enabled)
 {
        struct vb2_buffer *vb2buf_img, *vb2buf_jpg;
        u32 format;
@@ -264,11 +264,18 @@ void smfc_hwconfigure_2nd_image(struct smfc_ctx *ctx)
         */
        smfc_hwconfigure_jpeg_base(ctx, vb2buf_jpg, true);
 
+       format = ctx->img_fmt->regcfg;
        /*
         * Chroma subsampling is always 1/2 for both of horizontal and vertical
-        * directions to reduce the compressed size of the secondary image
+        * directions to reduce the compressed size of the secondary image.
+        * If HWFC is enabled, the chroma subsampling is not allowed.
         */
-       format = ctx->img_fmt->regcfg | smfc_get_jpeg_format(2, 2);
+       if (hwfc_enabled)
+               format |= smfc_get_jpeg_format(ctx->img_fmt->chroma_hfactor,
+                                               ctx->img_fmt->chroma_vfactor);
+       else
+               format |= smfc_get_jpeg_format(2, 2);
+
        __raw_writel(format, ctx->smfc->reg + REG_SEC_IMAGE_FORMAT);
 }
 
index ad97da788c1728911e5926c631e8fd7373b37f47..48faf1cb5ab2c5a9a4c1df0d9b0330728af3401e 100644 (file)
@@ -1191,7 +1191,7 @@ static void smfc_m2m_device_run(void *priv)
        if (!!(ctx->flags & SMFC_CTX_B2B_COMPRESS) &&
                        !!(ctx->flags & SMFC_CTX_COMPRESS)) {
                smfc_hwconfigure_2nd_tables(ctx, thumb_quality_factor);
-               smfc_hwconfigure_2nd_image(ctx);
+               smfc_hwconfigure_2nd_image(ctx, !!enable_hwfc);
        }
 
        spin_lock_irqsave(&ctx->smfc->flag_lock, flags);
index 46d34192c1e979948dfcc7b37d35b5f687297d9c..1494b3d0a31f180a03d9e5fa4db27be888cbfb5e 100644 (file)
@@ -116,7 +116,7 @@ void smfc_hwconfigure_image(struct smfc_ctx *ctx,
 void smfc_hwconfigure_start(struct smfc_ctx *ctx,
                            unsigned int rst_int, bool hwfc_en);
 void smfc_hwconfigure_2nd_tables(struct smfc_ctx *ctx, unsigned int qfactor);
-void smfc_hwconfigure_2nd_image(struct smfc_ctx *ctx);
+void smfc_hwconfigure_2nd_image(struct smfc_ctx *ctx, bool hwfc_enabled);
 bool smfc_hwstatus_okay(struct smfc_dev *smfc, struct smfc_ctx *ctx);
 void smfc_hwconfigure_reset(struct smfc_dev *smfc);
 void smfc_dump_registers(struct smfc_dev *smfc);