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: <20240731164422.206503-2-linkmauve@linkmauve.fr>
Date: Wed, 31 Jul 2024 18:44:11 +0200
From: Emmanuel Gil Peyrot <linkmauve@...kmauve.fr>
To: linux-sunxi@...ts.linux.dev
Cc: Jernej Skrabec <jernej.skrabec@...il.com>,
	Maxime Ripard <mripard@...nel.org>,
	Paul Kocialkowski <paul.kocialkowski@...tlin.com>,
	Mauro Carvalho Chehab <mchehab@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Chen-Yu Tsai <wens@...e.org>,
	Samuel Holland <samuel@...lland.org>,
	linux-kernel@...r.kernel.org,
	linux-media@...r.kernel.org,
	linux-staging@...ts.linux.dev,
	linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 1/4] media: cedrus: Setup secondary output formats

From: Jernej Skrabec <jernej.skrabec@...il.com>

It's needed for JPEG codec, since engine outputs to it for some reason.

Signed-off-by: Jernej Skrabec <jernej.skrabec@...il.com>
---
 drivers/staging/media/sunxi/cedrus/cedrus_hw.c   | 12 +++++++++---
 drivers/staging/media/sunxi/cedrus/cedrus_regs.h |  9 +++++++--
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
index 32af0e96e762..582b6cb796ea 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
@@ -88,15 +88,21 @@ void cedrus_dst_format_set(struct cedrus_dev *dev,
 	case V4L2_PIX_FMT_NV12:
 		chroma_size = ALIGN(width, 16) * ALIGN(height, 16) / 2;
 
-		reg = VE_PRIMARY_OUT_FMT_NV12;
+		reg = VE_PRIMARY_OUT_FMT_NV12 | VE_SECONDARY_OUT_FMT_EXT_NV12;
 		cedrus_write(dev, VE_PRIMARY_OUT_FMT, reg);
 
 		reg = chroma_size / 2;
 		cedrus_write(dev, VE_PRIMARY_CHROMA_BUF_LEN, reg);
 
-		reg = VE_PRIMARY_FB_LINE_STRIDE_LUMA(ALIGN(width, 16)) |
-		      VE_PRIMARY_FB_LINE_STRIDE_CHROMA(ALIGN(width, 16) / 2);
+		reg = VE_CHROMA_BUF_LEN_SDRT(chroma_size / 2) |
+		      VE_CHROMA_WIDTH_ALIGN_8 |
+		      VE_SECONDARY_OUT_FMT_EXT;
+		cedrus_write(dev, VE_CHROMA_BUF_LEN, reg);
+
+		reg = VE_FB_LINE_STRIDE_LUMA(ALIGN(width, 16)) |
+		      VE_FB_LINE_STRIDE_CHROMA(ALIGN(width, 16) / 2);
 		cedrus_write(dev, VE_PRIMARY_FB_LINE_STRIDE, reg);
+		cedrus_write(dev, VE_SECONDARY_FB_LINE_STRIDE, reg);
 
 		break;
 	case V4L2_PIX_FMT_NV12_32L32:
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
index 05e6cbc548ab..3acc05e0fb54 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
@@ -59,9 +59,10 @@
 #define VE_INTRAPRED_DRAM_BUF_ADDR		0x58
 #define VE_PRIMARY_CHROMA_BUF_LEN		0xc4
 #define VE_PRIMARY_FB_LINE_STRIDE		0xc8
+#define VE_SECONDARY_FB_LINE_STRIDE		0xcc
 
-#define VE_PRIMARY_FB_LINE_STRIDE_CHROMA(s)	SHIFT_AND_MASK_BITS(s, 31, 16)
-#define VE_PRIMARY_FB_LINE_STRIDE_LUMA(s)	SHIFT_AND_MASK_BITS(s, 15, 0)
+#define VE_FB_LINE_STRIDE_CHROMA(s)		SHIFT_AND_MASK_BITS(s, 31, 16)
+#define VE_FB_LINE_STRIDE_LUMA(s)		SHIFT_AND_MASK_BITS(s, 15, 0)
 
 #define VE_CHROMA_BUF_LEN			0xe8
 
@@ -69,6 +70,10 @@
 #define VE_SECONDARY_OUT_FMT_EXT		(0x01 << 30)
 #define VE_SECONDARY_OUT_FMT_YU12		(0x02 << 30)
 #define VE_SECONDARY_OUT_FMT_YV12		(0x03 << 30)
+#define VE_CHROMA_WIDTH_ALIGN_16		(0x00 << 29)
+#define VE_CHROMA_WIDTH_ALIGN_8			(0x01 << 29)
+#define VE_LUMA_WIDTH_ALIGN_16			(0x00 << 28)
+#define VE_LUMA_WIDTH_ALIGN_32			(0x01 << 28)
 #define VE_CHROMA_BUF_LEN_SDRT(l)		SHIFT_AND_MASK_BITS(l, 27, 0)
 
 #define VE_PRIMARY_OUT_FMT			0xec
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ