linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: Philipp Zabel <p.zabel@pengutronix.de>, linux-media@vger.kernel.org
Cc: kernel@pengutronix.de
Subject: Re: [PATCH 13/13] media: coda: fix unset field and fail on invalid field in buf_prepare
Date: Thu, 25 Apr 2019 15:55:05 -0300	[thread overview]
Message-ID: <cc6c0b45e42d4d5ec2ebb8c656b9434dd6a7b484.camel@collabora.com> (raw)
In-Reply-To: <20190412155135.13907-13-p.zabel@pengutronix.de>

On Fri, 2019-04-12 at 17:51 +0200, Philipp Zabel wrote:
> v4l2-compliance likes to queue a buffer with field set to V4L2_FIELD_ANY
> and expects it to be returned corrected to a valid field.
> 
> Follow vicodec in handling this in the buf_prepare callback.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/media/platform/coda/coda-common.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
> index 1cd0fb5b1c5b..1d8e0a045df1 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -1515,10 +1515,20 @@ static int coda_queue_setup(struct vb2_queue *vq,
>  
>  static int coda_buf_prepare(struct vb2_buffer *vb)
>  {
> +	struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
>  	struct coda_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
>  	struct coda_q_data *q_data;
>  
>  	q_data = get_q_data(ctx, vb->vb2_queue->type);
> +	if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) {
> +		if (vbuf->field == V4L2_FIELD_ANY)
> +			vbuf->field = V4L2_FIELD_NONE;
> +		if (vbuf->field != V4L2_FIELD_NONE) {
> +			v4l2_warn(&ctx->dev->v4l2_dev,
> +				  "%s field isn't supported\n", __func__);
> +			return -EINVAL;
> +		}
> +	}
>  
>  	if (vb2_plane_size(vb, 0) < q_data->sizeimage) {
>  		v4l2_warn(&ctx->dev->v4l2_dev,

I believe instead of this, you can just populate your buf_out_validate
like this:

static int coda_buf_out_validate(struct vb2_buffer *vb)
{
        struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);

        vbuf->field = V4L2_FIELD_NONE;
        return 0;
}

Thanks,
Eze


      reply	other threads:[~2019-04-25 18:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 15:51 [PATCH 01/13] media: coda: move register debugging to coda_debug level 3 Philipp Zabel
2019-04-12 15:51 ` [PATCH 02/13] media: coda: move job ready message to coda_debug level 2 Philipp Zabel
2019-04-12 15:51 ` [PATCH 03/13] media: coda: add coda_frame_type_char helper Philipp Zabel
2019-04-12 15:51 ` [PATCH 04/13] media: coda: improve decoder job finished debug message Philipp Zabel
2019-04-12 15:51 ` [PATCH 05/13] media: coda: demote s_ctrl debug messages to level 2 Philipp Zabel
2019-04-12 15:51 ` [PATCH 06/13] media: coda: add menu strings to s_ctrl debug output Philipp Zabel
2019-04-12 15:51 ` [PATCH 07/13] media: coda: update profile and level controls after sequence initialization Philipp Zabel
2019-04-12 15:51 ` [PATCH 08/13] media: coda: add decoder MPEG-4 profile and level controls Philipp Zabel
2019-05-21 11:29   ` Mauro Carvalho Chehab
2019-05-22  9:09     ` [PATCH v2] " Philipp Zabel
2019-05-27 12:19       ` [PATCH v3] " Philipp Zabel
2019-04-12 15:51 ` [PATCH 09/13] media: v4l2-ctrl: add MPEG-2 " Philipp Zabel
2019-04-24  9:29   ` Hans Verkuil
2019-04-24 10:43   ` [PATCH v2] " Philipp Zabel
2019-04-12 15:51 ` [PATCH 10/13] media: coda: add decoder " Philipp Zabel
2019-05-27 12:20   ` [PATCH v2] " Philipp Zabel
2019-04-12 15:51 ` [PATCH 11/13] media: coda: add lockdep asserts Philipp Zabel
2019-04-12 15:51 ` [PATCH 12/13] media: coda: use v4l2_m2m_buf_copy_metadata Philipp Zabel
2019-04-12 15:51 ` [PATCH 13/13] media: coda: fix unset field and fail on invalid field in buf_prepare Philipp Zabel
2019-04-25 18:55   ` Ezequiel Garcia [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=cc6c0b45e42d4d5ec2ebb8c656b9434dd6a7b484.camel@collabora.com \
    --to=ezequiel@collabora.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-media@vger.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;
as well as URLs for NNTP newsgroup(s).