mozilla-bmo1504834-part1.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Mon, 30 Mar 2020 21:49:01 +0200
branchfirefox74
changeset 1123 7fa561e5d7c7
parent 1121 004e4b1efb26
permissions -rw-r--r--
Firefox 74.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1101
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
# HG changeset patch
1123
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1121
diff changeset
     2
# Parent  b5471d23321d16a0bacc25b7afd27d2e16adba1a
1101
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
Taken from https://bugzilla.mozilla.org/show_bug.cgi?id=1504834
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
1121
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
     5
diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
     6
--- a/gfx/2d/DrawTargetSkia.cpp
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
     7
+++ b/gfx/2d/DrawTargetSkia.cpp
1123
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1121
diff changeset
     8
@@ -130,18 +130,17 @@ static IntRect CalculateSurfaceBounds(co
1121
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
     9
   Rect sampledBounds = inverse.TransformBounds(*aBounds);
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    10
   if (!sampledBounds.ToIntRect(&bounds)) {
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    11
     return surfaceBounds;
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    12
   }
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    13
 
1101
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
   return surfaceBounds.Intersect(bounds);
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
 }
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
 
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
-static const int kARGBAlphaOffset =
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
-    SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
+static const int kARGBAlphaOffset = 0;  // Skia is always BGRA SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
 
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
 static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
                              const int32_t aStride, SurfaceFormat aFormat) {
1121
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    23
   if (aFormat != SurfaceFormat::B8G8R8X8 || aSize.IsEmpty()) {
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    24
     return true;
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    25
   }
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    26
   // We should've initialized the data to be opaque already
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    27
   // On debug builds, verify that this is actually true.
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    28
diff --git a/gfx/2d/Types.h b/gfx/2d/Types.h
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    29
--- a/gfx/2d/Types.h
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    30
+++ b/gfx/2d/Types.h
1123
7fa561e5d7c7 Firefox 74.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1121
diff changeset
    31
@@ -84,25 +84,18 @@ enum class SurfaceFormat : int8_t {
1121
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    32
   Depth,
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    33
 
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    34
   // This represents the unknown format.
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    35
   UNKNOWN,
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    36
 
1101
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
 // The following values are endian-independent synonyms. The _UINT32 suffix
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
 // indicates that the name reflects the layout when viewed as a uint32_t
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
 // value.
1121
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    40
-#if MOZ_LITTLE_ENDIAN()
1101
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
   A8R8G8B8_UINT32 = B8G8R8A8,  // 0xAARRGGBB
1119
4c5d44d40a03 Firefox 72.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1101
diff changeset
    42
   X8R8G8B8_UINT32 = B8G8R8X8,  // 0x00RRGGBB
1121
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    43
-#elif MOZ_BIG_ENDIAN()
1101
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
-  A8R8G8B8_UINT32 = A8R8G8B8,  // 0xAARRGGBB
1119
4c5d44d40a03 Firefox 72.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1101
diff changeset
    45
-  X8R8G8B8_UINT32 = X8R8G8B8,  // 0x00RRGGBB
1101
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
-#else
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
-#  error "bad endianness"
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
-#endif
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
 
1119
4c5d44d40a03 Firefox 72.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1101
diff changeset
    50
   // The following values are OS and endian-independent synonyms.
4c5d44d40a03 Firefox 72.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1101
diff changeset
    51
   //
1121
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    52
   // TODO(aosmond): When everything blocking bug 1581828 has been resolved, we
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    53
   // can make this use R8B8G8A8 and R8B8G8X8 for non-Windows platforms.
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    54
   OS_RGBA = A8R8G8B8_UINT32,
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    55
   OS_RGBX = X8R8G8B8_UINT32
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    56
 };
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    57
diff --git a/gfx/skia/skia/third_party/skcms/skcms.cc b/gfx/skia/skia/third_party/skcms/skcms.cc
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    58
--- a/gfx/skia/skia/third_party/skcms/skcms.cc
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    59
+++ b/gfx/skia/skia/third_party/skcms/skcms.cc
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    60
@@ -25,16 +25,18 @@
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    61
         // it'd be a lot slower.  But we want all those headers included so we
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    62
         // can use their features after runtime checks later.
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    63
         #include <smmintrin.h>
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    64
         #include <avxintrin.h>
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    65
         #include <avx2intrin.h>
1119
4c5d44d40a03 Firefox 72.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1101
diff changeset
    66
         #include <avx512fintrin.h>
4c5d44d40a03 Firefox 72.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1101
diff changeset
    67
         #include <avx512dqintrin.h>
4c5d44d40a03 Firefox 72.0.1
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1101
diff changeset
    68
     #endif
1101
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
+#else
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
+    #define SKCMS_PORTABLE
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
 #endif
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
 
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
 // sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
1121
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    74
 // We have better testing on 64-bit machines, so force 32-bit machines to behave like 64-bit.
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    75
 //
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    76
 // Please do not use sizeof() directly, and size_t only when required.
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    77
 // (We have no way of enforcing these requests...)
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    78
 #define SAFE_SIZEOF(x) ((uint64_t)sizeof(x))
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    79
@@ -275,30 +277,38 @@ enum {
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    80
     skcms_Signature_sf32 = 0x73663332,
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    81
     // XYZ is also a PCS signature, so it's defined in skcms.h
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    82
     // skcms_Signature_XYZ = 0x58595A20,
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    83
 };
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
    84
 
1101
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    85
 static uint16_t read_big_u16(const uint8_t* ptr) {
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    86
     uint16_t be;
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    87
     memcpy(&be, ptr, sizeof(be));
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    88
-#if defined(_MSC_VER)
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    89
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    90
+    return be;
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    91
+#else
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    92
+    #if defined(_MSC_VER)
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    93
     return _byteswap_ushort(be);
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    94
-#else
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    95
+    #else
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
     return __builtin_bswap16(be);
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    97
+    #endif
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
 #endif
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    99
 }
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   100
 
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
 static uint32_t read_big_u32(const uint8_t* ptr) {
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   102
     uint32_t be;
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   103
     memcpy(&be, ptr, sizeof(be));
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   104
-#if defined(_MSC_VER)
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   105
+#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   106
+    return be;
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   107
+#else
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   108
+    #if defined(_MSC_VER)
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   109
     return _byteswap_ulong(be);
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   110
-#else
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
+    #else
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   112
     return __builtin_bswap32(be);
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
+    #endif
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   114
 #endif
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
 }
a4709640638e added several arch specific (mainly BE) patches
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
 
1121
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
   117
 static int32_t read_big_i32(const uint8_t* ptr) {
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
   118
     return (int32_t)read_big_u32(ptr);
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
   119
 }
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
   120
 
004e4b1efb26 Firefox 73.0
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 1119
diff changeset
   121
 static float read_big_fixed(const uint8_t* ptr) {