Backed out 3 changesets (bug 1486659) as requested by jhlin on irc for breaking video playback on Android and causing regression Bug 1510464. a=backout
authorBrindusan Cristian <cbrindusan@mozilla.com>
Wed, 28 Nov 2018 19:09:13 +0200
changeset 504911 4a3f88e3629875813584f135f9e250b82eb4aa48
parent 504910 5c66354bff282452a6f1a3c911fa8756b6e752af
child 504928 e374d095d1e2d4c5d9c7c1cc412bb1798149d003
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1486659, 1510464
milestone65.0a1
backs out9c2834ca8823472c042a7c9bf10e06fadc5ee692
5d897c0c7a25a155fae7347954d8dc9b58bb5703
b0fdcebfd20dd1319ea589ec79afc7dcad8a6c85
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
Backed out 3 changesets (bug 1486659) as requested by jhlin on irc for breaking video playback on Android and causing regression Bug 1510464. a=backout Backed out changeset 9c2834ca8823 (bug 1486659) Backed out changeset 5d897c0c7a25 (bug 1486659) Backed out changeset b0fdcebfd20d (bug 1486659)
dom/media/platforms/android/RemoteDataDecoder.cpp
gfx/gl/AndroidSurfaceTexture.cpp
gfx/gl/AndroidSurfaceTexture.h
gfx/gl/SharedSurfaceEGL.cpp
gfx/layers/opengl/TextureClientOGL.cpp
mobile/android/geckoview/src/main/aidl/org/mozilla/gecko/gfx/ISurfaceAllocator.aidl
mobile/android/geckoview/src/main/aidl/org/mozilla/gecko/gfx/SyncConfig.aidl
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurface.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocator.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocatorService.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SyncConfig.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/SharedMemory.java
widget/android/nsAppShell.cpp
--- a/dom/media/platforms/android/RemoteDataDecoder.cpp
+++ b/dom/media/platforms/android/RemoteDataDecoder.cpp
@@ -114,17 +114,17 @@ class RemoteVideoDecoder : public Remote
       bool isEOS = !!(flags & MediaCodec::BUFFER_FLAG_END_OF_STREAM);
       if (!ok && !isEOS) {
         // Ignore output with no corresponding input.
         return;
       }
 
       if (ok && (size > 0 || presentationTimeUs >= 0)) {
         RefPtr<layers::Image> img = new SurfaceTextureImage(
-            mDecoder->mImageHandle, inputInfo.mImageSize,
+            mDecoder->mSurfaceHandle, inputInfo.mImageSize,
             false /* NOT continuous */, gl::OriginPos::BottomLeft);
 
         RefPtr<VideoData> v = VideoData::CreateFromImage(
             inputInfo.mDisplaySize, offset,
             TimeUnit::FromMicroseconds(presentationTimeUs),
             TimeUnit::FromMicroseconds(inputInfo.mDurationUs), img,
             !!(flags & MediaCodec::BUFFER_FLAG_SYNC_FRAME),
             TimeUnit::FromMicroseconds(presentationTimeUs));
@@ -163,17 +163,17 @@ class RemoteVideoDecoder : public Remote
   RefPtr<InitPromise> Init() override {
     mSurface = GeckoSurface::LocalRef(SurfaceAllocator::AcquireSurface(
         mConfig.mImage.width, mConfig.mImage.height, false));
     if (!mSurface) {
       return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR,
                                           __func__);
     }
 
-    mImageHandle = mSurface->GetImageHandle();
+    mSurfaceHandle = mSurface->GetHandle();
 
     // Register native methods.
     JavaCallbacksSupport::Init();
 
     mJavaCallbacks = CodecProxy::NativeCallbacks::New();
     JavaCallbacksSupport::AttachNative(
         mJavaCallbacks, mozilla::MakeUnique<CallbacksSupport>(this));
 
@@ -251,17 +251,17 @@ class RemoteVideoDecoder : public Remote
 
   ConversionRequired NeedsConversion() const override {
     return ConversionRequired::kNeedAnnexB;
   }
 
  private:
   const VideoInfo mConfig;
   GeckoSurface::GlobalRef mSurface;
-  AndroidSurfaceTextureHandle mImageHandle;
+  AndroidSurfaceTextureHandle mSurfaceHandle;
   // Only accessed on reader's task queue.
   bool mIsCodecSupportAdaptivePlayback = false;
   // Can be accessed on any thread, but only written on during init.
   bool mIsHardwareAccelerated = false;
   // Accessed on mTaskQueue, reader's TaskQueue and Java callback tread.
   // SimpleMap however is thread-safe, so it's okay to do so.
   SimpleMap<InputInfo> mInputInfos;
   // Only accessed on the TaskQueue.
--- a/gfx/gl/AndroidSurfaceTexture.cpp
+++ b/gfx/gl/AndroidSurfaceTexture.cpp
@@ -3,23 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifdef MOZ_WIDGET_ANDROID
 
 #include "AndroidSurfaceTexture.h"
 
-#include "GeneratedJNINatives.h"
-
-#include "AndroidNativeWindow.h"
-#include "GLContextEGL.h"
-#include "GLBlitHelper.h"
-#include "GLImages.h"
-
 using namespace mozilla;
 
 namespace mozilla {
 namespace gl {
 
 void
 AndroidSurfaceTexture::GetTransformMatrix(java::sdk::SurfaceTexture::Param surfaceTexture,
                                           gfx::Matrix4x4* outMatrix)
@@ -31,189 +24,11 @@ AndroidSurfaceTexture::GetTransformMatri
 
   jfloat* array = env->GetFloatArrayElements(jarray.Get(), nullptr);
 
   memcpy(&(outMatrix->_11), array, sizeof(float)*16);
 
   env->ReleaseFloatArrayElements(jarray.Get(), array, 0);
 }
 
-class SharedGL {
-public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedGL);
-
-  SharedGL(AndroidNativeWindow& window)
-  {
-    MutexAutoLock lock(sMutex);
-
-    if (!sContext) {
-      MOZ_ASSERT(sInstanceCount == 0);
-      sContext = CreateContext();
-      if (!sContext) {
-        return;
-      }
-    }
-
-    InitSurface(window);
-    ++sInstanceCount;
-  }
-
-  void Blit(const AndroidSurfaceTextureHandle& sourceTextureHandle,
-            const gfx::IntSize& imageSize)
-  {
-    MutexAutoLock lock(sMutex);
-    MOZ_ASSERT(sContext);
-
-    // Setting overide also makes conext and surface current.
-    sContext->SetEGLSurfaceOverride(mTargetSurface);
-    RefPtr<layers::SurfaceTextureImage> img =
-      new layers::SurfaceTextureImage(sourceTextureHandle,
-                                      imageSize,
-                                      false,
-                                      OriginPos::TopLeft);
-    sContext->BlitHelper()->BlitImage(img, imageSize, OriginPos::BottomLeft);
-    sContext->SwapBuffers();
-    // This method is called through binder IPC and could run on any thread in
-    // the pool. Release the context and surface from this thread after use so
-    // they can be bound to another thread later.
-    UnmakeCurrent(sContext);
-  }
-
-private:
-  ~SharedGL()
-  {
-    MutexAutoLock lock(sMutex);
-
-    if (mTargetSurface != EGL_NO_SURFACE) {
-      GLLibraryEGL::Get()->fDestroySurface(EGL_DISPLAY(), mTargetSurface);
-    }
-
-    // Destroy shared GL context when no one uses it.
-    if (--sInstanceCount == 0) {
-      sContext.reset();
-    }
-  }
-
-  static UniquePtr<GLContextEGL> CreateContext()
-  {
-    sMutex.AssertCurrentThreadOwns();
-    MOZ_ASSERT(!sContext);
-
-    auto* egl = gl::GLLibraryEGL::Get();
-    EGLDisplay eglDisplay = egl->fGetDisplay(EGL_DEFAULT_DISPLAY);
-    EGLConfig eglConfig;
-    CreateConfig(&eglConfig, /* bpp */ 24, /* depth buffer? */ false);
-    EGLint attributes[] = {
-      LOCAL_EGL_CONTEXT_CLIENT_VERSION, 2,
-      LOCAL_EGL_NONE
-    };
-    EGLContext eglContext =
-      egl->fCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, attributes);
-    UniquePtr<GLContextEGL> gl = MakeUnique<GLContextEGL>(CreateContextFlags::NONE,
-                                                          SurfaceCaps::Any(),
-                                                          /* offscreen? */ false,
-                                                          eglConfig,
-                                                          EGL_NO_SURFACE,
-                                                          eglContext);
-    if (!gl->Init()) {
-      NS_WARNING("Fail to create GL context for native blitter.");
-      return nullptr;
-    }
-
-    // Yield the current state made in constructor.
-    UnmakeCurrent(gl);
-    return gl;
-  }
-
-  void InitSurface(AndroidNativeWindow& window)
-  {
-    sMutex.AssertCurrentThreadOwns();
-    MOZ_ASSERT(sContext);
-
-    mTargetSurface = gl::GLLibraryEGL::Get()->fCreateWindowSurface(sContext->GetEGLDisplay(),
-                                                                   sContext->mConfig,
-                                                                   window.NativeWindow(),
-                                                                   0);
-  }
-
-  static bool UnmakeCurrent(UniquePtr<GLContextEGL>& gl)
-  {
-    sMutex.AssertCurrentThreadOwns();
-    MOZ_ASSERT(gl);
-
-    if (!gl->IsCurrent()) {
-      return true;
-    }
-
-    return  gl::GLLibraryEGL::Get()->fMakeCurrent(EGL_DISPLAY(),
-                                                  EGL_NO_SURFACE,
-                                                  EGL_NO_SURFACE,
-                                                  EGL_NO_CONTEXT);
-  }
-
-  static Mutex sMutex;
-  static UniquePtr<GLContextEGL> sContext;
-  static size_t sInstanceCount;
-
-  EGLSurface mTargetSurface;
-};
-
-Mutex SharedGL::sMutex("SharedGLContext::sMutex");
-UniquePtr<GLContextEGL> SharedGL::sContext(nullptr);
-size_t SharedGL::sInstanceCount = 0;
-
-class GLBlitterSupport final
-  : public java::GeckoSurfaceTexture::NativeGLBlitHelper::Natives<GLBlitterSupport>
-{
-public:
-  using Base = java::GeckoSurfaceTexture::NativeGLBlitHelper::Natives<GLBlitterSupport>;
-  using Base::AttachNative;
-  using Base::GetNative;
-  using Base::DisposeNative;
-
-  static java::GeckoSurfaceTexture::NativeGLBlitHelper::LocalRef
-  Create(jint sourceTextureHandle,
-         jni::Object::Param targetSurface,
-         jint width,
-         jint height)
-  {
-    AndroidNativeWindow win(java::GeckoSurface::Ref::From(targetSurface));
-    auto helper = java::GeckoSurfaceTexture::NativeGLBlitHelper::New();
-    RefPtr<SharedGL> gl = new SharedGL(win);
-    GLBlitterSupport::AttachNative(
-      helper,
-      MakeUnique<GLBlitterSupport>(std::move(gl),
-                                   sourceTextureHandle,
-                                   width,
-                                   height));
-    return helper;
-  }
-
-  GLBlitterSupport(RefPtr<SharedGL>&& gl,
-                   jint sourceTextureHandle,
-                   jint width,
-                   jint height)
-    : mGl(gl)
-    , mSourceTextureHandle(sourceTextureHandle)
-    , mSize(width, height)
-  {
-  }
-
-  void Blit()
-  {
-    mGl->Blit(mSourceTextureHandle, mSize);
-  }
-
-private:
-  const RefPtr<SharedGL> mGl;
-  const AndroidSurfaceTextureHandle mSourceTextureHandle;
-  const gfx::IntSize mSize;
-};
-
-void
-AndroidSurfaceTexture::Init()
-{
-  GLBlitterSupport::Init();
-}
-
 } // gl
 } // mozilla
 #endif // MOZ_WIDGET_ANDROID
--- a/gfx/gl/AndroidSurfaceTexture.h
+++ b/gfx/gl/AndroidSurfaceTexture.h
@@ -13,17 +13,16 @@
 
 typedef uint32_t AndroidSurfaceTextureHandle;
 
 namespace mozilla {
 namespace gl {
 
 class AndroidSurfaceTexture {
 public:
-  static void Init();
   static void GetTransformMatrix(java::sdk::SurfaceTexture::Param surfaceTexture,
                                  mozilla::gfx::Matrix4x4* outMatrix);
 
 };
 
 } // gl
 } // mozilla
 
--- a/gfx/gl/SharedSurfaceEGL.cpp
+++ b/gfx/gl/SharedSurfaceEGL.cpp
@@ -275,17 +275,17 @@ bool
 SharedSurface_SurfaceTexture::IsBufferAvailable() const {
     return mSurface->GetAvailable();
 }
 
 bool
 SharedSurface_SurfaceTexture::ToSurfaceDescriptor(layers::SurfaceDescriptor* const out_descriptor)
 {
     *out_descriptor =
-        layers::SurfaceTextureDescriptor(mSurface->GetImageHandle(),
+        layers::SurfaceTextureDescriptor(mSurface->GetHandle(),
                                          mSize,
                                          gfx::SurfaceFormat::R8G8B8A8,
                                          false /* NOT continuous */,
                                          false /* Do not ignore transform */);
     return true;
 }
 
 ////////////////////////////////////////////////////////////////////////
--- a/gfx/layers/opengl/TextureClientOGL.cpp
+++ b/gfx/layers/opengl/TextureClientOGL.cpp
@@ -165,17 +165,17 @@ AndroidNativeWindowTextureData::FillInfo
   aInfo.supportsMoz2D = true;
   aInfo.canExposeMappedData = false;
   aInfo.canConcurrentlyReadLock = false;
 }
 
 bool
 AndroidNativeWindowTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
 {
-  aOutDescriptor = SurfaceTextureDescriptor(mSurface->GetImageHandle(),
+  aOutDescriptor = SurfaceTextureDescriptor(mSurface->GetHandle(),
                                             mSize,
                                             mFormat,
                                             false /* not continuous */,
                                             true /* ignore transform */);
   return true;
 }
 
 bool
--- a/mobile/android/geckoview/src/main/aidl/org/mozilla/gecko/gfx/ISurfaceAllocator.aidl
+++ b/mobile/android/geckoview/src/main/aidl/org/mozilla/gecko/gfx/ISurfaceAllocator.aidl
@@ -1,15 +1,12 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.gfx;
 
 import org.mozilla.gecko.gfx.GeckoSurface;
-import org.mozilla.gecko.gfx.SyncConfig;
 
 interface ISurfaceAllocator {
     GeckoSurface acquireSurface(in int width, in int height, in boolean singleBufferMode);
     void releaseSurface(in int handle);
-    void configureSync(in SyncConfig config);
-    void sync(in int handle);
 }
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/aidl/org/mozilla/gecko/gfx/SyncConfig.aidl
+++ /dev/null
@@ -1,7 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.gfx;
-
-parcelable SyncConfig;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurface.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurface.java
@@ -5,52 +5,51 @@
 
 package org.mozilla.gecko.gfx;
 
 import android.graphics.SurfaceTexture;
 
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.view.Surface;
+import android.util.Log;
+
+import java.util.HashMap;
 
 import org.mozilla.gecko.annotation.WrapForJNI;
 
-import static org.mozilla.geckoview.BuildConfig.DEBUG_BUILD;
-
 public final class GeckoSurface extends Surface {
     private static final String LOGTAG = "GeckoSurface";
 
+    private static final HashMap<Integer, GeckoSurfaceTexture> sSurfaceTextures = new HashMap<Integer, GeckoSurfaceTexture>();
+
     private int mHandle;
     private boolean mIsSingleBuffer;
     private volatile boolean mIsAvailable;
     private boolean mOwned = true;
 
-    private int mMyPid;
-    // Locally allocated surface/texture. Do not pass it over IPC.
-    private GeckoSurface mSyncSurface;
-
+    @WrapForJNI(exceptionMode = "nsresult")
     public GeckoSurface(GeckoSurfaceTexture gst) {
         super(gst);
         mHandle = gst.getHandle();
         mIsSingleBuffer = gst.isSingleBuffer();
         mIsAvailable = true;
-        mMyPid = android.os.Process.myPid();
     }
 
     public GeckoSurface(Parcel p, SurfaceTexture dummy) {
         // A no-arg constructor exists, but is hidden in the SDK. We need to create a dummy
         // SurfaceTexture here in order to create the instance. This is used to transfer the
         // GeckoSurface across binder.
         super(dummy);
 
         readFromParcel(p);
         mHandle = p.readInt();
         mIsSingleBuffer = p.readByte() == 1 ? true : false;
         mIsAvailable = (p.readByte() == 1 ? true : false);
-        mMyPid = p.readInt();
+
         dummy.release();
     }
 
     public static final Parcelable.Creator<GeckoSurface> CREATOR = new Parcelable.Creator<GeckoSurface>() {
         public GeckoSurface createFromParcel(Parcel p) {
             return new GeckoSurface(p, new SurfaceTexture(0));
         }
 
@@ -60,65 +59,34 @@ public final class GeckoSurface extends 
     };
 
     @Override
     public void writeToParcel(Parcel out, int flags) {
         super.writeToParcel(out, flags);
         out.writeInt(mHandle);
         out.writeByte((byte) (mIsSingleBuffer ? 1 : 0));
         out.writeByte((byte) (mIsAvailable ? 1 : 0));
-        out.writeInt(mMyPid);
+
         mOwned = false;
     }
 
     @Override
     public void release() {
-        if (mSyncSurface != null) {
-            mSyncSurface.release();
-            GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(mSyncSurface.getHandle());
-            if (gst != null) {
-                gst.decrementUse();
-            }
-            mSyncSurface = null;
-        }
-
         if (mOwned) {
             super.release();
         }
     }
 
     @WrapForJNI
-    public int getImageHandle() {
-        return mSyncSurface == null ? mHandle : mSyncSurface.getHandle();
+    public int getHandle() {
+        return mHandle;
     }
 
     @WrapForJNI
     public boolean getAvailable() {
         return mIsAvailable;
     }
 
     @WrapForJNI
     public void setAvailable(boolean available) {
         mIsAvailable = available;
     }
-
-    /* package */ boolean inProcess() {
-        return android.os.Process.myPid() == mMyPid;
-    }
-
-    /* package */ int getHandle() {
-        return mHandle;
-    }
-
-    /* package */ SyncConfig initSyncSurface(int width, int height) {
-        if (DEBUG_BUILD) {
-            if (inProcess()) {
-                throw new AssertionError("no need for sync when allocated in process");
-            }
-        }
-        GeckoSurfaceTexture texture = GeckoSurfaceTexture.acquire(false);
-        texture.setDefaultBufferSize(width, height);
-        texture.track(mHandle);
-        mSyncSurface = new GeckoSurface(texture);
-
-        return new SyncConfig(mHandle, mSyncSurface, width, height);
-    }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
@@ -9,17 +9,16 @@ import android.graphics.SurfaceTexture;
 import android.os.Build;
 import android.util.Log;
 
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.HashMap;
 import java.util.LinkedList;
 
 import org.mozilla.gecko.annotation.WrapForJNI;
-import org.mozilla.gecko.mozglue.JNIObject;
 
 /* package */ final class GeckoSurfaceTexture extends SurfaceTexture {
     private static final String LOGTAG = "GeckoSurfaceTexture";
     private static final int MAX_SURFACE_TEXTURES = 200;
     private static volatile int sNextHandle = 1;
     private static final HashMap<Integer, GeckoSurfaceTexture> sSurfaceTextures = new HashMap<Integer, GeckoSurfaceTexture>();
 
 
@@ -31,19 +30,16 @@ import org.mozilla.gecko.mozglue.JNIObje
 
     private long mAttachedContext;
     private int mTexName;
 
     private GeckoSurfaceTexture.Callbacks mListener;
     private AtomicInteger mUseCount;
     private boolean mFinalized;
 
-    private int mUpstream;
-    private NativeGLBlitHelper mBlitter;
-
     private GeckoSurfaceTexture(int handle) {
         super(0);
         init(handle, false);
     }
 
     private GeckoSurfaceTexture(int handle, boolean singleBufferMode) {
         super(0, singleBufferMode);
         init(handle, singleBufferMode);
@@ -108,34 +104,27 @@ import org.mozilla.gecko.mozglue.JNIObje
     public boolean isSingleBuffer() {
         return mIsSingleBuffer;
     }
 
     @Override
     @WrapForJNI
     public synchronized void updateTexImage() {
         try {
-            if (mUpstream != 0) {
-                SurfaceAllocator.sync(mUpstream);
-            }
             super.updateTexImage();
             if (mListener != null) {
                 mListener.onUpdateTexImage();
             }
         } catch (Exception e) {
             Log.w(LOGTAG, "updateTexImage() failed", e);
         }
     }
 
     @Override
     public synchronized void release() {
-        mUpstream = 0;
-        if (mBlitter != null) {
-            mBlitter.disposeNative();
-        }
         try {
             super.release();
             synchronized (sSurfaceTextures) {
                 sSurfaceTextures.remove(mHandle);
             }
         } catch (Exception e) {
             Log.w(LOGTAG, "release() failed", e);
         }
@@ -280,37 +269,13 @@ import org.mozilla.gecko.mozglue.JNIObje
 
     @WrapForJNI
     public static GeckoSurfaceTexture lookup(int handle) {
         synchronized (sSurfaceTextures) {
             return sSurfaceTextures.get(handle);
         }
     }
 
-    /* package */ void track(int upstream) {
-        mUpstream = upstream;
-    }
-
-    /* package */ synchronized void configureSnapshot(GeckoSurface target, int width, int height) {
-        mBlitter = NativeGLBlitHelper.create(mHandle, target, width, height);
-    }
-
-    /* package */ synchronized void takeSnapshot() {
-        mBlitter.blit();
-    }
-
     public interface Callbacks {
         void onUpdateTexImage();
         void onReleaseTexImage();
     }
-
-    @WrapForJNI
-    public static final class NativeGLBlitHelper extends JNIObject {
-        public native static NativeGLBlitHelper create(int textureHandle,
-                                                       GeckoSurface targetSurface,
-                                                       int width,
-                                                       int height);
-        public native void blit();
-
-        @Override
-        protected native void disposeNative();
-    }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocator.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocator.java
@@ -5,19 +5,22 @@
 
 package org.mozilla.gecko.gfx;
 
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
 
+import android.graphics.SurfaceTexture;
 import android.os.IBinder;
+import android.os.Process;
 import android.os.RemoteException;
 import android.util.Log;
+import android.view.Surface;
 
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.GeckoAppShell;
 
 /* package */ final class SurfaceAllocator {
     private static final String LOGTAG = "SurfaceAllocator";
 
     private static SurfaceAllocatorConnection sConnection;
@@ -41,22 +44,18 @@ import org.mozilla.gecko.GeckoAppShell;
     @WrapForJNI
     public static GeckoSurface acquireSurface(int width, int height, boolean singleBufferMode) {
         try {
             ensureConnection();
 
             if (singleBufferMode && !GeckoSurfaceTexture.isSingleBufferSupported()) {
                 return null;
             }
-            ISurfaceAllocator allocator = sConnection.getAllocator();
-            GeckoSurface surface = allocator.acquireSurface(width, height, singleBufferMode);
-            if (surface != null && !surface.inProcess()) {
-                allocator.configureSync(surface.initSyncSurface(width, height));
-            }
-            return surface;
+
+            return sConnection.getAllocator().acquireSurface(width, height, singleBufferMode);
         } catch (Exception e) {
             Log.w(LOGTAG, "Failed to acquire GeckoSurface", e);
             return null;
         }
     }
 
     @WrapForJNI
     public static void disposeSurface(GeckoSurface surface) {
@@ -77,32 +76,16 @@ import org.mozilla.gecko.GeckoAppShell;
         // And now our Surface
         try {
             surface.release();
         } catch (Exception e) {
             Log.w(LOGTAG, "Failed to release surface", e);
         }
     }
 
-    public static void sync(int upstream) {
-        try {
-            ensureConnection();
-        } catch (Exception e) {
-            Log.w(LOGTAG, "Failed to sync texture, no connection");
-            return;
-        }
-
-        // Release the SurfaceTexture on the other side
-        try {
-            sConnection.getAllocator().sync(upstream);
-        } catch (RemoteException e) {
-            Log.w(LOGTAG, "Failed to sync texture", e);
-        }
-    }
-
     private static final class SurfaceAllocatorConnection implements ServiceConnection {
         private ISurfaceAllocator mAllocator;
 
         public synchronized ISurfaceAllocator getAllocator() {
             while (mAllocator == null) {
                 try {
                     this.wait();
                 } catch (InterruptedException e) { }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocatorService.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SurfaceAllocatorService.java
@@ -4,16 +4,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.gfx;
 
 import android.app.Service;
 import android.content.Intent;
 import android.os.Binder;
 import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
 
 public final class SurfaceAllocatorService extends Service {
 
     private static final String LOGTAG = "SurfaceAllocatorService";
 
     public int onStartCommand(final Intent intent, final int flags, final int startId) {
         return Service.START_STICKY;
     }
@@ -34,30 +36,16 @@ public final class SurfaceAllocatorServi
         }
 
         public void releaseSurface(int handle) {
             final GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(handle);
             if (gst != null) {
                 gst.decrementUse();
             }
         }
-
-        public void configureSync(SyncConfig config) {
-            final GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(config.sourceTextureHandle);
-            if (gst != null) {
-                gst.configureSnapshot(config.targetSurface, config.width, config.height);
-            }
-        }
-
-        public void sync(int handle) {
-            final GeckoSurfaceTexture gst = GeckoSurfaceTexture.lookup(handle);
-            if (gst != null) {
-                gst.takeSnapshot();
-            }
-        }
     };
 
     public IBinder onBind(final Intent intent) {
         return mBinder;
     }
 
     public boolean onUnbind(Intent intent) {
         return false;
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SyncConfig.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.mozilla.gecko.gfx;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/* package */ final class SyncConfig implements Parcelable {
-    final int sourceTextureHandle;
-    final GeckoSurface targetSurface;
-    final int width;
-    final int height;
-
-    /* package */ SyncConfig(int sourceTextureHandle,
-                             GeckoSurface targetSurface,
-                             int width,
-                             int height) {
-        this.sourceTextureHandle = sourceTextureHandle;
-        this.targetSurface = targetSurface;
-        this.width = width;
-        this.height = height;
-    }
-
-    public static final Creator<SyncConfig> CREATOR =
-        new Creator<SyncConfig>() {
-            @Override
-            public SyncConfig createFromParcel(Parcel parcel) {
-                return new SyncConfig(parcel);
-            }
-
-            @Override
-            public SyncConfig[] newArray(int i) {
-                return new SyncConfig[i];
-            }
-        };
-
-    private SyncConfig(Parcel parcel) {
-        sourceTextureHandle = parcel.readInt();
-        targetSurface = GeckoSurface.CREATOR.createFromParcel(parcel);
-        width = parcel.readInt();
-        height = parcel.readInt();
-    }
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    @Override
-    public void writeToParcel(Parcel parcel, int flags) {
-        parcel.writeInt(sourceTextureHandle);
-        targetSurface.writeToParcel(parcel, flags);
-        parcel.writeInt(width);
-        parcel.writeInt(height);
-    }
-}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/SharedMemory.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/SharedMemory.java
@@ -50,17 +50,17 @@ public class SharedMemory implements Par
         @Override
         public SharedMemory[] newArray(int size) {
             return new SharedMemory[size];
         }
     };
 
     @Override
     public int describeContents() {
-        return CONTENTS_FILE_DESCRIPTOR;
+        return 0;
     }
 
     @Override
     public void writeToParcel(Parcel dest, int flags) {
         // We don't want ParcelFileDescriptor.writeToParcel() to close the fd.
         dest.writeFileDescriptor(mDescriptor.getFileDescriptor());
         dest.writeInt(mSize);
         dest.writeInt(mId);
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -35,17 +35,16 @@
 #include "mozilla/Hal.h"
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/intl/OSPreferences.h"
 #include "mozilla/widget/ScreenManager.h"
 #include "prenv.h"
 
 #include "AndroidBridge.h"
 #include "AndroidBridgeUtilities.h"
-#include "AndroidSurfaceTexture.h"
 #include "GeneratedJNINatives.h"
 #include <android/log.h>
 #include <pthread.h>
 #include <wchar.h>
 
 #include "GeckoProfiler.h"
 #ifdef MOZ_ANDROID_HISTORY
 #include "nsNetUtil.h"
@@ -434,17 +433,16 @@ nsAppShell::nsAppShell()
         mozilla::GeckoNetworkManager::Init();
         mozilla::GeckoProcessManager::Init();
         mozilla::GeckoScreenOrientation::Init();
         mozilla::GeckoSystemStateListener::Init();
         mozilla::PrefsHelper::Init();
         mozilla::widget::Telemetry::Init();
         mozilla::widget::WebExecutorSupport::Init();
         nsWindow::InitNatives();
-        mozilla::gl::AndroidSurfaceTexture::Init();
 
         if (jni::IsFennec()) {
             BrowserLocaleManagerSupport::Init();
             mozilla::ANRReporter::Init();
             mozilla::MemoryMonitor::Init();
             mozilla::ThumbnailHelper::Init();
         }