All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: dri-devel@lists.freedesktop.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH libdrm v2 05/10] modetest: Fix printing of big-endian fourcc values
Date: Fri,  8 Jul 2022 20:21:44 +0200	[thread overview]
Message-ID: <0cd09c0b07e14a7e594bd86eaacbbeadb6c8f198.1657302103.git.geert@linux-m68k.org> (raw)
In-Reply-To: <cover.1657302103.git.geert@linux-m68k.org>

Big-endian fourcc values have the MSB set, as that is the
DRM_FORMAT_BIG_ENDIAN flag.  Hence printing the last byte unmodified
leads to weird characters.

Fix this by stripping the DRM_FORMAT_BIG_ENDIAN flag, and appending "be"
for big-endian formats.

Sample impact:

     Planes:
     id     crtc    fb      CRTC x,y        x,y     gamma size      possible crtcs
     32     34      36      0,0             0,0     0               0x00000001
    -  formats: C1   C2   C4   C8   RG16 RG1� XR24
    +  formats: C1   C2   C4   C8   RG16 RG16be XR24
       props:
            8 type:
                    flags: immutable enum
                    enums: Overlay=0 Primary=1 Cursor=2
                    value: 1
            30 IN_FORMATS:
                    flags: immutable blob
                    blobs:

                    value:
                            00000001000000000000000700000018
                            00000001000000382020314320203243
                            202034432020384336314752b6314752
                            3432525800000000000000000000007f
                            00000000000000000000000000000000
                    in_formats blob decoded:
                             C1  :  LINEAR
                             C2  :  LINEAR
                             C4  :  LINEAR
                             C8  :  LINEAR
                             RG16:  LINEAR
    -                        RG1�:  LINEAR
    +                        RG16be:  LINEAR
                             XR24:  LINEAR

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
v2:
  - New.
---
 tests/modetest/modetest.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 1d87046f0fdfaf24..f70043d1e6815497 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -198,11 +198,15 @@ static bit_name_fn(mode_flag)
 
 static void dump_fourcc(uint32_t fourcc)
 {
-	printf(" %c%c%c%c",
+	bool be = fourcc & DRM_FORMAT_BIG_ENDIAN;
+
+	fourcc &= ~DRM_FORMAT_BIG_ENDIAN;
+	printf(" %c%c%c%c%s",
 		fourcc,
 		fourcc >> 8,
 		fourcc >> 16,
-		fourcc >> 24);
+		fourcc >> 24,
+		be ? "be" : "");
 }
 
 static void dump_encoders(struct device *dev)
-- 
2.25.1


  parent reply	other threads:[~2022-07-08 18:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 18:21 [PATCH libdrm v2 00/10] Big-endian fixes Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH libdrm v2 01/10] intel: Improve checks for big-endian Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH libdrm v2 02/10] util: Fix 32 bpp patterns on big-endian Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH libdrm v2 03/10] util: Fix 16 " Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH libdrm v2 04/10] util: Add missing big-endian RGB16 frame buffer formats Geert Uytterhoeven
2022-07-11 12:17   ` Ville Syrjälä
2022-07-11 12:34     ` Geert Uytterhoeven
2022-07-12 10:20       ` Michel Dänzer
2023-07-05 16:08       ` Geert Uytterhoeven
2022-07-08 18:21 ` Geert Uytterhoeven [this message]
2022-07-08 18:21 ` [PATCH libdrm v2 06/10] modetest: Add support for parsing big-endian formats Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH libdrm v2 07/10] util: Add test pattern support for big-endian XRGB1555/RGB565 Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH libdrm v2 08/10] util: Fix pwetty on big-endian Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH libdrm v2 09/10] util: Add pwetty support for big-endian RGB565 Geert Uytterhoeven
2022-07-08 18:21 ` [PATCH libdrm v2 10/10] modetest: Add support for big-endian XRGB1555/RGB565 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=0cd09c0b07e14a7e594bd86eaacbbeadb6c8f198.1657302103.git.geert@linux-m68k.org \
    --to=geert@linux-m68k.org \
    --cc=dri-devel@lists.freedesktop.org \
    /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.