diff -r a706de1d48c0 -r 2bff8947a1af gfx/2d/DrawTargetCairo.cpp
--- a/gfx/2d/DrawTargetCairo.cpp	Mon Jul 06 19:51:22 2015 -0400
+++ b/gfx/2d/DrawTargetCairo.cpp	Mon Jul 06 20:19:56 2015 -0400
@@ -675,6 +675,23 @@
   return mSize;
 }
 
+SurfaceFormat
+GfxFormatForCairoSurface(cairo_surface_t* surface)
+{
+  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;
+  }
+#endif
+  return CairoContentToGfxFormat(cairo_surface_get_content(surface));
+}
+
 already_AddRefed<SourceSurface>
 DrawTargetCairo::Snapshot()
 {
diff -r a706de1d48c0 -r 2bff8947a1af gfx/2d/HelpersCairo.h
--- a/gfx/2d/HelpersCairo.h	Mon Jul 06 19:51:22 2015 -0400
+++ b/gfx/2d/HelpersCairo.h	Mon Jul 06 20:19:56 2015 -0400
@@ -234,15 +234,7 @@
   }
 }
 
-static inline SurfaceFormat
-GfxFormatForCairoSurface(cairo_surface_t* surface)
-{
-  if (cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_IMAGE) {
-    return CairoFormatToGfxFormat(cairo_image_surface_get_format(surface));
-  }
-
-  return CairoContentToGfxFormat(cairo_surface_get_content(surface));
-}
+SurfaceFormat GfxFormatForCairoSurface(cairo_surface_t* surface);
 
 static inline void
 GfxMatrixToCairoMatrix(const Matrix& mat, cairo_matrix_t& retval)
