3a67ab
# HG changeset patch
3a67ab
# Parent b7eb1ce0237d6125b75bc8ff1cb3afc328d6e78c
3a67ab
# User Steve Singer <steve@ssinger.info>
3a67ab
Bug 1005535 - Get skia GPU building on big endian.
3a67ab
3a67ab
diff --git a/configure.in b/configure.in
3a67ab
--- a/configure.in
3a67ab
+++ b/configure.in
3a67ab
@@ -8231,21 +8231,21 @@ dnl Skia
3a67ab
 dnl ========================================================
3a67ab
 if test "$MOZ_ENABLE_SKIA"; then
3a67ab
   AC_DEFINE(MOZ_ENABLE_SKIA)
3a67ab
   AC_DEFINE(USE_SKIA)
3a67ab
   if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
3a67ab
     AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
3a67ab
   fi
3a67ab
 
3a67ab
-  if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
3a67ab
+#  if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
3a67ab
     MOZ_ENABLE_SKIA_GPU=1
3a67ab
     AC_DEFINE(USE_SKIA_GPU)
3a67ab
     AC_SUBST(MOZ_ENABLE_SKIA_GPU)
3a67ab
-  fi
3a67ab
+#  fi
3a67ab
 fi
3a67ab
 AC_SUBST(MOZ_ENABLE_SKIA)
3a67ab
 
3a67ab
 dnl ========================================================
3a67ab
 dnl disable xul
3a67ab
 dnl ========================================================
3a67ab
 MOZ_ARG_DISABLE_BOOL(xul,
3a67ab
 [  --disable-xul           Disable XUL],
3a67ab
diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py
3a67ab
--- a/gfx/skia/generate_mozbuild.py
3a67ab
+++ b/gfx/skia/generate_mozbuild.py
3a67ab
@@ -236,17 +236,17 @@ def generate_separated_sources(platform_
3a67ab
         return True
3a67ab
 
3a67ab
     return False
3a67ab
 
3a67ab
   separated = {
3a67ab
     'common': {
3a67ab
       #'trunk/src/effects/gradients/SkGradientTileProc.cpp',
3a67ab
       'trunk/src/gpu/gl/GrGLCreateNativeInterface_none.cpp',
3a67ab
-      'trunk/src/ports/SkDiscardableMemory_none.cpp',
3a67ab
+      #'trunk/src/ports/SkDiscardableMemory_none.cpp',
3a67ab
       'trunk/src/ports/SkImageDecoder_empty.cpp',
3a67ab
       'trunk/src/ports/SkMemory_mozalloc.cpp',
3a67ab
       # 'trunk/src/images/SkImages.cpp',
3a67ab
       # 'trunk/src/images/SkImageRef.cpp',
3a67ab
       # 'trunk/src/images/SkImageRef_GlobalPool.cpp',
3a67ab
       # 'trunk/src/images/SkImageRefPool.cpp',
3a67ab
       # 'trunk/src/images/SkImageDecoder.cpp',
3a67ab
       # 'trunk/src/images/SkImageDecoder_Factory.cpp',
3a67ab
diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build
3a67ab
--- a/gfx/skia/moz.build
3a67ab
+++ b/gfx/skia/moz.build
3a67ab
@@ -847,17 +847,16 @@ else:
3a67ab
         'trunk/src/opts/SkBitmapProcState_opts_none.cpp',
3a67ab
         'trunk/src/opts/SkBlitMask_opts_none.cpp',
3a67ab
         'trunk/src/opts/SkBlitRow_opts_none.cpp',
3a67ab
         'trunk/src/opts/SkBlurImage_opts_none.cpp',
3a67ab
         'trunk/src/opts/SkMorphology_opts_none.cpp',
3a67ab
         'trunk/src/opts/SkTextureCompression_opts_none.cpp',
3a67ab
         'trunk/src/opts/SkUtils_opts_none.cpp',
3a67ab
         'trunk/src/opts/SkXfermode_opts_none.cpp',
3a67ab
-        'trunk/src/ports/SkDiscardableMemory_none.cpp',
3a67ab
     ]
3a67ab
 
3a67ab
 
3a67ab
 # can we find a better way of dealing with asm sources?
3a67ab
 
3a67ab
 # left out of UNIFIED_SOURCES for now; that's not C++ anyway, nothing else to unify it with
3a67ab
 if not CONFIG['INTEL_ARCHITECTURE'] and CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']:
3a67ab
     SOURCES += [
3a67ab
diff --git a/gfx/skia/trunk/include/config/SkUserConfig.h b/gfx/skia/trunk/include/config/SkUserConfig.h
3a67ab
--- a/gfx/skia/trunk/include/config/SkUserConfig.h
3a67ab
+++ b/gfx/skia/trunk/include/config/SkUserConfig.h
3a67ab
@@ -192,16 +192,17 @@
3a67ab
 
3a67ab
 #if defined(SK_CPU_ARM32) || defined(SK_CPU_ARM64)
3a67ab
 #  define SK_BARRIERS_PLATFORM_H "skia/SkBarriers_arm.h"
3a67ab
 #else
3a67ab
 #  define SK_BARRIERS_PLATFORM_H "skia/SkBarriers_x86.h"
3a67ab
 #endif
3a67ab
 
3a67ab
 // On all platforms we have this byte order
3a67ab
+
3a67ab
 #define SK_A32_SHIFT 24
3a67ab
 #define SK_R32_SHIFT 16
3a67ab
 #define SK_G32_SHIFT 8
3a67ab
 #define SK_B32_SHIFT 0
3a67ab
 
3a67ab
 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0
3a67ab
 
3a67ab
 #define SK_SUPPORT_LEGACY_GETDEVICE
3a67ab
diff --git a/gfx/skia/trunk/include/core/SkColorPriv.h b/gfx/skia/trunk/include/core/SkColorPriv.h
3a67ab
--- a/gfx/skia/trunk/include/core/SkColorPriv.h
3a67ab
+++ b/gfx/skia/trunk/include/core/SkColorPriv.h
3a67ab
@@ -27,37 +27,27 @@
3a67ab
  *  For easier compatibility with Skia's GPU backend, we further restrict these
3a67ab
  *  to either (in memory-byte-order) RGBA or BGRA. Note that this "order" does
3a67ab
  *  not directly correspond to the same shift-order, since we have to take endianess
3a67ab
  *  into account.
3a67ab
  *
3a67ab
  *  Here we enforce this constraint.
3a67ab
  */
3a67ab
 
3a67ab
-#ifdef SK_CPU_BENDIAN
3a67ab
-    #define SK_RGBA_R32_SHIFT   24
3a67ab
-    #define SK_RGBA_G32_SHIFT   16
3a67ab
-    #define SK_RGBA_B32_SHIFT   8
3a67ab
-    #define SK_RGBA_A32_SHIFT   0
3a67ab
 
3a67ab
-    #define SK_BGRA_B32_SHIFT   24
3a67ab
-    #define SK_BGRA_G32_SHIFT   16
3a67ab
-    #define SK_BGRA_R32_SHIFT   8
3a67ab
-    #define SK_BGRA_A32_SHIFT   0
3a67ab
-#else
3a67ab
     #define SK_RGBA_R32_SHIFT   0
3a67ab
     #define SK_RGBA_G32_SHIFT   8
3a67ab
     #define SK_RGBA_B32_SHIFT   16
3a67ab
     #define SK_RGBA_A32_SHIFT   24
3a67ab
 
3a67ab
     #define SK_BGRA_B32_SHIFT   0
3a67ab
     #define SK_BGRA_G32_SHIFT   8
3a67ab
     #define SK_BGRA_R32_SHIFT   16
3a67ab
     #define SK_BGRA_A32_SHIFT   24
3a67ab
-#endif
3a67ab
+
3a67ab
 
3a67ab
 #if defined(SK_PMCOLOR_IS_RGBA) && defined(SK_PMCOLOR_IS_BGRA)
3a67ab
     #error "can't define PMCOLOR to be RGBA and BGRA"
3a67ab
 #endif
3a67ab
 
3a67ab
 #define LOCAL_PMCOLOR_SHIFTS_EQUIVALENT_TO_RGBA  \
3a67ab
     (SK_A32_SHIFT == SK_RGBA_A32_SHIFT &&    \
3a67ab
      SK_R32_SHIFT == SK_RGBA_R32_SHIFT &&    \
3a67ab
diff --git a/gfx/skia/trunk/include/core/SkImageInfo.h b/gfx/skia/trunk/include/core/SkImageInfo.h
3a67ab
--- a/gfx/skia/trunk/include/core/SkImageInfo.h
3a67ab
+++ b/gfx/skia/trunk/include/core/SkImageInfo.h
3a67ab
@@ -83,19 +83,20 @@ enum SkColorType {
3a67ab
 
3a67ab
     kLastEnum_SkColorType = kIndex_8_SkColorType,
3a67ab
 
3a67ab
 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
3a67ab
     kN32_SkColorType = kBGRA_8888_SkColorType,
3a67ab
 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
3a67ab
     kN32_SkColorType = kRGBA_8888_SkColorType,
3a67ab
 #else
3a67ab
-#error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order"
3a67ab
+     kN32_SkColorType = kBGRA_8888_SkColorType
3a67ab
 #endif
3a67ab
 
3a67ab
+
3a67ab
 #ifdef SK_SUPPORT_LEGACY_N32_NAME
3a67ab
     kPMColor_SkColorType = kN32_SkColorType
3a67ab
 #endif
3a67ab
 };
3a67ab
 
3a67ab
 static int SkColorTypeBytesPerPixel(SkColorType ct) {
3a67ab
     static const uint8_t gSize[] = {
3a67ab
         0,  // Unknown
3a67ab
diff --git a/gfx/skia/trunk/include/gpu/GrTypes.h b/gfx/skia/trunk/include/gpu/GrTypes.h
3a67ab
--- a/gfx/skia/trunk/include/gpu/GrTypes.h
3a67ab
+++ b/gfx/skia/trunk/include/gpu/GrTypes.h
3a67ab
@@ -304,25 +304,23 @@ enum GrPixelConfig {
3a67ab
      * Byte order is r, g, b, a.  This color format is 32 bits per channel
3a67ab
      */
3a67ab
     kRGBA_float_GrPixelConfig,
3a67ab
     kLast_GrPixelConfig = kRGBA_float_GrPixelConfig
3a67ab
 };
3a67ab
 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
3a67ab
 
3a67ab
 // Aliases for pixel configs that match skia's byte order.
3a67ab
-#ifndef SK_CPU_LENDIAN
3a67ab
-    #error "Skia gpu currently assumes little endian"
3a67ab
-#endif
3a67ab
+
3a67ab
 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
3a67ab
     static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
3a67ab
 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
3a67ab
     static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfig;
3a67ab
 #else
3a67ab
-    #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
3a67ab
+    static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
3a67ab
 #endif
3a67ab
 
3a67ab
 // Returns true if the pixel config is a GPU-specific compressed format
3a67ab
 // representation.
3a67ab
 static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
3a67ab
     switch (config) {
3a67ab
         case kETC1_GrPixelConfig:
3a67ab
         case kLATC_GrPixelConfig: