linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Dafna Hirschfeld <dafna3@gmail.com>, linux-media@vger.kernel.org
Cc: helen.koike@collabora.com
Subject: Re: [PATCH v3 6/6] media: vicodec: Add support for resolution change event.
Date: Fri, 18 Jan 2019 09:54:58 +0100	[thread overview]
Message-ID: <216cbb31-874e-1cfe-f971-da4650e2ca80@xs4all.nl> (raw)
In-Reply-To: <20190117182319.118359-7-dafna3@gmail.com>

On 1/17/19 7:23 PM, Dafna Hirschfeld wrote:
> If the the queues are not streaming then the first resolution
> change is handled in the buf_queue callback.
> The following resolution change events are handled in job_ready.
> 
> Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
> ---
>  drivers/media/platform/vicodec/vicodec-core.c | 355 ++++++++++++++----
>  1 file changed, 290 insertions(+), 65 deletions(-)
> 
> diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c
> index 2a95eca3cae6..6430c18b8f94 100644
> --- a/drivers/media/platform/vicodec/vicodec-core.c
> +++ b/drivers/media/platform/vicodec/vicodec-core.c
> @@ -129,6 +129,8 @@ struct vicodec_ctx {
>  	u32			comp_frame_size;
>  	bool			comp_has_frame;
>  	bool			comp_has_next_frame;
> +	bool			first_source_change_sent;
> +	bool			source_changed;
>  };
>  
>  static inline struct vicodec_ctx *file2ctx(struct file *file)
> @@ -322,6 +324,95 @@ static void job_remove_src_buf(struct vicodec_ctx *ctx, u32 state)
>  	spin_unlock(ctx->lock);
>  }
>  
> +static const struct v4l2_fwht_pixfmt_info *info_from_header(struct fwht_cframe_hdr p_hdr)

Don't copy the struct, just use const struct fwht_cframe_hdr *p_hdr.

> +{
> +	unsigned int flags = ntohl(p_hdr.flags);
> +	unsigned int width_div = (flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
> +	unsigned int height_div = (flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
> +	unsigned int components_num = 3;
> +	unsigned int pixenc = 0;
> +	unsigned int version = ntohl(p_hdr.version);
> +
> +	if (version == FWHT_VERSION) {
> +		components_num = 1 + ((flags & FWHT_FL_COMPONENTS_NUM_MSK) >>
> +				FWHT_FL_COMPONENTS_NUM_OFFSET);
> +		pixenc = (flags & FWHT_FL_PIXENC_MSK);
> +	}
> +	return v4l2_fwht_default_fmt(width_div, height_div,
> +				     components_num, pixenc, 0);
> +}
> +
> +static bool is_header_valid(struct fwht_cframe_hdr p_hdr)

Ditto.

> +{
> +	const struct v4l2_fwht_pixfmt_info *info;
> +	unsigned int w = ntohl(p_hdr.width);
> +	unsigned int h = ntohl(p_hdr.height);
> +	unsigned int version = ntohl(p_hdr.version);
> +	unsigned int flags = ntohl(p_hdr.flags);
> +
> +	if (!version || version > FWHT_VERSION)
> +		return false;
> +
> +	if (w < MIN_WIDTH || w > MAX_WIDTH || h < MIN_HEIGHT || h > MAX_HEIGHT)
> +		return false;
> +
> +	if (version == FWHT_VERSION) {
> +		unsigned int components_num = 1 +
> +			((flags & FWHT_FL_COMPONENTS_NUM_MSK) >>
> +			FWHT_FL_COMPONENTS_NUM_OFFSET);
> +		unsigned int pixenc = flags & FWHT_FL_PIXENC_MSK;
> +
> +		if (components_num == 0 || components_num > 4 || !pixenc)
> +			return false;
> +	}
> +
> +	info = info_from_header(p_hdr);
> +	if (!info)
> +		return false;
> +	return true;
> +}

Regards,

	Hans

      reply	other threads:[~2019-01-18  8:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 18:23 [PATCH v3 0/6] add support for resolution change event Dafna Hirschfeld
2019-01-17 18:23 ` [PATCH v3 1/6] media: vicodec: bugfix - replace '=' with '|=' Dafna Hirschfeld
2019-01-17 18:23 ` [PATCH v3 2/6] media: vicodec: Add num_planes field to v4l2_fwht_pixfmt_info Dafna Hirschfeld
2019-01-17 18:23 ` [PATCH v3 3/6] media: vicodec: add support for CROP and COMPOSE selection Dafna Hirschfeld
2019-01-17 18:23 ` [PATCH v3 4/6] media: vicodec: Add pixel encoding flags to fwht header Dafna Hirschfeld
2019-01-18  8:46   ` Hans Verkuil
2019-01-17 18:23 ` [PATCH v3 5/6] media: vicodec: Separate fwht header from the frame data Dafna Hirschfeld
2019-01-17 18:23 ` [PATCH v3 6/6] media: vicodec: Add support for resolution change event Dafna Hirschfeld
2019-01-18  8:54   ` Hans Verkuil [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=216cbb31-874e-1cfe-f971-da4650e2ca80@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=dafna3@gmail.com \
    --cc=helen.koike@collabora.com \
    --cc=linux-media@vger.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).