https://bugzilla.mozilla.org/show_bug.cgi?id=1504834#c5
https://bugzilla.mozilla.org/attachment.cgi?id=9028600

--- a/gfx/skia/skia/third_party/skcms/skcms.cc
+++ b/gfx/skia/skia/third_party/skcms/skcms.cc
@@ -30,6 +30,8 @@
         #include <avx512fintrin.h>
         #include <avx512dqintrin.h>
     #endif
+#elif defined(__BIG_ENDIAN__)
+    #define SKCMS_PORTABLE
 #endif
 
 // sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
@@ -280,20 +282,28 @@ enum {
 static uint16_t read_big_u16(const uint8_t* ptr) {
     uint16_t be;
     memcpy(&be, ptr, sizeof(be));
-#if defined(_MSC_VER)
-    return _byteswap_ushort(be);
+#if defined(__BIG_ENDIAN__)
+    return be;
 #else
+    #if defined(_MSC_VER)
+    return _byteswap_ushort(be);
+    #else
     return __builtin_bswap16(be);
+    #endif
 #endif
 }
 
 static uint32_t read_big_u32(const uint8_t* ptr) {
     uint32_t be;
     memcpy(&be, ptr, sizeof(be));
-#if defined(_MSC_VER)
-    return _byteswap_ulong(be);
+#if defined(__BIG_ENDIAN__)
+    return be;
 #else
+    #if defined(_MSC_VER)
+    return _byteswap_ulong(be);
+    #else
     return __builtin_bswap32(be);
+    #endif
 #endif
 }
 
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -138,8 +138,7 @@ static IntRect CalculateSurfaceBounds(const IntSize& a
   return surfaceBounds.Intersect(bounds);
 }
 
-static const int kARGBAlphaOffset =
-    SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
+static const int kARGBAlphaOffset = 0;
 
 static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
                              const int32_t aStride, SurfaceFormat aFormat) {
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -87,15 +87,8 @@ enum class SurfaceFormat : int8_t {
 // The following values are endian-independent synonyms. The _UINT32 suffix
 // indicates that the name reflects the layout when viewed as a uint32_t
 // value.
-#if MOZ_LITTLE_ENDIAN()
   A8R8G8B8_UINT32 = B8G8R8A8,  // 0xAARRGGBB
   X8R8G8B8_UINT32 = B8G8R8X8,  // 0x00RRGGBB
-#elif MOZ_BIG_ENDIAN()
-  A8R8G8B8_UINT32 = A8R8G8B8,  // 0xAARRGGBB
-  X8R8G8B8_UINT32 = X8R8G8B8,  // 0x00RRGGBB
-#else
-#  error "bad endianness"
-#endif
 
   // The following values are OS and endian-independent synonyms.
   //
