git: f70859f0746e - main - www/firefox: fix color regressions after 3090fb28e

From: Christoph Moench-Tegeder <cmt_at_FreeBSD.org>
Date: Wed, 13 Apr 2022 13:16:06 UTC
The branch main has been updated by cmt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f70859f0746ecf4a5dd63764560d8db752f0d2d5

commit f70859f0746ecf4a5dd63764560d8db752f0d2d5
Author:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
AuthorDate: 2022-04-13 13:14:07 +0000
Commit:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
CommitDate: 2022-04-13 13:14:07 +0000

    www/firefox: fix color regressions after 3090fb28e
    
    little endian actually does not need endianess fixing, it only
    made widgets disappear and weird colors.
---
 www/firefox/Makefile               |  2 +-
 www/firefox/files/patch-bug1716707 | 67 ++++++++++++++++++--------------------
 2 files changed, 33 insertions(+), 36 deletions(-)

diff --git a/www/firefox/Makefile b/www/firefox/Makefile
index 9304e52ef059..debea780dcfa 100644
--- a/www/firefox/Makefile
+++ b/www/firefox/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	firefox
 DISTVERSION=	99.0.1
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	2
 CATEGORIES=	www
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
diff --git a/www/firefox/files/patch-bug1716707 b/www/firefox/files/patch-bug1716707
index 73e01ebb0eb1..33ff73450b73 100644
--- a/www/firefox/files/patch-bug1716707
+++ b/www/firefox/files/patch-bug1716707
@@ -1,30 +1,13 @@
-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
+commit ce7a2f400d4f599c72e32e2635fee7ea94c0848c
+Author: Christoph Moench-Tegeder <cmt@burggraben.net>
+Date:   Wed Apr 13 14:44:46 2022 +0200
 
-diff --git a/gfx/webrender_bindings/RenderCompositorSWGL.cpp b/gfx/webrender_bindings/RenderCompositorSWGL.cpp
+    big-endian color fixes, but without breaking little-endian
+    
+    as le is what most people actually use
+
+diff --git gfx/webrender_bindings/RenderCompositorSWGL.cpp gfx/webrender_bindings/RenderCompositorSWGL.cpp
+index dbf137c849ee..243a01ff9cf3 100644
 --- gfx/webrender_bindings/RenderCompositorSWGL.cpp
 +++ gfx/webrender_bindings/RenderCompositorSWGL.cpp
 @@ -7,6 +7,7 @@
@@ -35,15 +18,7 @@ diff --git a/gfx/webrender_bindings/RenderCompositorSWGL.cpp b/gfx/webrender_bin
  #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
+@@ -235,6 +236,13 @@ void RenderCompositorSWGL::CommitMappedBuffer(bool aDirty) {
    }
    mDT->Flush();
  
@@ -57,3 +32,25 @@ diff --git a/gfx/webrender_bindings/RenderCompositorSWGL.cpp b/gfx/webrender_bin
    // Done with the DT. Hand it back to the widget and clear out any trace of it.
    mWidget->EndRemoteDrawingInRegion(mDT, mDirtyRegion);
    mDirtyRegion.SetEmpty();
+diff --git image/imgFrame.cpp image/imgFrame.cpp
+index e58c3dd5b2d4..c1e7e77c362b 100644
+--- image/imgFrame.cpp
++++ image/imgFrame.cpp
+@@ -372,6 +372,17 @@ nsresult imgFrame::InitWithDrawable(gfxDrawable* aDrawable,
+     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.