Bug 1530471 - remove Moz2D/thebes SkiaGL glue r=jrmuizel
authorLee Salzman <lsalzman@mozilla.com>
Thu, 28 Feb 2019 14:59:16 +0000
changeset 461777 62aabc4a65412a9f9689638cdb38584e414cc7e8
parent 461776 4b820d7d2c139589db88828b73687b380ccd3bb6
child 461778 6d0e1f99b8acd5baaa7ca194d852c48b4d79ee75
push id35629
push useropoprus@mozilla.com
push dateFri, 01 Mar 2019 05:20:57 +0000
treeherdermozilla-central@9d39099e5fc5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1530471
milestone67.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 1530471 - remove Moz2D/thebes SkiaGL glue r=jrmuizel Depends on D21052 Differential Revision: https://phabricator.services.mozilla.com/D21053
dom/canvas/test/test_canvas.html
gfx/2d/2D.h
gfx/2d/DrawTargetSkia.cpp
gfx/2d/DrawTargetSkia.h
gfx/2d/Factory.cpp
gfx/2d/SourceSurfaceSkia.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxWindowsPlatform.cpp
gfx/thebes/gfxWindowsPlatform.h
layout/tools/reftest/manifest.jsm
--- a/dom/canvas/test/test_canvas.html
+++ b/dom/canvas/test/test_canvas.html
@@ -38,27 +38,16 @@ function IsAzureSkia() {
   try {
     var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
     enabled = (backend == "skia");
   } catch (e) { }
 
   return enabled;
 }
 
-function IsAcceleratedSkia() {
-  var enabled = false;
-
-  try {
-    var props = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo();
-    enabled = props.AzureCanvasBackend == "skia" && props.AzureCanvasAccelerated;
-  } catch(e) { }
-
-  return enabled;
-}
-
 function IsAzureCairo() {
   var enabled = false;
   
   try {
     var backend = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo().AzureCanvasBackend;
     enabled = (backend == "cairo");
   } catch (e) { }
 
@@ -6580,19 +6569,16 @@ isPixel(ctx, 98,48, 0,255,0,255, 0);
 
 <p>Canvas test: 2d.gradient.radial.inside1</p>
 <canvas id="c240" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
 <script>
 
 
 function test_2d_gradient_radial_inside1() {
 
-if (IsAcceleratedSkia())
-  return;
-
 var canvas = document.getElementById('c240');
 var ctx = canvas.getContext('2d');
 
 ctx.fillStyle = '#f00';
 ctx.fillRect(0, 0, 100, 50);
 
 var g = ctx.createRadialGradient(50, 25, 100, 50, 25, 200);
 g.addColorStop(0, '#0f0');
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -61,17 +61,16 @@ struct ID3D11Texture2D;
 struct ID3D11Device;
 struct ID2D1Device;
 struct ID2D1DeviceContext;
 struct IDWriteFactory;
 struct IDWriteRenderingParams;
 struct IDWriteFontFace;
 struct IDWriteFontCollection;
 
-class GrContext;
 class SkCanvas;
 struct gfxFontStyle;
 
 struct CGContext;
 typedef struct CGContext *CGContextRef;
 
 struct CGFont;
 typedef CGFont *CGFontRef;
@@ -1503,23 +1502,16 @@ class DrawTarget : public external::Atom
    * This can be useful if the DrawTarget is wrapped around data that it does
    * not own, and for some reason the owner of the data has to make it
    * temporarily unavailable without the DrawTarget knowing about it. This can
    * cause costly surface copies, so it should not be used without a a good
    * reason.
    */
   virtual void DetachAllSnapshots() = 0;
 
-#ifdef USE_SKIA_GPU
-  virtual bool InitWithGrContext(GrContext *aGrContext, const IntSize &aSize,
-                                 SurfaceFormat aFormat) {
-    MOZ_CRASH("GFX: InitWithGrContext");
-  }
-#endif
-
  protected:
   UserData mUserData;
   Matrix mTransform;
   IntRect mOpaqueRect;
   bool mTransformDirty : 1;
   bool mPermitSubpixelAA : 1;
 
   SurfaceFormat mFormat;
@@ -1744,21 +1736,16 @@ class GFX2D_API Factory {
   static LogForwarder *GetLogForwarder() {
     return sConfig ? sConfig->mLogForwarder : nullptr;
   }
 
  private:
   static Config *sConfig;
 
  public:
-#ifdef USE_SKIA_GPU
-  static already_AddRefed<DrawTarget> CreateDrawTargetSkiaWithGrContext(
-      GrContext *aGrContext, const IntSize &aSize, SurfaceFormat aFormat);
-#endif
-
   static void PurgeAllCaches();
 
   static already_AddRefed<DrawTarget> CreateDualDrawTarget(DrawTarget *targetA,
                                                            DrawTarget *targetB);
 
   static already_AddRefed<SourceSurface> CreateDualSourceSurface(
       SourceSurface *sourceA, SourceSurface *sourceB);
 
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -24,23 +24,16 @@
 #include "Logging.h"
 #include "Tools.h"
 #include "DataSurfaceHelpers.h"
 #include "PathHelpers.h"
 #include "SourceSurfaceCapture.h"
 #include "Swizzle.h"
 #include <algorithm>
 
-#ifdef USE_SKIA_GPU
-#  include "GLDefs.h"
-#  include "skia/include/gpu/GrContext.h"
-#  include "skia/include/gpu/GrTexture.h"
-#  include "skia/include/gpu/gl/GrGLInterface.h"
-#endif
-
 #ifdef MOZ_WIDGET_COCOA
 #  include "BorrowedContext.h"
 #  include <ApplicationServices/ApplicationServices.h>
 #  include "ScaledFontMac.h"
 #  include "CGTextDrawing.h"
 #endif
 
 #ifdef XP_WIN
@@ -644,21 +637,16 @@ void DrawTargetSkia::DrawSurface(SourceS
   if (aSurfOptions.mSamplingFilter == SamplingFilter::POINT) {
     paint.mPaint.setFilterQuality(kNone_SkFilterQuality);
   }
 
   mCanvas->drawImageRect(image, sourceRect, destRect, &paint.mPaint);
 }
 
 DrawTargetType DrawTargetSkia::GetType() const {
-#ifdef USE_SKIA_GPU
-  if (mGrContext) {
-    return DrawTargetType::HARDWARE_RASTER;
-  }
-#endif
   return DrawTargetType::SOFTWARE_RASTER;
 }
 
 void DrawTargetSkia::DrawFilter(FilterNode* aNode, const Rect& aSourceRect,
                                 const Point& aDestPoint,
                                 const DrawOptions& aOptions) {
   FilterNodeSoftware* filter = static_cast<FilterNodeSoftware*>(aNode);
   filter->Draw(this, aSourceRect, aDestPoint, aOptions);
@@ -695,20 +683,19 @@ void DrawTargetSkia::DrawSurfaceWithShad
   // to blur the image ourselves.
 
   SkPaint shadowPaint;
   shadowPaint.setBlendMode(GfxOpToSkiaOp(aOperator));
 
   auto shadowDest = IntPoint::Round(aDest + aOffset);
 
   SkBitmap blurMask;
-  if (!UsingSkiaGPU() && ExtractAlphaBitmap(image, &blurMask)) {
-    // Prefer using our own box blur instead of Skia's when we're
-    // not using the GPU. It currently performs much better than
-    // SkBlurImageFilter or SkBlurMaskFilter on the CPU.
+  if (ExtractAlphaBitmap(image, &blurMask)) {
+    // Prefer using our own box blur instead of Skia's. It currently performs
+    // much better than SkBlurImageFilter or SkBlurMaskFilter on the CPU.
     AlphaBoxBlur blur(Rect(0, 0, blurMask.width(), blurMask.height()),
                       int32_t(blurMask.rowBytes()), aSigma, aSigma);
     blur.Blur(reinterpret_cast<uint8_t*>(blurMask.getPixels()));
     blurMask.notifyPixelsChanged();
 
     shadowPaint.setColor(ColorToSkColor(aColor, 1.0f));
 
     mCanvas->drawBitmap(blurMask, shadowDest.x, shadowDest.y, &shadowPaint);
@@ -1582,28 +1569,16 @@ already_AddRefed<SourceSurface> DrawTarg
   }
 
   return newSurf.forget();
 }
 
 already_AddRefed<DrawTarget> DrawTargetSkia::CreateSimilarDrawTarget(
     const IntSize& aSize, SurfaceFormat aFormat) const {
   RefPtr<DrawTargetSkia> target = new DrawTargetSkia();
-#ifdef USE_SKIA_GPU
-  if (UsingSkiaGPU()) {
-    // Try to create a GPU draw target first if we're currently using the GPU.
-    // Mark the DT as cached so that shadow DTs, extracted subrects, and similar
-    // can be reused.
-    if (target->InitWithGrContext(mGrContext.get(), aSize, aFormat, true)) {
-      return target.forget();
-    }
-    // Otherwise, just fall back to a software draw target.
-  }
-#endif
-
 #ifdef DEBUG
   if (!IsBackedByPixels(mCanvas)) {
     // If our canvas is backed by vector storage such as PDF then we want to
     // create a new DrawTarget with similar storage to avoid losing fidelity
     // (fidelity will be lost if the returned DT is Snapshot()'ed and drawn
     // back onto us since a raster will be drawn instead of vector commands).
     NS_WARNING("Not backed by pixels - we need to handle PDF backed SkCanvas");
   }
@@ -1615,67 +1590,19 @@ already_AddRefed<DrawTarget> DrawTargetS
   return target.forget();
 }
 
 bool DrawTargetSkia::CanCreateSimilarDrawTarget(const IntSize& aSize,
                                                 SurfaceFormat aFormat) const {
   return size_t(std::max(aSize.width, aSize.height)) < GetMaxSurfaceSize();
 }
 
-bool DrawTargetSkia::UsingSkiaGPU() const {
-#ifdef USE_SKIA_GPU
-  return !!mGrContext;
-#else
-  return false;
-#endif
-}
-
-#ifdef USE_SKIA_GPU
-already_AddRefed<SourceSurface> DrawTargetSkia::OptimizeGPUSourceSurface(
-    SourceSurface* aSurface) const {
-  // Check if the underlying SkImage already has an associated GrTexture.
-  sk_sp<SkImage> image = GetSkImageForSurface(aSurface);
-  if (!image || image->isTextureBacked()) {
-    RefPtr<SourceSurface> surface(aSurface);
-    return surface.forget();
-  }
-
-  // Upload the SkImage to a GrTexture otherwise.
-  sk_sp<SkImage> texture = image->makeTextureImage(mGrContext.get(), nullptr);
-  if (texture) {
-    // Create a new SourceSurfaceSkia whose SkImage contains the GrTexture.
-    RefPtr<SourceSurfaceSkia> surface = new SourceSurfaceSkia();
-    if (surface->InitFromImage(texture, aSurface->GetFormat())) {
-      return surface.forget();
-    }
-  }
-
-  // The data was too big to fit in a GrTexture.
-  if (aSurface->GetType() == SurfaceType::SKIA) {
-    // It is already a Skia source surface, so just reuse it as-is.
-    RefPtr<SourceSurface> surface(aSurface);
-    return surface.forget();
-  }
-
-  // Wrap it in a Skia source surface so that can do tiled uploads on-demand.
-  RefPtr<SourceSurfaceSkia> surface = new SourceSurfaceSkia();
-  surface->InitFromImage(image);
-  return surface.forget();
-}
-#endif
-
 already_AddRefed<SourceSurface>
 DrawTargetSkia::OptimizeSourceSurfaceForUnknownAlpha(
     SourceSurface* aSurface) const {
-#ifdef USE_SKIA_GPU
-  if (UsingSkiaGPU()) {
-    return OptimizeGPUSourceSurface(aSurface);
-  }
-#endif
-
   if (aSurface->GetType() == SurfaceType::SKIA) {
     RefPtr<SourceSurface> surface(aSurface);
     return surface.forget();
   }
 
   RefPtr<DataSourceSurface> dataSurface = aSurface->GetDataSurface();
   DataSourceSurface::ScopedMap map(dataSurface, DataSourceSurface::READ_WRITE);
 
@@ -1685,22 +1612,16 @@ DrawTargetSkia::OptimizeSourceSurfaceFor
   // writes some bad data. Luckily, this only happens on plugins.
   WriteRGBXFormat(map.GetData(), dataSurface->GetSize(), map.GetStride(),
                   dataSurface->GetFormat());
   return dataSurface.forget();
 }
 
 already_AddRefed<SourceSurface> DrawTargetSkia::OptimizeSourceSurface(
     SourceSurface* aSurface) const {
-#ifdef USE_SKIA_GPU
-  if (UsingSkiaGPU()) {
-    return OptimizeGPUSourceSurface(aSurface);
-  }
-#endif
-
   if (aSurface->GetType() == SurfaceType::SKIA) {
     RefPtr<SourceSurface> surface(aSurface);
     return surface.forget();
   }
 
   // If we're not using skia-gl then drawing doesn't require any
   // uploading, so any data surface is fine. Call GetDataSurface
   // to trigger any required readback so that it only happens
@@ -1709,58 +1630,19 @@ already_AddRefed<SourceSurface> DrawTarg
 #ifdef DEBUG
   DataSourceSurface::ScopedMap map(dataSurface, DataSourceSurface::READ);
   MOZ_ASSERT(VerifyRGBXFormat(map.GetData(), dataSurface->GetSize(),
                               map.GetStride(), dataSurface->GetFormat()));
 #endif
   return dataSurface.forget();
 }
 
-#ifdef USE_SKIA_GPU
-static inline GrGLenum GfxFormatToGrGLFormat(SurfaceFormat format) {
-  switch (format) {
-    case SurfaceFormat::B8G8R8A8:
-      return LOCAL_GL_BGRA8_EXT;
-    case SurfaceFormat::B8G8R8X8:
-      // We probably need to do something here.
-      return LOCAL_GL_BGRA8_EXT;
-    case SurfaceFormat::R5G6B5_UINT16:
-      return LOCAL_GL_RGB565;
-    case SurfaceFormat::A8:
-      return LOCAL_GL_ALPHA8;
-    default:
-      return LOCAL_GL_RGBA8;
-  }
-}
-#endif
-
 already_AddRefed<SourceSurface>
 DrawTargetSkia::CreateSourceSurfaceFromNativeSurface(
     const NativeSurface& aSurface) const {
-#ifdef USE_SKIA_GPU
-  if (aSurface.mType == NativeSurfaceType::OPENGL_TEXTURE && UsingSkiaGPU()) {
-    // Wrap the OpenGL texture id in a Skia texture handle.
-    GrGLTextureInfo texInfo;
-    texInfo.fTarget = LOCAL_GL_TEXTURE_2D;
-    texInfo.fID = (GrGLuint)(uintptr_t)aSurface.mSurface;
-    texInfo.fFormat = GfxFormatToGrGLFormat(aSurface.mFormat);
-    GrBackendTexture texDesc(aSurface.mSize.width, aSurface.mSize.height,
-                             GrMipMapped::kNo, texInfo);
-    sk_sp<SkImage> texture = SkImage::MakeFromAdoptedTexture(
-        mGrContext.get(), texDesc, kTopLeft_GrSurfaceOrigin,
-        GfxFormatToSkiaColorType(aSurface.mFormat),
-        GfxFormatToSkiaAlphaType(aSurface.mFormat));
-    RefPtr<SourceSurfaceSkia> newSurf = new SourceSurfaceSkia();
-    if (texture && newSurf->InitFromImage(texture, aSurface.mFormat)) {
-      return newSurf.forget();
-    }
-    return nullptr;
-  }
-#endif
-
   return nullptr;
 }
 
 void DrawTargetSkia::CopySurface(SourceSurface* aSurface,
                                  const IntRect& aSourceRect,
                                  const IntPoint& aDestination) {
   MarkChanged();
 
@@ -1833,65 +1715,16 @@ bool DrawTargetSkia::Init(SkCanvas* aCan
   mSize.width = size.width();
   mSize.height = size.height();
   mFormat =
       SkiaColorTypeToGfxFormat(imageInfo.colorType(), imageInfo.alphaType());
   SetPermitSubpixelAA(IsOpaque(mFormat));
   return true;
 }
 
-#ifdef USE_SKIA_GPU
-/** Indicating a DT should be cached means that space will be reserved in Skia's
- * cache for the render target at creation time, with any unused resources
- * exceeding the cache limits being purged. When the DT is freed, it will then
- * be guaranteed to be kept around for subsequent allocations until it gets
- * incidentally purged.
- *
- * If it is not marked as cached, no space will be purged to make room for the
- * render target in the cache. When the DT is freed, If there is space within
- * the resource limits it may be added to the cache, otherwise it will be freed
- * immediately if the cache is already full.
- *
- * If you want to ensure that the resources will be kept around for reuse, it is
- * better to mark them as cached. Such resources should be short-lived to ensure
- * they don't permanently tie up cache resource limits. Long-lived resources
- * should generally be left as uncached.
- *
- * In neither case will cache resource limits affect whether the resource
- * allocation succeeds. The amount of in-use GPU resources is allowed to exceed
- * the size of the cache. Thus, only hard GPU out-of-memory conditions will
- * cause resource allocation to fail.
- */
-bool DrawTargetSkia::InitWithGrContext(GrContext* aGrContext,
-                                       const IntSize& aSize,
-                                       SurfaceFormat aFormat, bool aCached) {
-  MOZ_ASSERT(aGrContext, "null GrContext");
-
-  if (size_t(std::max(aSize.width, aSize.height)) > GetMaxSurfaceSize()) {
-    return false;
-  }
-
-  // Create a GPU rendertarget/texture using the supplied GrContext.
-  // MakeRenderTarget also implicitly clears the underlying texture on creation.
-  mSurface = SkSurface::MakeRenderTarget(aGrContext, SkBudgeted(aCached),
-                                         MakeSkiaImageInfo(aSize, aFormat));
-  if (!mSurface) {
-    return false;
-  }
-
-  mGrContext = sk_ref_sp(aGrContext);
-  mSize = aSize;
-  mFormat = aFormat;
-  mCanvas = mSurface->getCanvas();
-  SetPermitSubpixelAA(IsOpaque(mFormat));
-  return true;
-}
-
-#endif
-
 bool DrawTargetSkia::Init(unsigned char* aData, const IntSize& aSize,
                           int32_t aStride, SurfaceFormat aFormat,
                           bool aUninitialized) {
   MOZ_ASSERT((aFormat != SurfaceFormat::B8G8R8X8) || aUninitialized ||
              VerifyRGBXFormat(aData, aSize, aStride, aFormat));
 
   mSurface = SkSurface::MakeRasterDirect(MakeSkiaImageInfo(aSize, aFormat),
                                          aData, aStride);
@@ -1909,26 +1742,16 @@ bool DrawTargetSkia::Init(unsigned char*
 void DrawTargetSkia::SetTransform(const Matrix& aTransform) {
   SkMatrix mat;
   GfxMatrixToSkiaMatrix(aTransform, mat);
   mCanvas->setMatrix(mat);
   mTransform = aTransform;
 }
 
 void* DrawTargetSkia::GetNativeSurface(NativeSurfaceType aType) {
-#ifdef USE_SKIA_GPU
-  if (aType == NativeSurfaceType::OPENGL_TEXTURE && mSurface) {
-    GrBackendTexture tex =
-        mSurface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess);
-    GrGLTextureInfo info;
-    if (tex.getGLTextureInfo(&info)) {
-      return (void*)(uintptr_t)info.fID;
-    }
-  }
-#endif
   return nullptr;
 }
 
 already_AddRefed<PathBuilder> DrawTargetSkia::CreatePathBuilder(
     FillRule aFillRule) const {
   return MakeAndAddRef<PathBuilderSkia>(aFillRule);
 }
 
--- a/gfx/2d/DrawTargetSkia.h
+++ b/gfx/2d/DrawTargetSkia.h
@@ -125,28 +125,16 @@ class DrawTargetSkia : public DrawTarget
   virtual void *GetNativeSurface(NativeSurfaceType aType) override;
   virtual void DetachAllSnapshots() override { MarkChanged(); }
 
   bool Init(const IntSize &aSize, SurfaceFormat aFormat);
   bool Init(unsigned char *aData, const IntSize &aSize, int32_t aStride,
             SurfaceFormat aFormat, bool aUninitialized = false);
   bool Init(SkCanvas *aCanvas);
 
-#ifdef USE_SKIA_GPU
-  bool InitWithGrContext(GrContext *aGrContext, const IntSize &aSize,
-                         SurfaceFormat aFormat, bool aCached);
-  virtual bool InitWithGrContext(GrContext *aGrContext, const IntSize &aSize,
-                                 SurfaceFormat aFormat) override {
-    return InitWithGrContext(aGrContext, aSize, aFormat, false);
-  }
-
-  already_AddRefed<SourceSurface> OptimizeGPUSourceSurface(
-      SourceSurface *aSurface) const;
-#endif
-
   // Skia assumes that texture sizes fit in 16-bit signed integers.
   static size_t GetMaxSurfaceSize() { return 32767; }
 
   operator std::string() const {
     std::stringstream stream;
     stream << "DrawTargetSkia(" << this << ")";
     return stream.str();
   }
@@ -158,30 +146,24 @@ class DrawTargetSkia : public DrawTarget
 
   bool ShouldLCDRenderText(FontType aFontType, AntialiasMode aAntialiasMode);
 
   void DrawGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer,
                   const Pattern &aPattern,
                   const StrokeOptions *aStrokeOptions = nullptr,
                   const DrawOptions &aOptions = DrawOptions());
 
-  bool UsingSkiaGPU() const;
-
   struct PushedLayer {
     PushedLayer(bool aOldPermitSubpixelAA, SourceSurface *aMask)
         : mOldPermitSubpixelAA(aOldPermitSubpixelAA), mMask(aMask) {}
     bool mOldPermitSubpixelAA;
     RefPtr<SourceSurface> mMask;
   };
   std::vector<PushedLayer> mPushedLayers;
 
-#ifdef USE_SKIA_GPU
-  sk_sp<GrContext> mGrContext;
-#endif
-
   IntSize mSize;
   sk_sp<SkSurface> mSurface;
   SkCanvas *mCanvas;
   RefPtr<SourceSurfaceSkia> mSnapshot;
   Mutex mSnapshotLock;
 
 #ifdef MOZ_WIDGET_COCOA
   friend class BorrowedCGContext;
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -915,28 +915,16 @@ already_AddRefed<ScaledFont> Factory::Cr
     IDWriteRenderingParams* aParams, Float aGamma, Float aContrast) {
   return MakeAndAddRef<ScaledFontDWrite>(aFontFace, aUnscaledFont, aSize,
                                          aUseEmbeddedBitmap, aForceGDIMode,
                                          aParams, aGamma, aContrast, aStyle);
 }
 
 #endif  // WIN32
 
-#ifdef USE_SKIA_GPU
-already_AddRefed<DrawTarget> Factory::CreateDrawTargetSkiaWithGrContext(
-    GrContext* aGrContext, const IntSize& aSize, SurfaceFormat aFormat) {
-  RefPtr<DrawTarget> newTarget = new DrawTargetSkia();
-  if (!newTarget->InitWithGrContext(aGrContext, aSize, aFormat)) {
-    return nullptr;
-  }
-  return newTarget.forget();
-}
-
-#endif  // USE_SKIA_GPU
-
 #ifdef USE_SKIA
 already_AddRefed<DrawTarget> Factory::CreateDrawTargetWithSkCanvas(
     SkCanvas* aCanvas) {
   RefPtr<DrawTargetSkia> newTarget = new DrawTargetSkia();
   if (!newTarget->Init(aCanvas)) {
     return nullptr;
   }
   return newTarget.forget();
--- a/gfx/2d/SourceSurfaceSkia.cpp
+++ b/gfx/2d/SourceSurfaceSkia.cpp
@@ -120,26 +120,16 @@ bool SourceSurfaceSkia::InitFromImage(co
 
   return true;
 }
 
 uint8_t* SourceSurfaceSkia::GetData() {
   if (!mImage) {
     return nullptr;
   }
-#ifdef USE_SKIA_GPU
-  if (mImage->isTextureBacked()) {
-    if (sk_sp<SkImage> raster =
-            ReadSkImage(mImage, MakeSkiaImageInfo(mSize, mFormat), mStride)) {
-      mImage = raster;
-    } else {
-      gfxCriticalError() << "Failed making Skia raster image for GPU surface";
-    }
-  }
-#endif
   SkPixmap pixmap;
   if (!mImage->peekPixels(&pixmap)) {
     gfxCriticalError() << "Failed accessing pixels for Skia raster image";
   }
   return reinterpret_cast<uint8_t*>(pixmap.writable_addr());
 }
 
 bool SourceSurfaceSkia::Map(MapType, MappedSurface* aMappedSurface) {
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -104,36 +104,27 @@
 #include "mozilla/gfx/Logging.h"
 
 #ifdef USE_SKIA
 #  ifdef __GNUC__
 #    pragma GCC diagnostic push
 #    pragma GCC diagnostic ignored "-Wshadow"
 #  endif
 #  include "skia/include/core/SkGraphics.h"
-#  ifdef USE_SKIA_GPU
-#    include "skia/include/gpu/GrContext.h"
-#    include "skia/include/gpu/gl/GrGLInterface.h"
-#    include "SkiaGLGlue.h"
-#  endif
 #  ifdef MOZ_ENABLE_FREETYPE
 #    include "skia/include/ports/SkTypeface_cairo.h"
 #  endif
 #  include "mozilla/gfx/SkMemoryReporter.h"
 #  ifdef __GNUC__
 #    pragma GCC diagnostic pop  // -Wshadow
 #  endif
 static const uint32_t kDefaultGlyphCacheSize = -1;
 
 #endif
 
-#if !defined(USE_SKIA) || !defined(USE_SKIA_GPU)
-class mozilla::gl::SkiaGLGlue : public GenericAtomicRefCounted {};
-#endif
-
 #include "mozilla/Preferences.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Mutex.h"
 
 #include "nsAlgorithm.h"
 #include "nsIGfxInfo.h"
@@ -443,17 +434,16 @@ static void FontPrefChanged(const char* 
   gfxPlatform::GetPlatform()->FontsPrefsChanged(aPref);
 }
 
 void gfxPlatform::OnMemoryPressure(layers::MemoryPressureReason aWhy) {
   Factory::PurgeAllCaches();
   gfxGradientCache::PurgeAllCaches();
   gfxFontMissingGlyphs::Purge();
   PurgeSkiaFontCache();
-  PurgeSkiaGPUCache();
   if (XRE_IsParentProcess()) {
     layers::CompositorManagerChild* manager =
         CompositorManagerChild::GetInstance();
     if (manager) {
       manager->SendNotifyMemoryPressure();
     }
   }
 }
@@ -470,18 +460,16 @@ gfxPlatform::gfxPlatform()
   mFallbackUsesCmaps = UNINITIALIZED_VALUE;
 
   mWordCacheCharLimit = UNINITIALIZED_VALUE;
   mWordCacheMaxEntries = UNINITIALIZED_VALUE;
   mGraphiteShapingEnabled = UNINITIALIZED_VALUE;
   mOpenTypeSVGEnabled = UNINITIALIZED_VALUE;
   mBidiNumeralOption = UNINITIALIZED_VALUE;
 
-  mSkiaGlue = nullptr;
-
   InitBackendPrefs(GetBackendPrefs());
 
   mTotalSystemMemory = PR_GetPhysicalMemorySize();
 
   VRManager::ManagerInit();
 }
 
 gfxPlatform* gfxPlatform::GetPlatform() {
@@ -1180,17 +1168,16 @@ void gfxPlatform::Shutdown() {
   Preferences::UnregisterPrefixCallbacks(FontPrefChanged, kObservedPrefs);
 
   NS_ASSERTION(gPlatform->mMemoryPressureObserver,
                "mMemoryPressureObserver has already gone");
   if (gPlatform->mMemoryPressureObserver) {
     gPlatform->mMemoryPressureObserver->Unregister();
     gPlatform->mMemoryPressureObserver = nullptr;
   }
-  gPlatform->mSkiaGlue = nullptr;
 
   if (XRE_IsParentProcess()) {
     gPlatform->mVsyncSource->Shutdown();
   }
 
   gPlatform->mVsyncSource = nullptr;
 
   // Shut down the default GL context provider.
@@ -1560,148 +1547,28 @@ void gfxPlatform::PopulateScreenInfo() {
   screen->GetRect(&left, &top, &mScreenSize.width, &mScreenSize.height);
 }
 
 bool gfxPlatform::SupportsAzureContentForDrawTarget(DrawTarget* aTarget) {
   if (!aTarget || !aTarget->IsValid()) {
     return false;
   }
 
-#ifdef USE_SKIA_GPU
-  // Skia content rendering doesn't support GPU acceleration, so we can't
-  // use the same backend if the current backend is accelerated.
-  if ((aTarget->GetType() == DrawTargetType::HARDWARE_RASTER) &&
-      (aTarget->GetBackendType() == BackendType::SKIA)) {
-    return false;
-  }
-#endif
-
   return SupportsAzureContentForType(aTarget->GetBackendType());
 }
 
-bool gfxPlatform::AllowOpenGLCanvas() {
-  // For now, only allow Skia+OpenGL, unless it's blocked.
-  // Allow acceleration on Skia if the preference is set, unless it's blocked
-  // as long as we have the accelerated layers
-
-  // The compositor backend is only set correctly in the parent process,
-  // so we let content process always assume correct compositor backend.
-  // The callers have to do the right thing.
-  //
-  // XXX Disable SkiaGL on WebRender, since there is a case that R8G8B8X8
-  // is used, but WebRender does not support R8G8B8X8.
-  bool correctBackend =
-      !XRE_IsParentProcess() ||
-      (mCompositorBackend == LayersBackend::LAYERS_OPENGL &&
-       (GetContentBackendFor(mCompositorBackend) == BackendType::SKIA));
-
-  if (gfxPrefs::CanvasAzureAccelerated() && correctBackend) {
-    nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
-    int32_t status;
-    nsCString discardFailureId;
-    return !gfxInfo || (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(
-                            nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION,
-                            discardFailureId, &status)) &&
-                        status == nsIGfxInfo::FEATURE_STATUS_OK);
-  }
-  return false;
-}
-
-void gfxPlatform::InitializeSkiaCacheLimits() {
-  if (AllowOpenGLCanvas()) {
-#ifdef USE_SKIA_GPU
-    bool usingDynamicCache = gfxPrefs::CanvasSkiaGLDynamicCache();
-    int cacheItemLimit = gfxPrefs::CanvasSkiaGLCacheItems();
-    uint64_t cacheSizeLimit =
-        std::max(gfxPrefs::CanvasSkiaGLCacheSize(), (int32_t)0);
-
-    // Prefs are in megabytes, but we want the sizes in bytes
-    cacheSizeLimit *= 1024 * 1024;
-
-    if (usingDynamicCache) {
-      if (mTotalSystemMemory < 512 * 1024 * 1024) {
-        // We need a very minimal cache on anything smaller than 512mb.
-        // Note the large jump as we cross 512mb (from 2mb to 32mb).
-        cacheSizeLimit = 2 * 1024 * 1024;
-      } else if (mTotalSystemMemory > 0) {
-        cacheSizeLimit = mTotalSystemMemory / 16;
-      }
-    }
-
-    // Ensure cache size doesn't overflow on 32-bit platforms.
-    cacheSizeLimit = std::min(cacheSizeLimit, (uint64_t)SIZE_MAX);
-
-#  ifdef DEBUG
-    printf_stderr("Determined SkiaGL cache limits: Size %" PRIu64
-                  ", Items: %i\n",
-                  cacheSizeLimit, cacheItemLimit);
-#  endif
-
-    mSkiaGlue->GetGrContext()->setResourceCacheLimits(cacheItemLimit,
-                                                      (size_t)cacheSizeLimit);
-#endif
-  }
-}
-
-SkiaGLGlue* gfxPlatform::GetSkiaGLGlue() {
-#ifdef USE_SKIA_GPU
-  // Check the accelerated Canvas is enabled for the first time,
-  // because the callers should check it before using.
-  if (!mSkiaGlue && !AllowOpenGLCanvas()) {
-    return nullptr;
-  }
-
-  if (!mSkiaGlue) {
-    /* Dummy context. We always draw into a FBO.
-     *
-     * FIXME: This should be stored in TLS or something, since there needs to be
-     * one for each thread using it. As it stands, this only works on the main
-     * thread.
-     */
-    RefPtr<GLContext> glContext;
-    nsCString discardFailureId;
-    glContext = GLContextProvider::CreateHeadless(
-        CreateContextFlags::REQUIRE_COMPAT_PROFILE |
-            CreateContextFlags::ALLOW_OFFLINE_RENDERER,
-        &discardFailureId);
-    if (!glContext) {
-      printf_stderr("Failed to create GLContext for SkiaGL!\n");
-      return nullptr;
-    }
-    mSkiaGlue = new SkiaGLGlue(glContext);
-    MOZ_ASSERT(mSkiaGlue->GetGrContext(), "No GrContext");
-    InitializeSkiaCacheLimits();
-  }
-#endif
-
-  return mSkiaGlue;
-}
-
 void gfxPlatform::PurgeSkiaFontCache() {
 #ifdef USE_SKIA
   if (gfxPlatform::GetPlatform()->GetDefaultContentBackend() ==
       BackendType::SKIA) {
     SkGraphics::PurgeFontCache();
   }
 #endif
 }
 
-void gfxPlatform::PurgeSkiaGPUCache() {
-#ifdef USE_SKIA_GPU
-  if (!mSkiaGlue) return;
-
-  mSkiaGlue->GetGrContext()->freeGpuResources();
-  // GrContext::flush() doesn't call glFlush. Call it here.
-  mSkiaGlue->GetGLContext()->MakeCurrent();
-  mSkiaGlue->GetGLContext()->fFlush();
-#endif
-}
-
-bool gfxPlatform::HasEnoughTotalSystemMemoryForSkiaGL() { return true; }
-
 already_AddRefed<DrawTarget> gfxPlatform::CreateDrawTargetForBackend(
     BackendType aBackend, const IntSize& aSize, SurfaceFormat aFormat) {
   // There is a bunch of knowledge in the gfxPlatform heirarchy about how to
   // create the best offscreen surface for the current system and situation. We
   // can easily take advantage of this for the Cairo backend, so that's what we
   // do.
   // mozilla::gfx::Factory can get away without having all this knowledge for
   // now, but this might need to change in the future (using
@@ -3109,18 +2976,16 @@ void gfxPlatform::GetAzureBackendInfo(mo
     aObj.DefineProperty("AzureContentBackend", GetBackendName(contentBackend));
   } else {
     aObj.DefineProperty("AzureCanvasBackend",
                         GetBackendName(mPreferredCanvasBackend));
     aObj.DefineProperty("AzureFallbackCanvasBackend",
                         GetBackendName(mFallbackCanvasBackend));
     aObj.DefineProperty("AzureContentBackend", GetBackendName(mContentBackend));
   }
-
-  aObj.DefineProperty("AzureCanvasAccelerated", AllowOpenGLCanvas());
 }
 
 void gfxPlatform::GetApzSupportInfo(mozilla::widget::InfoObject& aObj) {
   if (!gfxPlatform::AsyncPanZoomEnabled()) {
     return;
   }
 
   if (SupportsApzWheelInput()) {
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -39,19 +39,16 @@ class gfxTextRun;
 class nsIURI;
 class nsAtom;
 class nsIObserver;
 class SRGBOverrideObserver;
 class gfxTextPerfMetrics;
 typedef struct FT_LibraryRec_* FT_Library;
 
 namespace mozilla {
-namespace gl {
-class SkiaGLGlue;
-}  // namespace gl
 namespace layers {
 class FrameStats;
 }
 namespace gfx {
 class DrawTarget;
 class SourceSurface;
 class DataSourceSurface;
 class ScaledFont;
@@ -271,25 +268,16 @@ class gfxPlatform : public mozilla::laye
    * will return false.
    */
   bool SupportsAzureContentForDrawTarget(mozilla::gfx::DrawTarget* aTarget);
 
   bool SupportsAzureContentForType(mozilla::gfx::BackendType aType) {
     return BackendTypeBit(aType) & mContentBackendBitmask;
   }
 
-  /// This function also lets us know if the current preferences/platform
-  /// combination allows for both accelerated and not accelerated canvas
-  /// implementations.  If it does, and other relevant preferences are
-  /// asking for it, we will examine the commands in the first few seconds
-  /// of the canvas usage, and potentially change to accelerated or
-  /// non-accelerated canvas.
-  virtual bool AllowOpenGLCanvas();
-  virtual void InitializeSkiaCacheLimits();
-
   static bool AsyncPanZoomEnabled();
 
   virtual void GetAzureBackendInfo(mozilla::widget::InfoObject& aObj);
   void GetApzSupportInfo(mozilla::widget::InfoObject& aObj);
   void GetTilesSupportInfo(mozilla::widget::InfoObject& aObj);
   void GetFrameStats(mozilla::widget::InfoObject& aObj);
 
   // Get the default content backend that will be used with the default
@@ -610,24 +598,20 @@ class gfxPlatform : public mozilla::laye
   int GetScreenDepth() const { return mScreenDepth; }
   mozilla::gfx::IntSize GetScreenSize() const { return mScreenSize; }
 
   /**
    * Return the layer debugging options to use browser-wide.
    */
   mozilla::layers::DiagnosticTypes GetLayerDiagnosticTypes();
 
-  mozilla::gl::SkiaGLGlue* GetSkiaGLGlue();
-  void PurgeSkiaGPUCache();
   static void PurgeSkiaFontCache();
 
   static bool UsesOffMainThreadCompositing();
 
-  bool HasEnoughTotalSystemMemoryForSkiaGL();
-
   /**
    * Whether we want to adjust gfx parameters (currently just
    * the framerate and whether we use software vs. hardware vsync)
    * down because we've determined we're on a low-end machine.
    * This will return false if the user has turned on fingerprinting
    * resistance (to ensure consistent behavior across devices).
    */
   static bool ShouldAdjustForLowEndMachine();
@@ -929,17 +913,16 @@ class gfxPlatform : public mozilla::laye
   mozilla::widget::GfxInfoCollector<gfxPlatform> mAzureCanvasBackendCollector;
   mozilla::widget::GfxInfoCollector<gfxPlatform> mApzSupportCollector;
   mozilla::widget::GfxInfoCollector<gfxPlatform> mTilesInfoCollector;
   mozilla::widget::GfxInfoCollector<gfxPlatform> mFrameStatsCollector;
 
   nsTArray<mozilla::layers::FrameStats> mFrameStats;
 
   RefPtr<mozilla::gfx::DrawEventRecorder> mRecorder;
-  RefPtr<mozilla::gl::SkiaGLGlue> mSkiaGlue;
 
   // Backend that we are compositing with. NONE, if no compositor has been
   // created yet.
   mozilla::layers::LayersBackend mCompositorBackend;
 
   int32_t mScreenDepth;
   mozilla::gfx::IntSize mScreenSize;
 
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -580,21 +580,16 @@ void gfxWindowsPlatform::UpdateRenderMod
           << ", content:" << int(GetDefaultContentBackend())
           << ", compositor:" << int(GetCompositorBackend());
       MOZ_CRASH(
           "GFX: Failed to update reference draw target after device reset");
     }
   }
 }
 
-bool gfxWindowsPlatform::AllowOpenGLCanvas() {
-  // OpenGL canvas is not supported on windows
-  return false;
-}
-
 mozilla::gfx::BackendType gfxWindowsPlatform::GetContentBackendFor(
     mozilla::layers::LayersBackend aLayers) {
   mozilla::gfx::BackendType defaultBackend =
       gfxPlatform::GetDefaultContentBackend();
   if (aLayers == LayersBackend::LAYERS_D3D11) {
     return defaultBackend;
   }
 
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -162,18 +162,16 @@ class gfxWindowsPlatform : public gfxPla
 
   virtual void CompositorUpdated() override;
 
   bool DidRenderingDeviceReset(
       DeviceResetReason* aResetReason = nullptr) override;
   void SchedulePaintIfDeviceReset() override;
   void CheckForContentOnlyDeviceReset();
 
-  bool AllowOpenGLCanvas() override;
-
   mozilla::gfx::BackendType GetContentBackendFor(
       mozilla::layers::LayersBackend aLayers) override;
 
   mozilla::gfx::BackendType GetPreferredCanvasBackend() override;
 
   static void GetDLLVersion(char16ptr_t aDLLPath, nsAString& aVersion);
 
   // returns ClearType tuning information for each display
--- a/layout/tools/reftest/manifest.jsm
+++ b/layout/tools/reftest/manifest.jsm
@@ -421,23 +421,22 @@ function BuildConditionSandbox(aURL) {
     } catch (e) {
       sandbox.d2d = false;
       sandbox.dwrite = false;
     }
 
     var info = gfxInfo.getInfo();
     var canvasBackend = readGfxInfo(info, "AzureCanvasBackend");
     var contentBackend = readGfxInfo(info, "AzureContentBackend");
-    var canvasAccelerated = readGfxInfo(info, "AzureCanvasAccelerated");
 
     sandbox.gpuProcess = gfxInfo.usingGPUProcess;
     sandbox.azureCairo = canvasBackend == "cairo";
     sandbox.azureSkia = canvasBackend == "skia";
     sandbox.skiaContent = contentBackend == "skia";
-    sandbox.azureSkiaGL = canvasAccelerated; // FIXME: assumes GL right now
+    sandbox.azureSkiaGL = false;
     // true if we are using the same Azure backend for rendering canvas and content
     sandbox.contentSameGfxBackendAsCanvas = contentBackend == canvasBackend
                                             || (contentBackend == "none" && canvasBackend == "cairo");
 
     sandbox.layersGPUAccelerated =
       g.windowUtils.layerManagerType != "Basic";
     sandbox.d3d11 =
       g.windowUtils.layerManagerType == "Direct3D 11";