lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240722150523.149667-3-benjamin.gaignard@collabora.com>
Date: Mon, 22 Jul 2024 17:05:22 +0200
From: Benjamin Gaignard <benjamin.gaignard@...labora.com>
To: mchehab@...nel.org,
	ezequiel@...guardiasur.com.ar,
	hverkuil-cisco@...all.nl
Cc: linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-rockchip@...ts.infradead.org,
	kernel@...labora.com,
	Benjamin Gaignard <benjamin.gaignard@...labora.com>
Subject: [PATCH v5 2/3] media: test-drivers: Use V4L2_FMT_FLAG_ENUM_ALL flag

Since V4L2_FMT_FLAG_ENUM_ALL flag mostly targeting stateless
decoder pixel formats enumeration, update vicodec visl test
drivers to use it.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...labora.com>
---
 drivers/media/test-drivers/vicodec/vicodec-core.c |  7 ++++---
 drivers/media/test-drivers/visl/visl-video.c      | 11 +++++++----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c
index 3e011fe62ae1..1b4cd8ddd7c2 100644
--- a/drivers/media/test-drivers/vicodec/vicodec-core.c
+++ b/drivers/media/test-drivers/vicodec/vicodec-core.c
@@ -706,6 +706,7 @@ static int enum_fmt(struct v4l2_fmtdesc *f, struct vicodec_ctx *ctx,
 		    bool is_out)
 {
 	bool is_uncomp = (ctx->is_enc && is_out) || (!ctx->is_enc && !is_out);
+	u32 index = f->index & ~V4L2_FMT_FLAG_ENUM_ALL;
 
 	if (V4L2_TYPE_IS_MULTIPLANAR(f->type) && !multiplanar)
 		return -EINVAL;
@@ -718,18 +719,18 @@ static int enum_fmt(struct v4l2_fmtdesc *f, struct vicodec_ctx *ctx,
 
 		if (ctx->is_enc ||
 		    !vb2_is_streaming(&ctx->fh.m2m_ctx->cap_q_ctx.q))
-			info = v4l2_fwht_get_pixfmt(f->index);
+			info = v4l2_fwht_get_pixfmt(index);
 		else
 			info = v4l2_fwht_find_nth_fmt(info->width_div,
 						     info->height_div,
 						     info->components_num,
 						     info->pixenc,
-						     f->index);
+						     index);
 		if (!info)
 			return -EINVAL;
 		f->pixelformat = info->id;
 	} else {
-		if (f->index)
+		if (index)
 			return -EINVAL;
 		f->pixelformat = ctx->is_stateless ?
 			V4L2_PIX_FMT_FWHT_STATELESS : V4L2_PIX_FMT_FWHT;
diff --git a/drivers/media/test-drivers/visl/visl-video.c b/drivers/media/test-drivers/visl/visl-video.c
index f8d970319764..c5f3e13b4198 100644
--- a/drivers/media/test-drivers/visl/visl-video.c
+++ b/drivers/media/test-drivers/visl/visl-video.c
@@ -341,21 +341,24 @@ static int visl_enum_fmt_vid_cap(struct file *file, void *priv,
 				 struct v4l2_fmtdesc *f)
 {
 	struct visl_ctx *ctx = visl_file_to_ctx(file);
+	u32 index = f->index & ~V4L2_FMT_FLAG_ENUM_ALL;
 
-	if (f->index >= ctx->coded_format_desc->num_decoded_fmts)
+	if (index >= ctx->coded_format_desc->num_decoded_fmts)
 		return -EINVAL;
 
-	f->pixelformat = ctx->coded_format_desc->decoded_fmts[f->index];
+	f->pixelformat = ctx->coded_format_desc->decoded_fmts[index];
 	return 0;
 }
 
 static int visl_enum_fmt_vid_out(struct file *file, void *priv,
 				 struct v4l2_fmtdesc *f)
 {
-	if (f->index >= ARRAY_SIZE(visl_coded_fmts))
+	u32 index = f->index & ~V4L2_FMT_FLAG_ENUM_ALL;
+
+	if (index >= ARRAY_SIZE(visl_coded_fmts))
 		return -EINVAL;
 
-	f->pixelformat = visl_coded_fmts[f->index].pixelformat;
+	f->pixelformat = visl_coded_fmts[index].pixelformat;
 	return 0;
 }
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ