linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "mirela.rabulea@oss.nxp.com" <mirela.rabulea@oss.nxp.com>
To: Ming Qian <ming.qian@nxp.com>,
	mchehab@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de
Cc: hverkuil-cisco@xs4all.nl, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 3/5] media: imx-jpeg: Propagate the output frame size to the capture side
Date: Mon, 11 Apr 2022 14:50:13 +0300	[thread overview]
Message-ID: <76cc3643-db74-607a-a6b9-c5e0d10081e3@oss.nxp.com> (raw)
In-Reply-To: <473edd5666b24a659f651ca003add12ac9a0c2d2.1648023273.git.ming.qian@nxp.com>

Hi Ming,

On 23.03.2022 11:05, Ming Qian wrote:
> The GStreamer v4l2videodec only ever calls S_FMT on the output side
> and then expects G_FMT on the capture side to return a valid format.
> 
> Signed-off-by: Ming Qian <ming.qian@nxp.com>
> ---
>   .../media/platform/nxp/imx-jpeg/mxc-jpeg.c    | 30 ++++++++++++++++++-
>   1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> index a95305639dd9..5dfa6f87871e 100644
> --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> @@ -1831,12 +1831,40 @@ static int mxc_jpeg_s_fmt_vid_out(struct file *file, void *priv,
>   				  struct v4l2_format *f)
>   {
>   	int ret;
> +	struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
> +	struct vb2_queue *dst_vq;
> +	struct mxc_jpeg_q_data *q_data_cap;
> +	enum v4l2_buf_type cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
> +	struct v4l2_format fc;
>   
>   	ret = mxc_jpeg_try_fmt_vid_out(file, priv, f);
>   	if (ret)
>   		return ret;
>   
> -	return mxc_jpeg_s_fmt(mxc_jpeg_fh_to_ctx(priv), f);
> +	ret = mxc_jpeg_s_fmt(mxc_jpeg_fh_to_ctx(priv), f);
> +	if (ret)
> +		return ret;
> +
> +	if (ctx->mxc_jpeg->mode != MXC_JPEG_DECODE)
> +		return 0;
> +
> +	dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, cap_type);
> +	if (!dst_vq)
> +		return -EINVAL;
> +
> +	if (vb2_is_busy(dst_vq))
> +		return 0;
> +
> +	q_data_cap = mxc_jpeg_get_q_data(ctx, cap_type);
> +	if (q_data_cap->w == f->fmt.pix_mp.width && q_data_cap->h == f->fmt.pix_mp.height)
> +		return 0;

Is this an optimization, to avoid propagating the format to the capture 
queue, if it is already set? If so, shouldn't fourcc also be part of the 
comparison?

Thanks,
Mirela

> +	memset(&fc, 0, sizeof(fc));
> +	fc.type = cap_type;
> +	fc.fmt.pix_mp.pixelformat = q_data_cap->fmt->fourcc;
> +	fc.fmt.pix_mp.width = f->fmt.pix_mp.width;
> +	fc.fmt.pix_mp.height = f->fmt.pix_mp.height;
> +
> +	return mxc_jpeg_s_fmt_vid_cap(file, priv, &fc);
>   }
>   
>   static int mxc_jpeg_g_fmt_vid(struct file *file, void *priv,

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-04-11 12:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23  9:05 [PATCH v3 0/5] imx-jpeg: Support dynamic resolution change Ming Qian
2022-03-23  9:05 ` [PATCH v3 1/5] media: imx-jpeg: Refactor function mxc_jpeg_parse Ming Qian
2022-03-23  9:05 ` [PATCH v3 2/5] media: imx-jpeg: Identify and handle precision correctly Ming Qian
2022-03-23  9:05 ` [PATCH v3 3/5] media: imx-jpeg: Propagate the output frame size to the capture side Ming Qian
2022-04-11 11:50   ` mirela.rabulea [this message]
2022-04-12  2:11     ` Ming Qian
2022-03-23  9:05 ` [PATCH v3 4/5] media: imx-jpeg: Handle source change in a function Ming Qian
2022-03-23  9:05 ` [PATCH v3 5/5] media: imx-jpeg: Support dynamic resolution change Ming Qian
2022-04-27  7:03   ` Hans Verkuil
2022-04-12  9:46 ` [PATCH v3 0/5] " mirela.rabulea

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=76cc3643-db74-607a-a6b9-c5e0d10081e3@oss.nxp.com \
    --to=mirela.rabulea@oss.nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).