lkml.org 
[lkml]   [2020]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] media: cedrus: Propagate OUTPUT resolution to CAPTURE
From
Date
On 14/05/2020 17:39, Nicolas Dufresne wrote:
> As per spec, the CAPTURE resolution should be automatically set based on
> the OTUPUT resolution. This patch properly propagate width/height to the
> capture when the OUTPUT format is set and override the user provided
> width/height with configured OUTPUT resolution when the CAPTURE fmt is
> updated.
>
> This also prevents userspace from selecting a CAPTURE resolution that is
> too small, avoiding unwanted page faults.
>
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> drivers/staging/media/sunxi/cedrus/cedrus_video.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> index 16d82309e7b6..a6d6b15adc2e 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
> @@ -247,6 +247,8 @@ static int cedrus_try_fmt_vid_cap(struct file *file, void *priv,
> return -EINVAL;
>
> pix_fmt->pixelformat = fmt->pixelformat;
> + pix_fmt->width = ctx->src_fmt.width;
> + pix_fmt->height = ctx->src_fmt.height;
> cedrus_prepare_format(pix_fmt);
>
> return 0;
> @@ -319,11 +321,14 @@ static int cedrus_s_fmt_vid_out(struct file *file, void *priv,
> break;
> }
>
> - /* Propagate colorspace information to capture. */
> + /* Propagate format information to capture. */
> ctx->dst_fmt.colorspace = f->fmt.pix.colorspace;
> ctx->dst_fmt.xfer_func = f->fmt.pix.xfer_func;
> ctx->dst_fmt.ycbcr_enc = f->fmt.pix.ycbcr_enc;
> ctx->dst_fmt.quantization = f->fmt.pix.quantization;
> + ctx->dst_fmt.width = ctx->src_fmt.width;
> + ctx->dst_fmt.height = ctx->src_fmt.height;

You can only do this if the capture queue isn't busy.

See also hantro_reset_raw_fmt() where it does that check.

So this needs a v2.

Regards,

Hans

> + cedrus_prepare_format(&ctx->dst_fmt);
>
> return 0;
> }
>

\
 
 \ /
  Last update: 2020-09-17 12:40    [W:0.073 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site