From: Cho KyongHo Date: Wed, 15 Jul 2015 04:46:48 +0000 (+0900) Subject: [COMMON] media: smfc: do not chroma subsampling for thumbnail with HWFC X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=07c63e98837c862917bb406439a0917c41442404;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] media: smfc: do not chroma subsampling for thumbnail with HWFC 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 --- diff --git a/drivers/media/platform/exynos/smfc/smfc-regs.c b/drivers/media/platform/exynos/smfc/smfc-regs.c index 09fc5391e178..0f6b4e4291fb 100644 --- a/drivers/media/platform/exynos/smfc/smfc-regs.c +++ b/drivers/media/platform/exynos/smfc/smfc-regs.c @@ -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); } diff --git a/drivers/media/platform/exynos/smfc/smfc.c b/drivers/media/platform/exynos/smfc/smfc.c index ad97da788c17..48faf1cb5ab2 100644 --- a/drivers/media/platform/exynos/smfc/smfc.c +++ b/drivers/media/platform/exynos/smfc/smfc.c @@ -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); diff --git a/drivers/media/platform/exynos/smfc/smfc.h b/drivers/media/platform/exynos/smfc/smfc.h index 46d34192c1e9..1494b3d0a31f 100644 --- a/drivers/media/platform/exynos/smfc/smfc.h +++ b/drivers/media/platform/exynos/smfc/smfc.h @@ -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);