public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Punit Agrawal <punitagrawal@gmail.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-media@vger.kernel.org,
	Andrej Picej <andrej.picej@norik.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: Re: [PATCH] media: coda: fix frame_mem_ctrl for YUV420 and YVU420 formats
Date: Wed, 04 Aug 2021 15:04:53 +0900	[thread overview]
Message-ID: <87lf5hsq2i.fsf@stealth> (raw)
In-Reply-To: <20210719145708.10643-1-p.zabel@pengutronix.de> (Philipp Zabel's message of "Mon, 19 Jul 2021 16:57:08 +0200")

Hi Philipp,

Philipp Zabel <p.zabel@pengutronix.de> writes:

> The frame memory control register value is currently determined
> before userspace selects the final capture format and never corrected.
> Update ctx->frame_mem_ctrl in __coda_start_decoding() to fix decoding
> into YUV420 or YVU420 capture buffers.
>
> Reported-by: Andrej Picej <andrej.picej@norik.com>
> Fixes: 497e6b8559a6 ("media: coda: add sequence initialization work")
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

Thank you for the patch.

The patch fixes a failure (green screen) to display videos when using
I420 and YV12 with gstreamer.

Tested-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>

Considering it's a bug fix, any chance this can be picked up for 5.14?
It'll help land it to stable kernels which are being used on i.MX6 based
platforms internally.

Thanks,
Punit

> ---
>  drivers/media/platform/coda/coda-bit.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
> index 2f42808c43a4..c484c008ab02 100644
> --- a/drivers/media/platform/coda/coda-bit.c
> +++ b/drivers/media/platform/coda/coda-bit.c
> @@ -2053,17 +2053,25 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
>  	u32 src_fourcc, dst_fourcc;
>  	int ret;
>  
> +	q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
> +	q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
> +	src_fourcc = q_data_src->fourcc;
> +	dst_fourcc = q_data_dst->fourcc;
> +
>  	if (!ctx->initialized) {
>  		ret = __coda_decoder_seq_init(ctx);
>  		if (ret < 0)
>  			return ret;
> +	} else {
> +		ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) |
> +					 CODA9_FRAME_TILED2LINEAR);
> +		if (dst_fourcc == V4L2_PIX_FMT_NV12 || dst_fourcc == V4L2_PIX_FMT_YUYV)
> +			ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE;
> +		if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP)
> +			ctx->frame_mem_ctrl |= (0x3 << 9) |
> +				((ctx->use_vdoa) ? 0 : CODA9_FRAME_TILED2LINEAR);
>  	}
>  
> -	q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
> -	q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
> -	src_fourcc = q_data_src->fourcc;
> -	dst_fourcc = q_data_dst->fourcc;
> -
>  	coda_write(dev, ctx->parabuf.paddr, CODA_REG_BIT_PARA_BUF_ADDR);
>  
>  	ret = coda_alloc_framebuffers(ctx, q_data_dst, src_fourcc);

      reply	other threads:[~2021-08-04  6:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 14:57 [PATCH] media: coda: fix frame_mem_ctrl for YUV420 and YVU420 formats Philipp Zabel
2021-08-04  6:04 ` Punit Agrawal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf5hsq2i.fsf@stealth \
    --to=punitagrawal@gmail.com \
    --cc=andrej.picej@norik.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox