summaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-bug1716707
diff options
context:
space:
mode:
authorPiotr Kubaj <pkubaj@FreeBSD.org>2022-04-12 18:06:17 +0000
committerPiotr Kubaj <pkubaj@FreeBSD.org>2022-04-12 18:06:17 +0000
commit3090fb28eeee869dc7434dfa2a453b6698ec7f43 (patch)
treef03f018d298178314d3ed750c5024021be01a954 /www/firefox/files/patch-bug1716707
parentsecurity/apkid: upgrade to v2.1.3 (diff)
www/firefox: fix some of color issues on big-endian
Upstream issue at https://bugzilla.mozilla.org/show_bug.cgi?id=1716707.
Diffstat (limited to 'www/firefox/files/patch-bug1716707')
-rw-r--r--www/firefox/files/patch-bug171670759
1 files changed, 59 insertions, 0 deletions
diff --git a/www/firefox/files/patch-bug1716707 b/www/firefox/files/patch-bug1716707
new file mode 100644
index 000000000000..73e01ebb0eb1
--- /dev/null
+++ b/www/firefox/files/patch-bug1716707
@@ -0,0 +1,59 @@
+diff --git a/image/imgFrame.cpp b/image/imgFrame.cpp
+--- image/imgFrame.cpp
++++ image/imgFrame.cpp
+@@ -372,6 +372,15 @@ nsresult imgFrame::InitWithDrawable(gfxD
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
++ 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);
++ }
++ }
++
+ if (!canUseDataSurface) {
+ // We used an offscreen surface, which is an "optimized" surface from
+ // imgFrame's perspective.
+# HG changeset patch
+# User M. Sirringhaus <msirringhaus@suse.de>
+# Date 1645518286 -3600
+# Tue Feb 22 09:24:46 2022 +0100
+# Node ID 494640792b4677f6462e95b90a54a4e22aeb738b
+# Parent 81832d035e101471dcf52dd91de287268add7a91
+
+diff --git a/gfx/webrender_bindings/RenderCompositorSWGL.cpp b/gfx/webrender_bindings/RenderCompositorSWGL.cpp
+--- gfx/webrender_bindings/RenderCompositorSWGL.cpp
++++ gfx/webrender_bindings/RenderCompositorSWGL.cpp
+@@ -7,6 +7,7 @@
+ #include "RenderCompositorSWGL.h"
+
+ #include "mozilla/gfx/Logging.h"
++#include "mozilla/gfx/Swizzle.h"
+ #include "mozilla/widget/CompositorWidget.h"
+
+ #ifdef MOZ_WIDGET_GTK
+@@ -134,6 +135,7 @@ bool RenderCompositorSWGL::AllocateMappe
+ mMappedData = map.mData;
+ mMappedStride = map.mStride;
+ }
++
+ MOZ_ASSERT(mMappedData != nullptr && mMappedStride > 0);
+ wr_swgl_init_default_framebuffer(mContext, bounds.x, bounds.y, bounds.width,
+ bounds.height, mMappedStride, mMappedData);
+@@ -235,6 +237,13 @@ void RenderCompositorSWGL::CommitMappedB
+ }
+ mDT->Flush();
+
++#if MOZ_BIG_ENDIAN()
++ // One swizzle to rule them all.
++ gfx::SwizzleData(mMappedData, mMappedStride, gfx::SurfaceFormat::B8G8R8A8,
++ mMappedData, mMappedStride, gfx::SurfaceFormat::A8R8G8B8,
++ mDT->GetSize());
++#endif
++
+ // Done with the DT. Hand it back to the widget and clear out any trace of it.
+ mWidget->EndRemoteDrawingInRegion(mDT, mDirtyRegion);
+ mDirtyRegion.SetEmpty();