Bug 1209812 (part 3) - Rename SurfaceFormat::R5G6B5 as R5G6B5_UINT16. r=Bas.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 22 Oct 2015 23:01:31 -0700
changeset 270112 c566d5a42e84a116835b574bc69b72f4a2ab64ea
parent 270111 f37c01f7c064c0f32019c3f1a811cdf11c33291f
child 270113 3b546c86c824d971b8a888a9772bd4c241958880
push id67266
push usernnethercote@mozilla.com
push dateThu, 29 Oct 2015 02:05:28 +0000
treeherdermozilla-inbound@3b546c86c824 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1209812
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1209812 (part 3) - Rename SurfaceFormat::R5G6B5 as R5G6B5_UINT16. r=Bas.
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/WebGLContextGL.cpp
dom/media/encoder/VP8TrackEncoder.cpp
gfx/2d/DrawTargetCairo.cpp
gfx/2d/HelpersCairo.h
gfx/2d/HelpersSkia.h
gfx/2d/Logging.h
gfx/2d/Tools.h
gfx/2d/Types.h
gfx/gl/GLReadTexImageHelper.cpp
gfx/gl/GLUploadHelpers.cpp
gfx/gl/TextureImageEGL.cpp
gfx/layers/Effects.h
gfx/layers/GrallocImages.cpp
gfx/layers/LayersLogging.cpp
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/opengl/GrallocTextureClient.cpp
gfx/layers/opengl/GrallocTextureHost.cpp
gfx/layers/opengl/OGLShaderProgram.h
gfx/thebes/gfx2DGlue.h
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxUtils.cpp
gfx/ycbcr/YCbCrUtils.cpp
image/imgFrame.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
widget/android/AndroidBridge.cpp
widget/gonk/nsWindow.cpp
widget/nsShmImage.cpp
widget/qt/nsClipboard.cpp
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -4492,17 +4492,17 @@ CanvasRenderingContext2D::DrawImage(cons
     }
     const gl::OriginPos destOrigin = gl::OriginPos::TopLeft;
     bool ok = gl->BlitHelper()->BlitImageToTexture(srcImage, srcImage->GetSize(),
                                                    mVideoTexture, LOCAL_GL_TEXTURE_2D,
                                                    destOrigin);
     if (ok) {
       NativeSurface texSurf;
       texSurf.mType = NativeSurfaceType::OPENGL_TEXTURE;
-      texSurf.mFormat = SurfaceFormat::R5G6B5;
+      texSurf.mFormat = SurfaceFormat::R5G6B5_UINT16;
       texSurf.mSize.width = mCurrentVideoSize.width;
       texSurf.mSize.height = mCurrentVideoSize.height;
       texSurf.mSurface = (void*)((uintptr_t)mVideoTexture);
 
       srcSurf = mTarget->CreateSourceSurfaceFromNativeSurface(texSurf);
       imgSize.width = mCurrentVideoSize.width;
       imgSize.height = mCurrentVideoSize.height;
 
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -1938,17 +1938,17 @@ WebGLContext::SurfaceFromElementResultTo
             *format = WebGLTexelFormat::BGRA8; // careful, our ARGB means BGRA
             break;
         case SurfaceFormat::B8G8R8X8:
             *format = WebGLTexelFormat::BGRX8; // careful, our RGB24 is not tightly packed. Whence BGRX8.
             break;
         case SurfaceFormat::A8:
             *format = WebGLTexelFormat::A8;
             break;
-        case SurfaceFormat::R5G6B5:
+        case SurfaceFormat::R5G6B5_UINT16:
             *format = WebGLTexelFormat::RGB565;
             break;
         default:
             NS_ASSERTION(false, "Unsupported image format. Unimplemented.");
             return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     imageOut = data;
--- a/dom/media/encoder/VP8TrackEncoder.cpp
+++ b/dom/media/encoder/VP8TrackEncoder.cpp
@@ -398,17 +398,17 @@ nsresult VP8TrackEncoder::PrepareRawFram
       case SurfaceFormat::B8G8R8X8:
         rv = libyuv::ARGBToI420(static_cast<uint8*>(map.GetData()),
                                 map.GetStride(),
                                 y, mFrameWidth,
                                 cb, halfWidth,
                                 cr, halfWidth,
                                 mFrameWidth, mFrameHeight);
         break;
-      case SurfaceFormat::R5G6B5:
+      case SurfaceFormat::R5G6B5_UINT16:
         rv = libyuv::RGB565ToI420(static_cast<uint8*>(map.GetData()),
                                   map.GetStride(),
                                   y, mFrameWidth,
                                   cb, halfWidth,
                                   cr, halfWidth,
                                   mFrameWidth, mFrameHeight);
         break;
       default:
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -666,17 +666,17 @@ GfxFormatForCairoSurface(cairo_surface_t
   cairo_surface_type_t type = cairo_surface_get_type(surface);
   if (type == CAIRO_SURFACE_TYPE_IMAGE) {
     return CairoFormatToGfxFormat(cairo_image_surface_get_format(surface));
   }
 #ifdef CAIRO_HAS_XLIB_SURFACE
   // xlib is currently the only Cairo backend that creates 16bpp surfaces
   if (type == CAIRO_SURFACE_TYPE_XLIB &&
       cairo_xlib_surface_get_depth(surface) == 16) {
-    return SurfaceFormat::R5G6B5;
+    return SurfaceFormat::R5G6B5_UINT16;
   }
 #endif
   return CairoContentToGfxFormat(cairo_surface_get_content(surface));
 }
 
 already_AddRefed<SourceSurface>
 DrawTargetCairo::Snapshot()
 {
--- a/gfx/2d/HelpersCairo.h
+++ b/gfx/2d/HelpersCairo.h
@@ -148,33 +148,33 @@ GfxFormatToCairoFormat(SurfaceFormat for
   switch (format)
   {
     case SurfaceFormat::B8G8R8A8:
       return CAIRO_FORMAT_ARGB32;
     case SurfaceFormat::B8G8R8X8:
       return CAIRO_FORMAT_RGB24;
     case SurfaceFormat::A8:
       return CAIRO_FORMAT_A8;
-    case SurfaceFormat::R5G6B5:
+    case SurfaceFormat::R5G6B5_UINT16:
       return CAIRO_FORMAT_RGB16_565;
     default:
       gfxCriticalError() << "Unknown image format " << (int)format;
       return CAIRO_FORMAT_ARGB32;
   }
 }
 
 static inline cairo_content_t
 GfxFormatToCairoContent(SurfaceFormat format)
 {
   switch (format)
   {
     case SurfaceFormat::B8G8R8A8:
       return CAIRO_CONTENT_COLOR_ALPHA;
     case SurfaceFormat::B8G8R8X8:
-    case SurfaceFormat::R5G6B5:  //fall through
+    case SurfaceFormat::R5G6B5_UINT16:  //fall through
       return CAIRO_CONTENT_COLOR;
     case SurfaceFormat::A8:
       return CAIRO_CONTENT_ALPHA;
     default:
       gfxCriticalError() << "Unknown image content format " << (int)format;
       return CAIRO_CONTENT_COLOR_ALPHA;
   }
 }
@@ -236,17 +236,17 @@ CairoFormatToGfxFormat(cairo_format_t fo
   switch (format) {
     case CAIRO_FORMAT_ARGB32:
       return SurfaceFormat::B8G8R8A8;
     case CAIRO_FORMAT_RGB24:
       return SurfaceFormat::B8G8R8X8;
     case CAIRO_FORMAT_A8:
       return SurfaceFormat::A8;
     case CAIRO_FORMAT_RGB16_565:
-      return SurfaceFormat::R5G6B5;
+      return SurfaceFormat::R5G6B5_UINT16;
     default:
       gfxCriticalError() << "Unknown cairo format " << format;
       return SurfaceFormat::UNKNOWN;
   }
 }
 
 static inline FontHinting
 CairoHintingToGfxHinting(cairo_hint_style_t aHintStyle)
--- a/gfx/2d/HelpersSkia.h
+++ b/gfx/2d/HelpersSkia.h
@@ -25,34 +25,34 @@ GfxFormatToSkiaColorType(SurfaceFormat f
 {
   switch (format)
   {
     case SurfaceFormat::B8G8R8A8:
       return kBGRA_8888_SkColorType;
     case SurfaceFormat::B8G8R8X8:
       // We probably need to do something here.
       return kBGRA_8888_SkColorType;
-    case SurfaceFormat::R5G6B5:
+    case SurfaceFormat::R5G6B5_UINT16:
       return kRGB_565_SkColorType;
     case SurfaceFormat::A8:
       return kAlpha_8_SkColorType;
     default:
       return kRGBA_8888_SkColorType;
   }
 }
 
 static inline SurfaceFormat
 SkiaColorTypeToGfxFormat(SkColorType type)
 {
   switch (type)
   {
     case kBGRA_8888_SkColorType:
       return SurfaceFormat::B8G8R8A8;
     case kRGB_565_SkColorType:
-      return SurfaceFormat::R5G6B5;
+      return SurfaceFormat::R5G6B5_UINT16;
     case kAlpha_8_SkColorType:
       return SurfaceFormat::A8;
     default:
       return SurfaceFormat::B8G8R8A8;
   }
 }
 
 #ifdef USE_SKIA_GPU
@@ -61,17 +61,17 @@ GfxFormatToGrConfig(SurfaceFormat format
 {
   switch (format)
   {
     case SurfaceFormat::B8G8R8A8:
       return kBGRA_8888_GrPixelConfig;
     case SurfaceFormat::B8G8R8X8:
       // We probably need to do something here.
       return kBGRA_8888_GrPixelConfig;
-    case SurfaceFormat::R5G6B5:
+    case SurfaceFormat::R5G6B5_UINT16:
       return kRGB_565_GrPixelConfig;
     case SurfaceFormat::A8:
       return kAlpha_8_GrPixelConfig;
     default:
       return kRGBA_8888_GrPixelConfig;
   }
 
 }
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -394,18 +394,18 @@ public:
           mMessage << "SurfaceFormat::B8G8R8X8";
           break;
         case SurfaceFormat::R8G8B8A8:
           mMessage << "SurfaceFormat::R8G8B8A8";
           break;
         case SurfaceFormat::R8G8B8X8:
           mMessage << "SurfaceFormat::R8G8B8X8";
           break;
-        case SurfaceFormat::R5G6B5:
-          mMessage << "SurfaceFormat::R5G6B5";
+        case SurfaceFormat::R5G6B5_UINT16:
+          mMessage << "SurfaceFormat::R5G6B5_UINT16";
           break;
         case SurfaceFormat::A8:
           mMessage << "SurfaceFormat::A8";
           break;
         case SurfaceFormat::YUV:
           mMessage << "SurfaceFormat::YUV";
           break;
         case SurfaceFormat::UNKNOWN:
--- a/gfx/2d/Tools.h
+++ b/gfx/2d/Tools.h
@@ -81,17 +81,17 @@ Distance(Point aA, Point aB)
 }
 
 static inline int
 BytesPerPixel(SurfaceFormat aFormat)
 {
   switch (aFormat) {
   case SurfaceFormat::A8:
     return 1;
-  case SurfaceFormat::R5G6B5:
+  case SurfaceFormat::R5G6B5_UINT16:
     return 2;
   default:
     return 4;
   }
 }
 
 template<typename T, int alignment = 16>
 struct AlignedArray
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -29,29 +29,29 @@ enum class SurfaceType : int8_t {
   TILED /* Surface from a tiled DrawTarget */
 };
 
 enum class SurfaceFormat : int8_t {
   B8G8R8A8,
   B8G8R8X8,
   R8G8B8A8,
   R8G8B8X8,
-  R5G6B5,
+  R5G6B5_UINT16,
   A8,
   YUV,
   NV12,
   UNKNOWN
 };
 
 inline bool IsOpaque(SurfaceFormat aFormat)
 {
   switch (aFormat) {
   case SurfaceFormat::B8G8R8X8:
   case SurfaceFormat::R8G8B8X8:
-  case SurfaceFormat::R5G6B5:
+  case SurfaceFormat::R5G6B5_UINT16:
   case SurfaceFormat::YUV:
   case SurfaceFormat::NV12:
     return true;
   default:
     return false;
   }
 }
 
--- a/gfx/gl/GLReadTexImageHelper.cpp
+++ b/gfx/gl/GLReadTexImageHelper.cpp
@@ -269,31 +269,31 @@ CopyDataSourceSurface(DataSourceSurface*
     MOZ_ASSERT(aSource->GetFormat() == SurfaceFormat::R8G8B8A8 ||
                aSource->GetFormat() == SurfaceFormat::R8G8B8X8 ||
                aSource->GetFormat() == SurfaceFormat::B8G8R8A8 ||
                aSource->GetFormat() == SurfaceFormat::B8G8R8X8);
     MOZ_ASSERT(aDest->GetFormat() == SurfaceFormat::R8G8B8A8 ||
                aDest->GetFormat() == SurfaceFormat::R8G8B8X8 ||
                aDest->GetFormat() == SurfaceFormat::B8G8R8A8 ||
                aDest->GetFormat() == SurfaceFormat::B8G8R8X8 ||
-               aDest->GetFormat() == SurfaceFormat::R5G6B5);
+               aDest->GetFormat() == SurfaceFormat::R5G6B5_UINT16);
 
     const bool isSrcBGR = aSource->GetFormat() == SurfaceFormat::B8G8R8A8 ||
                           aSource->GetFormat() == SurfaceFormat::B8G8R8X8;
     const bool isDestBGR = aDest->GetFormat() == SurfaceFormat::B8G8R8A8 ||
                            aDest->GetFormat() == SurfaceFormat::B8G8R8X8;
     const bool needsSwap02 = isSrcBGR != isDestBGR;
 
     const bool srcHasAlpha = aSource->GetFormat() == SurfaceFormat::R8G8B8A8 ||
                              aSource->GetFormat() == SurfaceFormat::B8G8R8A8;
     const bool destHasAlpha = aDest->GetFormat() == SurfaceFormat::R8G8B8A8 ||
                               aDest->GetFormat() == SurfaceFormat::B8G8R8A8;
     const bool needsAlphaMask = !srcHasAlpha && destHasAlpha;
 
-    const bool needsConvertTo16Bits = aDest->GetFormat() == SurfaceFormat::R5G6B5;
+    const bool needsConvertTo16Bits = aDest->GetFormat() == SurfaceFormat::R5G6B5_UINT16;
 
     DataSourceSurface::MappedSurface srcMap;
     DataSourceSurface::MappedSurface destMap;
     if (!aSource->Map(DataSourceSurface::MapType::READ, &srcMap) ||
         !aDest->Map(DataSourceSurface::MapType::WRITE, &destMap)) {
         MOZ_ASSERT(false, "CopyDataSourceSurface: Failed to map surface.");
         return;
     }
@@ -389,17 +389,17 @@ ReadPixelsIntoDataSurface(GLContext* gl,
         destType = LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV;
         break;
     case SurfaceFormat::R8G8B8A8:
     case SurfaceFormat::R8G8B8X8:
         // Needs host (little) endian ABGR.
         destFormat = LOCAL_GL_RGBA;
         destType = LOCAL_GL_UNSIGNED_BYTE;
         break;
-    case SurfaceFormat::R5G6B5:
+    case SurfaceFormat::R5G6B5_UINT16:
         destFormat = LOCAL_GL_RGB;
         destType = LOCAL_GL_UNSIGNED_SHORT_5_6_5_REV;
         break;
     default:
         MOZ_CRASH("Bad format.");
     }
     destPixelSize = BytesPerPixel(dest->GetFormat());
     MOZ_ASSERT(dest->GetSize().width * destPixelSize <= dest->Stride());
@@ -433,17 +433,17 @@ ReadPixelsIntoDataSurface(GLContext* gl,
             case LOCAL_GL_BGRA: {
                 readFormatGFX = hasAlpha ? SurfaceFormat::B8G8R8A8
                                          : SurfaceFormat::B8G8R8X8;
                 break;
             }
             case LOCAL_GL_RGB: {
                 MOZ_ASSERT(destPixelSize == 2);
                 MOZ_ASSERT(readType == LOCAL_GL_UNSIGNED_SHORT_5_6_5_REV);
-                readFormatGFX = SurfaceFormat::R5G6B5;
+                readFormatGFX = SurfaceFormat::R5G6B5_UINT16;
                 break;
             }
             default: {
                 MOZ_CRASH("Bad read format.");
             }
         }
 
         switch (readType) {
--- a/gfx/gl/GLUploadHelpers.cpp
+++ b/gfx/gl/GLUploadHelpers.cpp
@@ -481,20 +481,20 @@ UploadImageDataToTexture(GLContext* gl,
               surfaceFormat = SurfaceFormat::B8G8R8X8;
             } else {
               format = LOCAL_GL_RGBA;
               type = LOCAL_GL_UNSIGNED_BYTE;
               surfaceFormat = SurfaceFormat::R8G8B8X8;
             }
             internalFormat = LOCAL_GL_RGBA;
             break;
-        case SurfaceFormat::R5G6B5:
+        case SurfaceFormat::R5G6B5_UINT16:
             internalFormat = format = LOCAL_GL_RGB;
             type = LOCAL_GL_UNSIGNED_SHORT_5_6_5;
-            surfaceFormat = SurfaceFormat::R5G6B5;
+            surfaceFormat = SurfaceFormat::R5G6B5_UINT16;
             break;
         case SurfaceFormat::A8:
             internalFormat = format = LOCAL_GL_LUMINANCE;
             type = LOCAL_GL_UNSIGNED_BYTE;
             // We don't have a specific luminance shader
             surfaceFormat = SurfaceFormat::A8;
             break;
         default:
--- a/gfx/gl/TextureImageEGL.cpp
+++ b/gfx/gl/TextureImageEGL.cpp
@@ -15,17 +15,17 @@ namespace gl {
 
 static GLenum
 GLFormatForImage(gfx::SurfaceFormat aFormat)
 {
     switch (aFormat) {
     case gfx::SurfaceFormat::B8G8R8A8:
     case gfx::SurfaceFormat::B8G8R8X8:
         return LOCAL_GL_RGBA;
-    case gfx::SurfaceFormat::R5G6B5:
+    case gfx::SurfaceFormat::R5G6B5_UINT16:
         return LOCAL_GL_RGB;
     case gfx::SurfaceFormat::A8:
         return LOCAL_GL_LUMINANCE;
     default:
         NS_WARNING("Unknown GL format for Surface format");
     }
     return 0;
 }
@@ -33,17 +33,17 @@ GLFormatForImage(gfx::SurfaceFormat aFor
 static GLenum
 GLTypeForImage(gfx::SurfaceFormat aFormat)
 {
     switch (aFormat) {
     case gfx::SurfaceFormat::B8G8R8A8:
     case gfx::SurfaceFormat::B8G8R8X8:
     case gfx::SurfaceFormat::A8:
         return LOCAL_GL_UNSIGNED_BYTE;
-    case gfx::SurfaceFormat::R5G6B5:
+    case gfx::SurfaceFormat::R5G6B5_UINT16:
         return LOCAL_GL_UNSIGNED_SHORT_5_6_5;
     default:
         NS_WARNING("Unknown GL format for Surface format");
     }
     return 0;
 }
 
 TextureImageEGL::TextureImageEGL(GLuint aTexture,
@@ -64,17 +64,17 @@ TextureImageEGL::TextureImageEGL(GLuint 
     , mTextureState(aTextureState)
     , mBound(false)
 {
     if (mUpdateFormat == gfx::SurfaceFormat::UNKNOWN) {
         mUpdateFormat =
                 gfxPlatform::GetPlatform()->Optimal2DFormatForContent(GetContentType());
     }
 
-    if (mUpdateFormat == gfx::SurfaceFormat::R5G6B5) {
+    if (mUpdateFormat == gfx::SurfaceFormat::R5G6B5_UINT16) {
         mTextureFormat = gfx::SurfaceFormat::R8G8B8X8;
     } else if (mUpdateFormat == gfx::SurfaceFormat::B8G8R8X8) {
         mTextureFormat = gfx::SurfaceFormat::B8G8R8X8;
     } else {
         mTextureFormat = gfx::SurfaceFormat::B8G8R8A8;
     }
 }
 
--- a/gfx/layers/Effects.h
+++ b/gfx/layers/Effects.h
@@ -262,17 +262,17 @@ CreateTexturedEffect(gfx::SurfaceFormat 
                      const LayerRenderState &state = LayerRenderState())
 {
   MOZ_ASSERT(aSource);
   RefPtr<TexturedEffect> result;
   switch (aFormat) {
   case gfx::SurfaceFormat::B8G8R8A8:
   case gfx::SurfaceFormat::B8G8R8X8:
   case gfx::SurfaceFormat::R8G8B8X8:
-  case gfx::SurfaceFormat::R5G6B5:
+  case gfx::SurfaceFormat::R5G6B5_UINT16:
   case gfx::SurfaceFormat::R8G8B8A8:
     result = new EffectRGB(aSource, isAlphaPremultiplied, aFilter);
     break;
   case gfx::SurfaceFormat::YUV:
     result = new EffectYCbCr(aSource, aFilter);
     break;
   case gfx::SurfaceFormat::NV12:
     result = new EffectNV12(aSource, aFilter);
--- a/gfx/layers/GrallocImages.cpp
+++ b/gfx/layers/GrallocImages.cpp
@@ -379,17 +379,17 @@ ConvertOmxYUVFormatToRGB565(android::sp<
 
   android::ColorConverter colorConverter((OMX_COLOR_FORMATTYPE)omxFormat,
                                          OMX_COLOR_Format16bitRGB565);
   if (!colorConverter.isValid()) {
     NS_WARNING("Invalid color conversion");
     return BAD_VALUE;
   }
 
-  uint32_t pixelStride = aMappedSurface->mStride/gfx::BytesPerPixel(gfx::SurfaceFormat::R5G6B5);
+  uint32_t pixelStride = aMappedSurface->mStride/gfx::BytesPerPixel(gfx::SurfaceFormat::R5G6B5_UINT16);
   rv = colorConverter.convert(buffer, width, height,
                               0, 0, width - 1, height - 1 /* source crop */,
                               aMappedSurface->mData, pixelStride, height,
                               0, 0, width - 1, height - 1 /* dest crop */);
   if (rv) {
     NS_WARNING("OMX color conversion failed");
     return BAD_VALUE;
   }
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -311,17 +311,18 @@ AppendToString(std::stringstream& aStrea
                const char* pfx, const char* sfx)
 {
   aStream << pfx;
   switch (format) {
   case SurfaceFormat::B8G8R8A8:  aStream << "SurfaceFormat::B8G8R8A8"; break;
   case SurfaceFormat::B8G8R8X8:  aStream << "SurfaceFormat::B8G8R8X8"; break;
   case SurfaceFormat::R8G8B8A8:  aStream << "SurfaceFormat::R8G8B8A8"; break;
   case SurfaceFormat::R8G8B8X8:  aStream << "SurfaceFormat::R8G8B8X8"; break;
-  case SurfaceFormat::R5G6B5:    aStream << "SurfaceFormat::R5G6B5"; break;
+  case SurfaceFormat::R5G6B5_UINT16:
+                                 aStream << "SurfaceFormat::R5G6B5_UINT16"; break;
   case SurfaceFormat::A8:        aStream << "SurfaceFormat::A8"; break;
   case SurfaceFormat::YUV:       aStream << "SurfaceFormat::YUV"; break;
   case SurfaceFormat::NV12:      aStream << "SurfaceFormat::NV12"; break;
   case SurfaceFormat::UNKNOWN:   aStream << "SurfaceFormat::UNKNOWN"; break;
   default:
     NS_ERROR("unknown surface format");
     aStream << "???";
   }
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -828,17 +828,17 @@ CompositorOGL::GetShaderConfigFor(Effect
         static_cast<TexturedEffect*>(aEffect);
     TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
     MOZ_ASSERT_IF(source->GetTextureTarget() == LOCAL_GL_TEXTURE_EXTERNAL,
                   source->GetFormat() == gfx::SurfaceFormat::R8G8B8A8 ||
                   source->GetFormat() == gfx::SurfaceFormat::R8G8B8X8);
     MOZ_ASSERT_IF(source->GetTextureTarget() == LOCAL_GL_TEXTURE_RECTANGLE_ARB,
                   source->GetFormat() == gfx::SurfaceFormat::R8G8B8A8 ||
                   source->GetFormat() == gfx::SurfaceFormat::R8G8B8X8 ||
-                  source->GetFormat() == gfx::SurfaceFormat::R5G6B5);
+                  source->GetFormat() == gfx::SurfaceFormat::R5G6B5_UINT16);
     config = ShaderConfigFromTargetAndFormat(source->GetTextureTarget(),
                                              source->GetFormat());
     break;
   }
   }
   config.SetColorMatrix(aColorMatrix);
   config.SetMask2D(aMask == MaskType::Mask2d);
   config.SetMask3D(aMask == MaskType::Mask3d);
--- a/gfx/layers/opengl/GrallocTextureClient.cpp
+++ b/gfx/layers/opengl/GrallocTextureClient.cpp
@@ -176,17 +176,17 @@ SurfaceFormatForPixelFormat(android::Pix
   switch (aFormat) {
   case PIXEL_FORMAT_RGBA_8888:
     return gfx::SurfaceFormat::R8G8B8A8;
   case PIXEL_FORMAT_BGRA_8888:
     return gfx::SurfaceFormat::B8G8R8A8;
   case PIXEL_FORMAT_RGBX_8888:
     return gfx::SurfaceFormat::R8G8B8X8;
   case PIXEL_FORMAT_RGB_565:
-    return gfx::SurfaceFormat::R5G6B5;
+    return gfx::SurfaceFormat::R5G6B5_UINT16;
   case HAL_PIXEL_FORMAT_YV12:
     return gfx::SurfaceFormat::YUV;
   default:
     MOZ_CRASH("Unknown gralloc pixel format");
   }
   return gfx::SurfaceFormat::R8G8B8A8;
 }
 
@@ -279,17 +279,17 @@ GrallocTextureClientOGL::AllocateForSurf
     break;
   case gfx::SurfaceFormat::R8G8B8X8:
     format = android::PIXEL_FORMAT_RGBX_8888;
     break;
   case gfx::SurfaceFormat::B8G8R8X8:
      format = android::PIXEL_FORMAT_RGBX_8888;
      mFlags |= TextureFlags::RB_SWAPPED;
     break;
-  case gfx::SurfaceFormat::R5G6B5:
+  case gfx::SurfaceFormat::R5G6B5_UINT16:
     format = android::PIXEL_FORMAT_RGB_565;
     break;
   case gfx::SurfaceFormat::YUV:
     format = HAL_PIXEL_FORMAT_YV12;
     break;
   case gfx::SurfaceFormat::A8:
     NS_WARNING("gralloc does not support gfx::SurfaceFormat::A8");
     return false;
@@ -324,17 +324,17 @@ GrallocTextureClientOGL::AllocateForGLRe
   case gfx::SurfaceFormat::B8G8R8A8:
     format = android::PIXEL_FORMAT_RGBA_8888;
     break;
   case gfx::SurfaceFormat::R8G8B8X8:
   case gfx::SurfaceFormat::B8G8R8X8:
     // there is no android BGRX format?
     format = android::PIXEL_FORMAT_RGBX_8888;
     break;
-  case gfx::SurfaceFormat::R5G6B5:
+  case gfx::SurfaceFormat::R5G6B5_UINT16:
     format = android::PIXEL_FORMAT_RGB_565;
     break;
   default:
     NS_WARNING("Unsupported surface format");
     return false;
   }
 
   return AllocateGralloc(aSize, format, usage);
--- a/gfx/layers/opengl/GrallocTextureHost.cpp
+++ b/gfx/layers/opengl/GrallocTextureHost.cpp
@@ -30,17 +30,17 @@ SurfaceFormatForAndroidPixelFormat(andro
   switch (aFormat) {
   case android::PIXEL_FORMAT_BGRA_8888:
     return swapRB ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::B8G8R8A8;
   case android::PIXEL_FORMAT_RGBA_8888:
     return swapRB ? gfx::SurfaceFormat::B8G8R8A8 : gfx::SurfaceFormat::R8G8B8A8;
   case android::PIXEL_FORMAT_RGBX_8888:
     return swapRB ? gfx::SurfaceFormat::B8G8R8X8 : gfx::SurfaceFormat::R8G8B8X8;
   case android::PIXEL_FORMAT_RGB_565:
-    return gfx::SurfaceFormat::R5G6B5;
+    return gfx::SurfaceFormat::R5G6B5_UINT16;
   case HAL_PIXEL_FORMAT_YCbCr_422_SP:
   case HAL_PIXEL_FORMAT_YCrCb_420_SP:
   case HAL_PIXEL_FORMAT_YCbCr_422_I:
   case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
   case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
   case HAL_PIXEL_FORMAT_YV12:
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
   case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
--- a/gfx/layers/opengl/OGLShaderProgram.h
+++ b/gfx/layers/opengl/OGLShaderProgram.h
@@ -244,17 +244,17 @@ ShaderConfigFromTargetAndFormat(GLenum a
                                 gfx::SurfaceFormat aFormat)
 {
   ShaderConfigOGL config;
   config.SetTextureTarget(aTarget);
   config.SetRBSwap(aFormat == gfx::SurfaceFormat::B8G8R8A8 ||
                    aFormat == gfx::SurfaceFormat::B8G8R8X8);
   config.SetNoAlpha(aFormat == gfx::SurfaceFormat::B8G8R8X8 ||
                     aFormat == gfx::SurfaceFormat::R8G8B8X8 ||
-                    aFormat == gfx::SurfaceFormat::R5G6B5);
+                    aFormat == gfx::SurfaceFormat::R5G6B5_UINT16);
   return config;
 }
 
 /**
  * This struct represents the shaders that make up a program and the uniform
  * and attribute parmeters that those shaders take.
  * It is used by ShaderProgramOGL.
  * Use the factory method GetProfileFor to create instances.
--- a/gfx/thebes/gfx2DGlue.h
+++ b/gfx/thebes/gfx2DGlue.h
@@ -83,46 +83,46 @@ inline gfxRect ThebesRect(const RectDoub
 
 inline gfxImageFormat SurfaceFormatToImageFormat(SurfaceFormat aFormat)
 {
   switch (aFormat) {
   case SurfaceFormat::B8G8R8A8:
     return gfxImageFormat::ARGB32;
   case SurfaceFormat::B8G8R8X8:
     return gfxImageFormat::RGB24;
-  case SurfaceFormat::R5G6B5:
+  case SurfaceFormat::R5G6B5_UINT16:
     return gfxImageFormat::RGB16_565;
   case SurfaceFormat::A8:
     return gfxImageFormat::A8;
   default:
     return gfxImageFormat::Unknown;
   }
 }
 
 inline SurfaceFormat ImageFormatToSurfaceFormat(gfxImageFormat aFormat)
 {
   switch (aFormat) {
   case gfxImageFormat::ARGB32:
     return SurfaceFormat::B8G8R8A8;
   case gfxImageFormat::RGB24:
     return SurfaceFormat::B8G8R8X8;
   case gfxImageFormat::RGB16_565:
-    return SurfaceFormat::R5G6B5;
+    return SurfaceFormat::R5G6B5_UINT16;
   case gfxImageFormat::A8:
     return SurfaceFormat::A8;
   default:
   case gfxImageFormat::Unknown:
     return SurfaceFormat::B8G8R8A8;
   }
 }
 
 inline gfxContentType ContentForFormat(const SurfaceFormat &aFormat)
 {
   switch (aFormat) {
-  case SurfaceFormat::R5G6B5:
+  case SurfaceFormat::R5G6B5_UINT16:
   case SurfaceFormat::B8G8R8X8:
   case SurfaceFormat::R8G8B8X8:
     return gfxContentType::COLOR;
   case SurfaceFormat::A8:
     return gfxContentType::ALPHA;
   case SurfaceFormat::B8G8R8A8:
   case SurfaceFormat::R8G8B8A8:
   default:
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1847,17 +1847,17 @@ gfxPlatform::Optimal2DFormatForContent(g
   switch (aContent) {
   case gfxContentType::COLOR:
     switch (GetOffscreenFormat()) {
     case gfxImageFormat::ARGB32:
       return mozilla::gfx::SurfaceFormat::B8G8R8A8;
     case gfxImageFormat::RGB24:
       return mozilla::gfx::SurfaceFormat::B8G8R8X8;
     case gfxImageFormat::RGB16_565:
-      return mozilla::gfx::SurfaceFormat::R5G6B5;
+      return mozilla::gfx::SurfaceFormat::R5G6B5_UINT16;
     default:
       NS_NOTREACHED("unknown gfxImageFormat for gfxContentType::COLOR");
       return mozilla::gfx::SurfaceFormat::B8G8R8A8;
     }
   case gfxContentType::ALPHA:
     return mozilla::gfx::SurfaceFormat::A8;
   case gfxContentType::COLOR_ALPHA:
     return mozilla::gfx::SurfaceFormat::B8G8R8A8;
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -68,17 +68,17 @@ void mozilla_dump_image(void* bytes, int
 {
     if (0 == strideBytes) {
         strideBytes = width * bytepp;
     }
     SurfaceFormat format;
     // TODO more flexible; parse string?
     switch (bytepp) {
     case 2:
-        format = SurfaceFormat::R5G6B5;
+        format = SurfaceFormat::R5G6B5_UINT16;
         break;
     case 4:
     default:
         format = SurfaceFormat::R8G8B8A8;
         break;
     }
 
     RefPtr<DataSourceSurface> surf =
--- a/gfx/ycbcr/YCbCrUtils.cpp
+++ b/gfx/ycbcr/YCbCrUtils.cpp
@@ -23,17 +23,17 @@ GetYCbCrToRGBDestFormatAndSize(const lay
                  aData.mCbCrSize.width,
                  aData.mCbCrSize.height);
 
   // 'prescale' is true if the scaling is to be done as part of the
   // YCbCr to RGB conversion rather than on the RGB data when rendered.
   bool prescale = aSuggestedSize.width > 0 && aSuggestedSize.height > 0 &&
                   aSuggestedSize != aData.mPicSize;
 
-  if (aSuggestedFormat == SurfaceFormat::R5G6B5) {
+  if (aSuggestedFormat == SurfaceFormat::R5G6B5_UINT16) {
 #if defined(HAVE_YCBCR_TO_RGB565)
     if (prescale &&
         !IsScaleYCbCrToRGB565Fast(aData.mPicX,
                                   aData.mPicY,
                                   aData.mPicSize.width,
                                   aData.mPicSize.height,
                                   aSuggestedSize.width,
                                   aSuggestedSize.height,
@@ -83,17 +83,17 @@ ConvertYCbCrToRGB(const layers::PlanarYC
     TypeFromSize(aData.mYSize.width,
                  aData.mYSize.height,
                  aData.mCbCrSize.width,
                  aData.mCbCrSize.height);
 
   // Convert from YCbCr to RGB now, scaling the image if needed.
   if (aDestSize != aData.mPicSize) {
 #if defined(HAVE_YCBCR_TO_RGB565)
-    if (aDestFormat == SurfaceFormat::R5G6B5) {
+    if (aDestFormat == SurfaceFormat::R5G6B5_UINT16) {
       ScaleYCbCrToRGB565(aData.mYChannel,
                          aData.mCbChannel,
                          aData.mCrChannel,
                          aDestBuffer,
                          aData.mPicX,
                          aData.mPicY,
                          aData.mPicSize.width,
                          aData.mPicSize.height,
@@ -117,17 +117,17 @@ ConvertYCbCrToRGB(const layers::PlanarYC
                         aData.mYStride,
                         aData.mCbCrStride,
                         aStride,
                         yuvtype,
                         ROTATE_0,
                         FILTER_BILINEAR);
   } else { // no prescale
 #if defined(HAVE_YCBCR_TO_RGB565)
-    if (aDestFormat == SurfaceFormat::R5G6B5) {
+    if (aDestFormat == SurfaceFormat::R5G6B5_UINT16) {
       ConvertYCbCrToRGB565(aData.mYChannel,
                            aData.mCbChannel,
                            aData.mCrChannel,
                            aDestBuffer,
                            aData.mPicX,
                            aData.mPicY,
                            aData.mPicSize.width,
                            aData.mPicSize.height,
--- a/image/imgFrame.cpp
+++ b/image/imgFrame.cpp
@@ -391,17 +391,17 @@ imgFrame::Optimize()
     // moment
   }
 
 #ifdef ANDROID
   SurfaceFormat optFormat = gfxPlatform::GetPlatform()
     ->Optimal2DFormatForContent(gfxContentType::COLOR);
 
   if (mFormat != SurfaceFormat::B8G8R8A8 &&
-      optFormat == SurfaceFormat::R5G6B5) {
+      optFormat == SurfaceFormat::R5G6B5_UINT16) {
     RefPtr<VolatileBuffer> buf =
       AllocateBufferForImage(mSize, optFormat);
     if (!buf) {
       return NS_OK;
     }
 
     RefPtr<DataSourceSurface> surf =
       CreateLockedSurface(buf, mSize, optFormat);
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -1200,17 +1200,17 @@ void MediaPipelineTransmit::PipelineList
     case SurfaceFormat::B8G8R8X8:
       rv = libyuv::ARGBToI420(static_cast<uint8*>(map.GetData()),
                               map.GetStride(),
                               yuv, size.width,
                               yuv + cb_offset, half_width,
                               yuv + cr_offset, half_width,
                               size.width, size.height);
       break;
-    case SurfaceFormat::R5G6B5:
+    case SurfaceFormat::R5G6B5_UINT16:
       rv = libyuv::RGB565ToI420(static_cast<uint8*>(map.GetData()),
                                 map.GetStride(),
                                 yuv, size.width,
                                 yuv + cb_offset, half_width,
                                 yuv + cr_offset, half_width,
                                 size.width, size.height);
       break;
     default:
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -1856,17 +1856,17 @@ AndroidBridge::CaptureZoomedView(nsIDOMW
     nscolor bgColor = NS_RGB(255, 255, 255);
     uint32_t renderDocFlags = (nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING | nsIPresShell::RENDER_DOCUMENT_RELATIVE);
     nsRect r(presContext->DevPixelsToAppUnits(zoomedViewRect.x / scaleFactor),
              presContext->DevPixelsToAppUnits(zoomedViewRect.y / scaleFactor ),
              presContext->DevPixelsToAppUnits(zoomedViewRect.width / scaleFactor ),
              presContext->DevPixelsToAppUnits(zoomedViewRect.height / scaleFactor ));
 
     bool is24bit = (GetScreenDepth() == 24);
-    SurfaceFormat format = is24bit ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::R5G6B5;
+    SurfaceFormat format = is24bit ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::R5G6B5_UINT16;
     gfxImageFormat iFormat = gfx::SurfaceFormatToImageFormat(format);
     uint32_t stride = gfxASurface::FormatStrideForWidth(iFormat, zoomedViewRect.width);
 
     uint8_t* data = static_cast<uint8_t*> (env->GetDirectBufferAddress(buffer.Get()));
     if (!data) {
         return NS_ERROR_FAILURE;
     }
 
@@ -1975,17 +1975,17 @@ nsresult AndroidBridge::CaptureThumbnail
     MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContentForType(BackendType::CAIRO),
                "Need BackendType::CAIRO support");
     RefPtr<DrawTarget> dt =
         Factory::CreateDrawTargetForData(BackendType::CAIRO,
                                          data,
                                          IntSize(bufW, bufH),
                                          stride,
                                          is24bit ? SurfaceFormat::B8G8R8X8 :
-                                                   SurfaceFormat::R5G6B5);
+                                                   SurfaceFormat::R5G6B5_UINT16);
     if (!dt) {
         ALOG_BRIDGE("Error creating DrawTarget");
         return NS_ERROR_FAILURE;
     }
     RefPtr<gfxContext> context = new gfxContext(dt);
     context->SetMatrix(
       context->CurrentMatrix().Scale(scale * bufW / srcW,
                                      scale * bufH / srcH));
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -637,17 +637,17 @@ HalFormatToSurfaceFormat(int aHalFormat)
         // Needs RB swap
         return SurfaceFormat::B8G8R8A8;
     case HAL_PIXEL_FORMAT_RGBX_8888:
         // Needs RB swap
         return SurfaceFormat::B8G8R8X8;
     case HAL_PIXEL_FORMAT_BGRA_8888:
         return SurfaceFormat::B8G8R8A8;
     case HAL_PIXEL_FORMAT_RGB_565:
-        return SurfaceFormat::R5G6B5;
+        return SurfaceFormat::R5G6B5_UINT16;
     default:
         MOZ_CRASH("Unhandled HAL pixel format");
         return SurfaceFormat::UNKNOWN; // not reached
     }
 }
 
 static bool
 NeedsRBSwap(int aHalFormat)
--- a/widget/nsShmImage.cpp
+++ b/widget/nsShmImage.cpp
@@ -107,17 +107,17 @@ nsShmImage::Create(const IntSize& aSize,
         if ((shm->mImage->red_mask == 0xff0000) &&
             (shm->mImage->green_mask == 0xff00) &&
             (shm->mImage->blue_mask == 0xff)) {
             shm->mFormat = SurfaceFormat::B8G8R8X8;
             break;
         }
         goto unsupported;
     case 16:
-        shm->mFormat = SurfaceFormat::R5G6B5;
+        shm->mFormat = SurfaceFormat::R5G6B5_UINT16;
         break;
     unsupported:
     default:
         NS_WARNING("Unsupported XShm Image format!");
         gShmAvailable = false;
         return nullptr;
     }
     return shm.forget();
--- a/widget/qt/nsClipboard.cpp
+++ b/widget/qt/nsClipboard.cpp
@@ -57,17 +57,17 @@ nsClipboard::~nsClipboard()
 static inline QImage::Format
 _moz2dformat_to_qformat(SurfaceFormat aFormat)
 {
     switch (aFormat) {
     case SurfaceFormat::B8G8R8A8:
         return QImage::Format_ARGB32_Premultiplied;
     case SurfaceFormat::B8G8R8X8:
         return QImage::Format_ARGB32;
-    case SurfaceFormat::R5G6B5:
+    case SurfaceFormat::R5G6B5_UINT16:
         return QImage::Format_RGB16;
     default:
         return QImage::Format_Invalid;
     }
 }
 
 // nsClipboard::SetNativeClipboardData ie. Copy