All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: Helge Deller <deller@gmx.de>,
	Michael Schmitz <schmitzmic@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH/RFC 1/3] video: fbdev: c2p: Add transp2() and transp2x()
Date: Fri, 25 Nov 2022 21:31:08 +0100	[thread overview]
Message-ID: <7161013a238b616d18c79a1c9aa57655135ded04.1669406382.git.geert@linux-m68k.org> (raw)
In-Reply-To: <cover.1669406380.git.geert@linux-m68k.org>

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@linux-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


WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: Michael Schmitz <schmitzmic@gmail.com>,
	linux-m68k@vger.kernel.org, Helge Deller <deller@gmx.de>,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH/RFC 1/3] video: fbdev: c2p: Add transp2() and transp2x()
Date: Fri, 25 Nov 2022 21:31:08 +0100	[thread overview]
Message-ID: <7161013a238b616d18c79a1c9aa57655135ded04.1669406382.git.geert@linux-m68k.org> (raw)
In-Reply-To: <cover.1669406380.git.geert@linux-m68k.org>

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@linux-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


  reply	other threads:[~2022-11-25 20:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 20:31 [PATCH/RFC 0/3] Atari DRM driver Geert Uytterhoeven
2022-11-25 20:31 ` Geert Uytterhoeven
2022-11-25 20:31 ` Geert Uytterhoeven [this message]
2022-11-25 20:31   ` [PATCH/RFC 1/3] video: fbdev: c2p: Add transp2() and transp2x() Geert Uytterhoeven
2022-11-25 20:31 ` [PATCH/RFC 2/3] drm/simple-kms-helper: Add mode_fixup() to simple display pipe Geert Uytterhoeven
2022-11-25 20:31   ` Geert Uytterhoeven
2022-11-28  8:21   ` Maxime Ripard
2022-11-28  8:21     ` Maxime Ripard
2022-11-25 20:31 ` [PATCH/RFC 3/3] drm: atari: Add a DRM driver for Atari graphics hardware Geert Uytterhoeven
2022-11-25 20:31   ` Geert Uytterhoeven
2022-11-26 14:51   ` Thomas Zimmermann
2022-11-28 13:08     ` Geert Uytterhoeven
2022-11-28 13:08       ` Geert Uytterhoeven
2022-11-28  8:28   ` Maxime Ripard
2022-11-28  8:28     ` Maxime Ripard
2023-01-23 15:03 ` [PATCH/RFC 0/3] Atari DRM driver John Paul Adrian Glaubitz
2023-01-23 15:03   ` John Paul Adrian Glaubitz
2023-01-23 15:10   ` Geert Uytterhoeven
2023-01-23 15:10     ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7161013a238b616d18c79a1c9aa57655135ded04.1669406382.git.geert@linux-m68k.org \
    --to=geert@linux-m68k.org \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=schmitzmic@gmail.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.