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