[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230101-patch-series-v2-6-2-rc1-v2-7-fa1897efac14@collabora.com>
Date: Thu, 12 Jan 2023 13:56:22 +0100
From: Sebastian Fricke <sebastian.fricke@...labora.com>
To: 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>,
Andrzej Pietrasiewicz <andrzej.p@...labora.com>,
Benjamin Gaignard <benjamin.gaignard@...labora.com>,
Sebastian Fricke <sebastian.fricke@...labora.com>
Subject: [PATCH v2 07/12] staging: media: rkvdec: Add a routine to fetch SPS
attributes as a callback
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;
+}
+
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);
--
2.25.1
Powered by blists - more mailing lists