summaryrefslogtreecommitdiff
path: root/user/firefox-esr/webrender.patch
blob: e6b1459563f6284661392585ea4605977d3ee9a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# HG changeset patch
# User Petr Sumbera <petr.sumbera@oracle.com>
# Date 1648114576 25200
#      Thu Mar 24 02:36:16 2022 -0700
# Node ID 903e5f164c0ed424492eec6f388c03cbbcf99913
# Parent  20d81e68da033746bf81acbb08490f16679853da
Bug 1716707 [s390x] Software WebRender does not support big endian

--- firefox-128.0/image/imgFrame.cpp
+++ firefox-128.0/image/imgFrame.cpp
@@ -372,6 +372,17 @@ mAborted = true;
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
+#if MOZ_BIG_ENDIAN()
+  if (aBackend == gfx::BackendType::SKIA && canUseDataSurface) {
+      // SKIA is lying about what format it returns on big endian
+      for (int ii=0; ii < mRawSurface->GetSize().Height()*mRawSurface->Stride() / 4; ++ii) {
+        uint32_t *vals = (uint32_t*)(mRawSurface->GetData());
+        uint32_t val = ((vals[ii] << 8) & 0xFF00FF00 ) | ((vals[ii] >> 8) & 0xFF00FF );
+        vals[ii] = (val << 16) | (val >> 16);
+      }
+  }
+#endif
+
   if (!canUseDataSurface) {
     // We used an offscreen surface, which is an "optimized" surface from
     // imgFrame's perspective.