[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4d2347e4-7732-1352-5009-791362596e0b@collabora.com>
Date: Mon, 16 Jan 2023 11:27:57 +0100
From: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
To: Sebastian Fricke <sebastian.fricke@...labora.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-rockchip@...ts.infradead.org, linux-staging@...ts.linux.dev,
Jonas Karlman <jonas@...boo.se>,
Alex Bee <knaerzche@...il.com>,
Nicolas Dufresne <nicolas.dufresne@...labora.com>,
Collabora Kernel-domain <kernel@...labora.com>,
Robert Beckett <bob.beckett@...labora.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Benjamin Gaignard <benjamin.gaignard@...labora.com>
Subject: Re: [PATCH v2 07/12] staging: media: rkvdec: Add a routine to fetch
SPS attributes as a callback
Hi Sebastian,
W dniu 12.01.2023 o 13:56, Sebastian Fricke pisze:
> Add a callback for each codec variant, that fetches basic information
> like resolution, bit-depth and sub-sampling from a SPS structure. This
> data is used to verify whether a new SPS structure is valid.
>
> Signed-off-by: Sebastian Fricke <sebastian.fricke@...labora.com>
> ---
> drivers/staging/media/rkvdec/rkvdec.c | 10 ++++++++++
> drivers/staging/media/rkvdec/rkvdec.h | 10 ++++++++++
> 2 files changed, 20 insertions(+)
>
> diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
> index a46f918926a2..e8c750a7343a 100644
> --- a/drivers/staging/media/rkvdec/rkvdec.c
> +++ b/drivers/staging/media/rkvdec/rkvdec.c
> @@ -52,6 +52,16 @@ static int rkvdec_get_valid_fmt(struct rkvdec_ctx *ctx)
> return ctx->coded_fmt_desc->decoded_fmts[0];
> }
>
> +static int rkvdec_get_sps_attributes(struct rkvdec_ctx *ctx, void *sps,
> + struct sps_attributes *attributes)
> +{
> + const struct rkvdec_coded_fmt_desc *coded_desc = ctx->coded_fmt_desc;
> +
> + if (coded_desc->ops->get_sps_attributes)
> + return coded_desc->ops->get_sps_attributes(ctx, sps, attributes);
> + return 0;
It seems that if there's no ->get_sps_attributes(), then even though
"attributes" won't be filled in, the result is a success (as suggested
by the returned 0). That's maybe confusing to potential users, especially,
if they don't e.g. memset the attributes struct to zero - the function will
report "success" but the struct will contain random data.
In PATCH 09/12 you call the implementation directly (not through the ops
struct), and there you actually ignore the return value.
Regards,
Andrzej
> +}
> +
> static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl)
> {
> struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl);
> diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h
> index e353a4403e5b..7b6702c360fd 100644
> --- a/drivers/staging/media/rkvdec/rkvdec.h
> +++ b/drivers/staging/media/rkvdec/rkvdec.h
> @@ -63,10 +63,20 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf)
> base.vb.vb2_buf);
> }
>
> +struct sps_attributes {
> + unsigned int width;
> + unsigned int height;
> + unsigned int luma_bitdepth;
> + unsigned int chroma_bitdepth;
> + unsigned int subsampling;
> +};
> +
> struct rkvdec_coded_fmt_ops {
> int (*adjust_fmt)(struct rkvdec_ctx *ctx,
> struct v4l2_format *f);
> u32 (*valid_fmt)(struct rkvdec_ctx *ctx);
> + int (*get_sps_attributes)(struct rkvdec_ctx *ctx, void *sps,
> + struct sps_attributes *attributes);
> int (*start)(struct rkvdec_ctx *ctx);
> void (*stop)(struct rkvdec_ctx *ctx);
> int (*run)(struct rkvdec_ctx *ctx);
>
Powered by blists - more mailing lists