Backed out 3 changesets (bug 1395497) on request from RyanVM and gchang. r=backout a=gchang FENNEC_58_0b5_BUILD2 FENNEC_58_0b5_RELEASE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 21 Nov 2017 02:01:29 +0200
changeset 444832 b2dca24b1741e6089c7fc1080493e2e230b52cb3
parent 444831 96ccac75a2f75ebaaf0bff6f99e8ec35fc8b97ec
child 444833 1703a61d3d22dfe1ccc852e5260180fea5064b11
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout, gchang
bugs1395497
milestone58.0
Backed out 3 changesets (bug 1395497) on request from RyanVM and gchang. r=backout a=gchang
gfx/gl/AndroidSurfaceTexture.cpp
gfx/gl/AndroidSurfaceTexture.h
gfx/gl/GLBlitHelper.cpp
gfx/layers/opengl/TextureHostOGL.cpp
gfx/layers/opengl/TexturePoolOGL.cpp
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
widget/android/GeneratedJNINatives.h
widget/android/GeneratedJNIWrappers.cpp
widget/android/GeneratedJNIWrappers.h
--- a/gfx/gl/AndroidSurfaceTexture.cpp
+++ b/gfx/gl/AndroidSurfaceTexture.cpp
@@ -9,26 +9,44 @@
 #include "AndroidSurfaceTexture.h"
 
 using namespace mozilla;
 
 namespace mozilla {
 namespace gl {
 
 void
-AndroidSurfaceTexture::GetTransformMatrix(java::sdk::SurfaceTexture::Param surfaceTexture,
-                                          gfx::Matrix4x4* outMatrix)
+AndroidSurfaceTexture::GetTransformMatrix(java::sdk::SurfaceTexture::LocalRef aSurfaceTexture,
+                                          gfx::Matrix4x4& aMatrix)
 {
   JNIEnv* const env = jni::GetEnvForThread();
 
   auto jarray = jni::FloatArray::LocalRef::Adopt(env, env->NewFloatArray(16));
-  surfaceTexture->GetTransformMatrix(jarray);
+  aSurfaceTexture->GetTransformMatrix(jarray);
 
   jfloat* array = env->GetFloatArrayElements(jarray.Get(), nullptr);
 
-  memcpy(&(outMatrix->_11), array, sizeof(float)*16);
+  aMatrix._11 = array[0];
+  aMatrix._12 = array[1];
+  aMatrix._13 = array[2];
+  aMatrix._14 = array[3];
+
+  aMatrix._21 = array[4];
+  aMatrix._22 = array[5];
+  aMatrix._23 = array[6];
+  aMatrix._24 = array[7];
+
+  aMatrix._31 = array[8];
+  aMatrix._32 = array[9];
+  aMatrix._33 = array[10];
+  aMatrix._34 = array[11];
+
+  aMatrix._41 = array[12];
+  aMatrix._42 = array[13];
+  aMatrix._43 = array[14];
+  aMatrix._44 = array[15];
 
   env->ReleaseFloatArrayElements(jarray.Get(), array, 0);
 }
 
 } // gl
 } // mozilla
 #endif // MOZ_WIDGET_ANDROID
--- a/gfx/gl/AndroidSurfaceTexture.h
+++ b/gfx/gl/AndroidSurfaceTexture.h
@@ -13,18 +13,18 @@
 
 typedef uint32_t AndroidSurfaceTextureHandle;
 
 namespace mozilla {
 namespace gl {
 
 class AndroidSurfaceTexture {
 public:
-  static void GetTransformMatrix(java::sdk::SurfaceTexture::Param surfaceTexture,
-                                 mozilla::gfx::Matrix4x4* outMatrix);
+  static void GetTransformMatrix(java::sdk::SurfaceTexture::LocalRef aSurfaceTexture,
+                                 mozilla::gfx::Matrix4x4& aMatrix);
 
 };
 
 } // gl
 } // mozilla
 
 #endif // MOZ_WIDGET_ANDROID
 #endif // AndroidSurfaceTexture_h__
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -14,17 +14,16 @@
 #include "HeapCopyOfStackArray.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/gfx/Matrix.h"
 #include "mozilla/UniquePtr.h"
 #include "GPUVideoImage.h"
 
 #ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
 #include "AndroidSurfaceTexture.h"
 #include "GLImages.h"
 #include "GLLibraryEGL.h"
 #endif
 
 #ifdef XP_MACOSX
 #include "MacIOSurfaceImage.h"
 #include "GLContextCGL.h"
@@ -754,81 +753,24 @@ GLBlitHelper::BlitImageToFramebuffer(lay
         return false;
     }
 }
 
 // -------------------------------------
 
 #ifdef MOZ_WIDGET_ANDROID
 bool
-GLBlitHelper::BlitImage(layers::SurfaceTextureImage* srcImage, const gfx::IntSize& destSize,
-                        const OriginPos destOrigin) const
+GLBlitHelper::BlitImage(layers::SurfaceTextureImage* srcImage, const gfx::IntSize&,
+                        const OriginPos) const
 {
-    AndroidSurfaceTextureHandle handle = srcImage->GetHandle();
-    const auto& surfaceTexture = java::GeckoSurfaceTexture::Lookup(handle);
-
-    if (!surfaceTexture) {
-        return false;
-    }
-
-    const ScopedBindTextureUnit boundTU(mGL, LOCAL_GL_TEXTURE0);
-
-    if (!surfaceTexture->IsAttachedToGLContext((int64_t)mGL)) {
-        GLuint tex;
-        mGL->MakeCurrent();
-        mGL->fGenTextures(1, &tex);
-
-        if (NS_FAILED(surfaceTexture->AttachToGLContext((int64_t)mGL, tex))) {
-            mGL->fDeleteTextures(1, &tex);
-            return false;
-        }
-    }
-
-    const ScopedBindTexture savedTex(mGL, surfaceTexture->GetTexName(), LOCAL_GL_TEXTURE_EXTERNAL);
-    surfaceTexture->UpdateTexImage();
-
-    gfx::Matrix4x4 transform4;
-    AndroidSurfaceTexture::GetTransformMatrix(java::sdk::SurfaceTexture::Ref::From(surfaceTexture),
-                                              &transform4);
-    Mat3 transform3;
-    transform3.at(0,0) = transform4._11;
-    transform3.at(0,1) = transform4._12;
-    transform3.at(0,2) = transform4._14;
-    transform3.at(1,0) = transform4._21;
-    transform3.at(1,1) = transform4._22;
-    transform3.at(1,2) = transform4._24;
-    transform3.at(2,0) = transform4._41;
-    transform3.at(2,1) = transform4._42;
-    transform3.at(2,2) = transform4._44;
-
-    // We don't do w-divison, so if these aren't what we expect, we're probably doing
-    // something wrong.
-    MOZ_ASSERT(transform3.at(0,2) == 0);
-    MOZ_ASSERT(transform3.at(1,2) == 0);
-    MOZ_ASSERT(transform3.at(2,2) == 1);
-
+    // FIXME
     const auto& srcOrigin = srcImage->GetOriginPos();
-
-    // I honestly have no idea why this logic is flipped, but changing the
-    // source origin would mean we'd have to flip it in the compositor
-    // which makes just as little sense as this.
-    const bool yFlip = (srcOrigin == destOrigin);
-
-    const auto& prog = GetDrawBlitProg({kFragHeader_TexExt, kFragBody_RGBA});
-    MOZ_RELEASE_ASSERT(prog);
-
-    // There is no padding on these images, so we can use the GetTransformMatrix directly.
-    const DrawBlitProg::BaseArgs baseArgs = { transform3, yFlip, destSize, Nothing() };
-    prog->Draw(baseArgs, nullptr);
-
-    if (surfaceTexture->IsSingleBuffer()) {
-        surfaceTexture->ReleaseTexImage();
-    }
-
-    return true;
+    (void)srcOrigin;
+    gfxCriticalError() << "BlitImage(SurfaceTextureImage) not implemented.";
+    return false;
 }
 #endif
 
 // -------------------------------------
 
 bool
 GuessDivisors(const gfx::IntSize& ySize, const gfx::IntSize& uvSize,
               gfx::IntSize* const out_divisors)
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -400,17 +400,17 @@ SurfaceTextureSource::GetTextureTransfor
   gfx::Matrix4x4 ret;
 
   // GetTransformMatrix() returns the transform set by the producer side of
   // the SurfaceTexture. We should ignore this if we know the transform should
   // be identity but the producer couldn't set it correctly, like is the
   // case for AndroidNativeWindowTextureData.
   if (!mIgnoreTransform) {
     const auto& surf = java::sdk::SurfaceTexture::LocalRef(java::sdk::SurfaceTexture::Ref::From(mSurfTex));
-    AndroidSurfaceTexture::GetTransformMatrix(surf, &ret);
+    AndroidSurfaceTexture::GetTransformMatrix(surf, ret);
   }
 
   return ret;
 }
 
 void
 SurfaceTextureSource::DeallocateDeviceData()
 {
@@ -479,24 +479,16 @@ SurfaceTextureHost::EnsureAttached()
   if (!gl || !gl->MakeCurrent()) {
     return false;
   }
 
   if (!mSurfTex) {
     return false;
   }
 
-  if (!mSurfTex->IsAttachedToGLContext((int64_t)gl)) {
-    GLuint texName;
-    gl->fGenTextures(1, &texName);
-    if (NS_FAILED(mSurfTex->AttachToGLContext((int64_t)gl, texName))) {
-      return false;
-    }
-  }
-
   return true;
 }
 
 bool
 SurfaceTextureHost::Lock()
 {
   if (!EnsureAttached()) {
     return false;
--- a/gfx/layers/opengl/TexturePoolOGL.cpp
+++ b/gfx/layers/opengl/TexturePoolOGL.cpp
@@ -10,16 +10,20 @@
 #include "mozilla/Logging.h"
 #include "mozilla/Monitor.h"            // for Monitor, MonitorAutoLock
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "mozilla/layers/CompositorThread.h"
 #include "nsDebug.h"                    // for NS_ASSERTION, NS_ERROR, etc
 #include "nsDeque.h"                    // for nsDeque
 #include "nsThreadUtils.h"
 
+#ifdef MOZ_WIDGET_ANDROID
+#include "GeneratedJNINatives.h"
+#endif
+
 static const unsigned int TEXTURE_POOL_SIZE = 10;
 static const unsigned int TEXTURE_REFILL_THRESHOLD = TEXTURE_POOL_SIZE / 2;
 
 static mozilla::LazyLogModule gTexturePoolLog("TexturePoolOGL");
 #define LOG(arg, ...) MOZ_LOG(gTexturePoolLog, mozilla::LogLevel::Debug, ("TexturePoolOGL::%s: " arg, __func__, ##__VA_ARGS__))
 
 namespace mozilla {
 namespace gl {
@@ -33,16 +37,29 @@ enum class PoolState : uint8_t {
   NOT_INITIALIZE,
   INITIALIZED,
   SHUTDOWN
 };
 static PoolState sPoolState = PoolState::NOT_INITIALIZE;
 
 static bool sHasPendingFillTask = false;
 
+#ifdef MOZ_WIDGET_ANDROID
+
+class GeckoSurfaceTextureSupport final
+    : public java::GeckoSurfaceTexture::Natives<GeckoSurfaceTextureSupport>
+{
+public:
+  static int32_t NativeAcquireTexture() {
+    return TexturePoolOGL::AcquireTexture();
+  }
+};
+
+#endif // MOZ_WIDGET_ANDROID
+
 void TexturePoolOGL::MaybeFillTextures()
 {
   if (sTextures->GetSize() < TEXTURE_REFILL_THRESHOLD &&
       !sHasPendingFillTask) {
     LOG("need to refill the texture pool.");
     sHasPendingFillTask = true;
     MessageLoop* loop = mozilla::layers::CompositorThreadHolder::Loop();
     MOZ_ASSERT(loop);
@@ -150,16 +167,21 @@ GLContext* TexturePoolOGL::GetGLContext(
 }
 
 void TexturePoolOGL::Init()
 {
   MOZ_ASSERT(sPoolState != PoolState::INITIALIZED);
   sMonitor = new Monitor("TexturePoolOGL.sMonitor");
   sTextures = new nsDeque();
 
+#ifdef MOZ_WIDGET_ANDROID
+  if (jni::IsAvailable()) {
+    GeckoSurfaceTextureSupport::Init();
+  }
+#endif
   sPoolState = PoolState::INITIALIZED;
 }
 
 void TexturePoolOGL::Shutdown()
 {
   MOZ_ASSERT(sPoolState == PoolState::INITIALIZED);
   sPoolState = PoolState::SHUTDOWN;
   delete sMonitor;
--- 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
@@ -16,77 +16,50 @@ import org.mozilla.gecko.AppConstants.Ve
 
 public final class GeckoSurfaceTexture extends SurfaceTexture {
     private static final String LOGTAG = "GeckoSurfaceTexture";
     private static volatile int sNextHandle = 1;
     private static HashMap<Integer, GeckoSurfaceTexture> sSurfaceTextures = new HashMap<Integer, GeckoSurfaceTexture>();
 
     private int mHandle;
     private boolean mIsSingleBuffer;
-
-    private long mAttachedContext;
     private int mTexName;
-
     private GeckoSurfaceTexture.Callbacks mListener;
     private AtomicInteger mUseCount;
 
-    private GeckoSurfaceTexture(int handle) {
-        super(0);
-        init(handle, false);
+    @WrapForJNI(dispatchTo = "current")
+    private static native int nativeAcquireTexture();
+
+    private GeckoSurfaceTexture(int handle, int texName) {
+        super(texName);
+        init(handle, texName, false);
     }
 
-    private GeckoSurfaceTexture(int handle, boolean singleBufferMode) {
-        super(0, singleBufferMode);
-        init(handle, singleBufferMode);
+    private GeckoSurfaceTexture(int handle, int texName, boolean singleBufferMode) {
+        super(texName, singleBufferMode);
+        init(handle, texName, singleBufferMode);
     }
 
-    private void init(int handle, boolean singleBufferMode) {
+    private void init(int handle, int texName, boolean singleBufferMode) {
         mHandle = handle;
         mIsSingleBuffer = singleBufferMode;
+        mTexName = texName;
         mUseCount = new AtomicInteger(1);
-
-        // Start off detached
-        detachFromGLContext();
     }
 
     @WrapForJNI
     public int getHandle() {
         return mHandle;
     }
 
     @WrapForJNI
     public int getTexName() {
         return mTexName;
     }
 
-    @WrapForJNI(exceptionMode = "nsresult")
-    public void attachToGLContext(long context, int texName) {
-        if (context == mAttachedContext && texName == mTexName) {
-            return;
-        }
-
-        attachToGLContext(texName);
-
-        mAttachedContext = context;
-        mTexName = texName;
-    }
-
-    @Override
-    @WrapForJNI(exceptionMode = "nsresult")
-    public void detachFromGLContext() {
-        super.detachFromGLContext();
-
-        mAttachedContext = mTexName = 0;
-    }
-
-    @WrapForJNI
-    public boolean isAttachedToGLContext(long context) {
-        return mAttachedContext == context;
-    }
-
     @WrapForJNI
     public boolean isSingleBuffer() {
         return mIsSingleBuffer;
     }
 
     @Override
     @WrapForJNI
     public synchronized void updateTexImage() {
@@ -156,22 +129,23 @@ public final class GeckoSurfaceTexture e
     }
 
     public static GeckoSurfaceTexture acquire(boolean singleBufferMode) {
         if (singleBufferMode && !isSingleBufferSupported()) {
             throw new IllegalArgumentException("single buffer mode not supported on API version < 19");
         }
 
         int handle = sNextHandle++;
+        int texName = nativeAcquireTexture();
 
         final GeckoSurfaceTexture gst;
         if (isSingleBufferSupported()) {
-            gst = new GeckoSurfaceTexture(handle, singleBufferMode);
+            gst = new GeckoSurfaceTexture(handle, texName, singleBufferMode);
         } else {
-            gst = new GeckoSurfaceTexture(handle);
+            gst = new GeckoSurfaceTexture(handle, texName);
         }
 
         synchronized (sSurfaceTextures) {
             if (sSurfaceTextures.containsKey(handle)) {
                 gst.release();
                 throw new IllegalArgumentException("Already have a GeckoSurfaceTexture with that handle");
             }
 
--- a/widget/android/GeneratedJNINatives.h
+++ b/widget/android/GeneratedJNINatives.h
@@ -372,16 +372,31 @@ const JNINativeMethod SurfaceTextureList
             ::template Wrap<&Impl::DisposeNative>),
 
     mozilla::jni::MakeNativeMethod<SurfaceTextureListener::OnFrameAvailable_t>(
             mozilla::jni::NativeStub<SurfaceTextureListener::OnFrameAvailable_t, Impl>
             ::template Wrap<&Impl::OnFrameAvailable>)
 };
 
 template<class Impl>
+class GeckoSurfaceTexture::Natives : public mozilla::jni::NativeImpl<GeckoSurfaceTexture, Impl>
+{
+public:
+    static const JNINativeMethod methods[1];
+};
+
+template<class Impl>
+const JNINativeMethod GeckoSurfaceTexture::Natives<Impl>::methods[] = {
+
+    mozilla::jni::MakeNativeMethod<GeckoSurfaceTexture::NativeAcquireTexture_t>(
+            mozilla::jni::NativeStub<GeckoSurfaceTexture::NativeAcquireTexture_t, Impl>
+            ::template Wrap<&Impl::NativeAcquireTexture>)
+};
+
+template<class Impl>
 class LayerView::Compositor::Natives : public mozilla::jni::NativeImpl<Compositor, Impl>
 {
 public:
     static const JNINativeMethod methods[14];
 };
 
 template<class Impl>
 const JNINativeMethod LayerView::Compositor::Natives<Impl>::methods[] = {
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -1191,44 +1191,24 @@ constexpr char GeckoSurface::SetAvailabl
 auto GeckoSurface::SetAvailable(bool a0) const -> void
 {
     return mozilla::jni::Method<SetAvailable_t>::Call(GeckoSurface::mCtx, nullptr, a0);
 }
 
 const char GeckoSurfaceTexture::name[] =
         "org/mozilla/gecko/gfx/GeckoSurfaceTexture";
 
-constexpr char GeckoSurfaceTexture::AttachToGLContext_t::name[];
-constexpr char GeckoSurfaceTexture::AttachToGLContext_t::signature[];
-
-auto GeckoSurfaceTexture::AttachToGLContext(int64_t a0, int32_t a1) const -> nsresult
-{
-    nsresult rv = NS_OK;
-    mozilla::jni::Method<AttachToGLContext_t>::Call(GeckoSurfaceTexture::mCtx, &rv, a0, a1);
-    return rv;
-}
-
 constexpr char GeckoSurfaceTexture::DecrementUse_t::name[];
 constexpr char GeckoSurfaceTexture::DecrementUse_t::signature[];
 
 auto GeckoSurfaceTexture::DecrementUse() const -> void
 {
     return mozilla::jni::Method<DecrementUse_t>::Call(GeckoSurfaceTexture::mCtx, nullptr);
 }
 
-constexpr char GeckoSurfaceTexture::DetachFromGLContext_t::name[];
-constexpr char GeckoSurfaceTexture::DetachFromGLContext_t::signature[];
-
-auto GeckoSurfaceTexture::DetachFromGLContext() const -> nsresult
-{
-    nsresult rv = NS_OK;
-    mozilla::jni::Method<DetachFromGLContext_t>::Call(GeckoSurfaceTexture::mCtx, &rv);
-    return rv;
-}
-
 constexpr char GeckoSurfaceTexture::GetHandle_t::name[];
 constexpr char GeckoSurfaceTexture::GetHandle_t::signature[];
 
 auto GeckoSurfaceTexture::GetHandle() const -> int32_t
 {
     return mozilla::jni::Method<GetHandle_t>::Call(GeckoSurfaceTexture::mCtx, nullptr);
 }
 
@@ -1243,24 +1223,16 @@ auto GeckoSurfaceTexture::GetTexName() c
 constexpr char GeckoSurfaceTexture::IncrementUse_t::name[];
 constexpr char GeckoSurfaceTexture::IncrementUse_t::signature[];
 
 auto GeckoSurfaceTexture::IncrementUse() const -> void
 {
     return mozilla::jni::Method<IncrementUse_t>::Call(GeckoSurfaceTexture::mCtx, nullptr);
 }
 
-constexpr char GeckoSurfaceTexture::IsAttachedToGLContext_t::name[];
-constexpr char GeckoSurfaceTexture::IsAttachedToGLContext_t::signature[];
-
-auto GeckoSurfaceTexture::IsAttachedToGLContext(int64_t a0) const -> bool
-{
-    return mozilla::jni::Method<IsAttachedToGLContext_t>::Call(GeckoSurfaceTexture::mCtx, nullptr, a0);
-}
-
 constexpr char GeckoSurfaceTexture::IsSingleBuffer_t::name[];
 constexpr char GeckoSurfaceTexture::IsSingleBuffer_t::signature[];
 
 auto GeckoSurfaceTexture::IsSingleBuffer() const -> bool
 {
     return mozilla::jni::Method<IsSingleBuffer_t>::Call(GeckoSurfaceTexture::mCtx, nullptr);
 }
 
@@ -1275,16 +1247,19 @@ auto GeckoSurfaceTexture::IsSingleBuffer
 constexpr char GeckoSurfaceTexture::Lookup_t::name[];
 constexpr char GeckoSurfaceTexture::Lookup_t::signature[];
 
 auto GeckoSurfaceTexture::Lookup(int32_t a0) -> GeckoSurfaceTexture::LocalRef
 {
     return mozilla::jni::Method<Lookup_t>::Call(GeckoSurfaceTexture::Context(), nullptr, a0);
 }
 
+constexpr char GeckoSurfaceTexture::NativeAcquireTexture_t::name[];
+constexpr char GeckoSurfaceTexture::NativeAcquireTexture_t::signature[];
+
 constexpr char GeckoSurfaceTexture::ReleaseTexImage_t::name[];
 constexpr char GeckoSurfaceTexture::ReleaseTexImage_t::signature[];
 
 auto GeckoSurfaceTexture::ReleaseTexImage() const -> void
 {
     return mozilla::jni::Method<ReleaseTexImage_t>::Call(GeckoSurfaceTexture::mCtx, nullptr);
 }
 
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -3668,37 +3668,16 @@ public:
 
 class GeckoSurfaceTexture : public mozilla::jni::ObjectBase<GeckoSurfaceTexture>
 {
 public:
     static const char name[];
 
     explicit GeckoSurfaceTexture(const Context& ctx) : ObjectBase<GeckoSurfaceTexture>(ctx) {}
 
-    struct AttachToGLContext_t {
-        typedef GeckoSurfaceTexture Owner;
-        typedef void ReturnType;
-        typedef void SetterType;
-        typedef mozilla::jni::Args<
-                int64_t,
-                int32_t> Args;
-        static constexpr char name[] = "attachToGLContext";
-        static constexpr char signature[] =
-                "(JI)V";
-        static const bool isStatic = false;
-        static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::NSRESULT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::ANY;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    auto AttachToGLContext(int64_t, int32_t) const -> nsresult;
-
     struct DecrementUse_t {
         typedef GeckoSurfaceTexture Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "decrementUse";
         static constexpr char signature[] =
                 "()V";
@@ -3708,35 +3687,16 @@ public:
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
                 mozilla::jni::DispatchTarget::CURRENT;
     };
 
     auto DecrementUse() const -> void;
 
-    struct DetachFromGLContext_t {
-        typedef GeckoSurfaceTexture Owner;
-        typedef void ReturnType;
-        typedef void SetterType;
-        typedef mozilla::jni::Args<> Args;
-        static constexpr char name[] = "detachFromGLContext";
-        static constexpr char signature[] =
-                "()V";
-        static const bool isStatic = false;
-        static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::NSRESULT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::ANY;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    auto DetachFromGLContext() const -> nsresult;
-
     struct GetHandle_t {
         typedef GeckoSurfaceTexture Owner;
         typedef int32_t ReturnType;
         typedef int32_t SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "getHandle";
         static constexpr char signature[] =
                 "()I";
@@ -3784,36 +3744,16 @@ public:
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
                 mozilla::jni::DispatchTarget::CURRENT;
     };
 
     auto IncrementUse() const -> void;
 
-    struct IsAttachedToGLContext_t {
-        typedef GeckoSurfaceTexture Owner;
-        typedef bool ReturnType;
-        typedef bool SetterType;
-        typedef mozilla::jni::Args<
-                int64_t> Args;
-        static constexpr char name[] = "isAttachedToGLContext";
-        static constexpr char signature[] =
-                "(J)Z";
-        static const bool isStatic = false;
-        static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::ABORT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::ANY;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    auto IsAttachedToGLContext(int64_t) const -> bool;
-
     struct IsSingleBuffer_t {
         typedef GeckoSurfaceTexture Owner;
         typedef bool ReturnType;
         typedef bool SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "isSingleBuffer";
         static constexpr char signature[] =
                 "()Z";
@@ -3862,16 +3802,33 @@ public:
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
                 mozilla::jni::DispatchTarget::CURRENT;
     };
 
     static auto Lookup(int32_t) -> GeckoSurfaceTexture::LocalRef;
 
+    struct NativeAcquireTexture_t {
+        typedef GeckoSurfaceTexture Owner;
+        typedef int32_t ReturnType;
+        typedef int32_t SetterType;
+        typedef mozilla::jni::Args<> Args;
+        static constexpr char name[] = "nativeAcquireTexture";
+        static constexpr char signature[] =
+                "()I";
+        static const bool isStatic = true;
+        static const mozilla::jni::ExceptionMode exceptionMode =
+                mozilla::jni::ExceptionMode::ABORT;
+        static const mozilla::jni::CallingThread callingThread =
+                mozilla::jni::CallingThread::ANY;
+        static const mozilla::jni::DispatchTarget dispatchTarget =
+                mozilla::jni::DispatchTarget::CURRENT;
+    };
+
     struct ReleaseTexImage_t {
         typedef GeckoSurfaceTexture Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "releaseTexImage";
         static constexpr char signature[] =
                 "()V";
@@ -3903,16 +3860,17 @@ public:
                 mozilla::jni::DispatchTarget::CURRENT;
     };
 
     auto UpdateTexImage() const -> void;
 
     static const mozilla::jni::CallingThread callingThread =
             mozilla::jni::CallingThread::ANY;
 
+    template<class Impl> class Natives;
 };
 
 class LayerView : public mozilla::jni::ObjectBase<LayerView>
 {
 public:
     static const char name[];
 
     explicit LayerView(const Context& ctx) : ObjectBase<LayerView>(ctx) {}