summaryrefslogblamecommitdiff
path: root/user/mesa-amber/big-endian-flipping.patch
blob: 154a83108d7c8caa5c656682bdbcb571ad107add (plain) (tree)




































                                                                                                             
From f1e0d76264491a8d8f99a0041b1a36cf9752fd28 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Thu, 27 Feb 2020 04:24:52 -0600
Subject: [PATCH] mesa: Support flipping three-channel formats

Test system: POWER9 ppc64 (BE) system with a Radeon R5 230.

Before this commit, starting Xorg caused this message:
Assertion failed: !"Invalid array format" (../src/mesa/main/formats.c: _mesa_array_format_flip_channels: 421)

After this commit, Xorg starts successfully.
---
 src/mesa/main/formats.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 370859d37ca..2e7d5d7f05e 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -419,6 +419,14 @@ _mesa_array_format_flip_channels(mesa_array_format format)
       return format;
    }
 
+   if (num_channels == 3) {
+      static const uint8_t flip[6] = { 2, 1, 0, 3, 4, 5 };
+      _mesa_array_format_set_swizzle(&format,
+                                     flip[swizzle[0]], flip[swizzle[1]],
+                                     flip[swizzle[2]], flip[swizzle[3]]);
+      return format;
+   }
+
    if (num_channels == 4) {
       static const uint8_t flip[6] = { 3, 2, 1, 0, 4, 5 };
       _mesa_array_format_set_swizzle(&format,
-- 
2.25.1