[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7161013a238b616d18c79a1c9aa57655135ded04.1669406382.git.geert@linux-m68k.org>
Date: Fri, 25 Nov 2022 21:31:08 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>
Cc: Helge Deller <deller@....de>,
Michael Schmitz <schmitzmic@...il.com>,
dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
linux-m68k@...r.kernel.org, linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: [PATCH/RFC 1/3] video: fbdev: c2p: Add transp2() and transp2x()
Add transpose operations on two 32-bit words, using normal or reverse
order.
To be used by the Atari DRM driver.
Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
---
drivers/video/fbdev/c2p_core.h | 38 ++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/drivers/video/fbdev/c2p_core.h b/drivers/video/fbdev/c2p_core.h
index cf5f1ebce65e6afd..480bd80fb31b57c0 100644
--- a/drivers/video/fbdev/c2p_core.h
+++ b/drivers/video/fbdev/c2p_core.h
@@ -142,6 +142,44 @@ static __always_inline void transp4x(u32 d[], unsigned int n, unsigned int m)
}
+ /*
+ * Transpose operations on 2 32-bit words
+ */
+
+static __always_inline void transp2(u32 d[], unsigned int n, unsigned int m)
+{
+ u32 mask = get_mask(n);
+
+ switch (m) {
+ case 1:
+ /* Single n x 1 block */
+ _transp(d, 0, 1, n, mask);
+ return;
+ }
+
+ BUILD_BUG();
+}
+
+
+ /*
+ * Transpose operations on 2 32-bit words (reverse order)
+ */
+
+static __always_inline void transp2x(u32 d[], unsigned int n, unsigned int m)
+{
+ u32 mask = get_mask(n);
+
+ switch (m) {
+ case 1:
+ /* Single n x 1 block */
+ _transp(d, 1, 0, n, mask);
+ return;
+ }
+
+ BUILD_BUG();
+}
+
+
/*
* Compose two values, using a bitmask as decision value
* This is equivalent to (a & mask) | (b & ~mask)
--
2.25.1
Powered by blists - more mailing lists