Bug 1291373 - [geckoview] part 5, Remove Layer and all derived classes r=snorp
authorRandall Barker <rbarker@mozilla.com>
Fri, 12 Aug 2016 11:51:49 -0700
changeset 351042 e25807db3f89f8fe5d5411b25610227ba6db330b
parent 351041 2fc2a6e9b9fceef73a4a6b1f056e3a5a09429c39
child 351043 98a1df2388afa6c07f3e4bf35ce0defd76ea5451
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1291373
milestone51.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 1291373 - [geckoview] part 5, Remove Layer and all derived classes r=snorp
gfx/layers/opengl/CompositorOGL.cpp
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/base/java/org/mozilla/gecko/Tab.java
mobile/android/base/moz.build
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/Layer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerRenderer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/PluginLayer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/VirtualLayer.java
widget/android/GeneratedJNIWrappers.cpp
widget/android/GeneratedJNIWrappers.h
widget/android/nsWindow.cpp
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -680,17 +680,17 @@ CompositorOGL::BeginFrame(const nsIntReg
     mWidgetSize.height = height;
   } else {
     MakeCurrent();
   }
 
   mPixelsPerFrame = width * height;
   mPixelsFilled = 0;
 
-#if MOZ_WIDGET_ANDROID
+#ifdef MOZ_WIDGET_ANDROID
   TexturePoolOGL::Fill(gl());
 #endif
 
   // Default blend function implements "OVER"
   mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
                                  LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA);
   mGLContext->fEnable(LOCAL_GL_BLEND);
 
@@ -702,23 +702,18 @@ CompositorOGL::BeginFrame(const nsIntReg
 #ifdef DEBUG
   mWindowRenderTarget = mCurrentRenderTarget;
 #endif
 
   if (aClipRectOut && !aClipRectIn) {
     aClipRectOut->SetRect(0, 0, width, height);
   }
 
-  // If the Android compositor is being used, this clear will be done in
-  // DrawWindowUnderlay. Make sure the bits used here match up with those used
-  // in mobile/android/base/gfx/LayerRenderer.java
-#ifndef MOZ_WIDGET_ANDROID
   mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
   mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
-#endif
 }
 
 void
 CompositorOGL::CreateFBOWithTexture(const gfx::IntRect& aRect, bool aCopyFromSource,
                                     GLuint aSourceFrameBuffer,
                                     GLuint *aFBO, GLuint *aTexture)
 {
   *aTexture = CreateTexture(aRect, aCopyFromSource, aSourceFrameBuffer);
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -8,19 +8,17 @@ package org.mozilla.gecko;
 import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.GeckoProfileDirectories.NoMozillaDirectoryException;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.UrlAnnotations;
 import org.mozilla.gecko.favicons.Favicons;
 import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
 import org.mozilla.gecko.gfx.BitmapUtils;
 import org.mozilla.gecko.gfx.FullScreenState;
-import org.mozilla.gecko.gfx.Layer;
 import org.mozilla.gecko.gfx.LayerView;
-import org.mozilla.gecko.gfx.PluginLayer;
 import org.mozilla.gecko.health.HealthRecorder;
 import org.mozilla.gecko.health.SessionInformation;
 import org.mozilla.gecko.health.StubbedHealthRecorder;
 import org.mozilla.gecko.home.HomeConfig.PanelType;
 import org.mozilla.gecko.menu.GeckoMenu;
 import org.mozilla.gecko.menu.GeckoMenuInflater;
 import org.mozilla.gecko.menu.MenuPanel;
 import org.mozilla.gecko.notifications.AppNotificationClient;
--- a/mobile/android/base/java/org/mozilla/gecko/Tab.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Tab.java
@@ -19,17 +19,16 @@ import org.mozilla.gecko.annotation.Robo
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.URLMetadata;
 import org.mozilla.gecko.favicons.FaviconGenerator;
 import org.mozilla.gecko.favicons.Favicons;
 import org.mozilla.gecko.favicons.LoadFaviconTask;
 import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
 import org.mozilla.gecko.favicons.RemoteFavicon;
 import org.mozilla.gecko.gfx.BitmapUtils;
-import org.mozilla.gecko.gfx.Layer;
 import org.mozilla.gecko.reader.ReaderModeUtils;
 import org.mozilla.gecko.reader.ReadingListHelper;
 import org.mozilla.gecko.toolbar.BrowserToolbar.TabEditingState;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.content.ContentResolver;
 import android.content.Context;
 import android.graphics.Bitmap;
@@ -70,17 +69,16 @@ public class Tab {
     private final boolean mExternal;
     private boolean mBookmark;
     private int mFaviconLoadId;
     private String mContentType;
     private boolean mHasTouchListeners;
     private ZoomConstraints mZoomConstraints;
     private boolean mIsRTL;
     private final ArrayList<View> mPluginViews;
-    private final HashMap<Object, Layer> mPluginLayers;
     private int mBackgroundColor;
     private int mState;
     private Bitmap mThumbnailBitmap;
     private boolean mDesktopMode;
     private boolean mEnteringReaderMode;
     private final Context mAppContext;
     private ErrorType mErrorType = ErrorType.NONE;
     private volatile int mLoadProgress;
@@ -137,17 +135,16 @@ public class Tab {
         mExternal = external;
         mParentId = parentId;
         mTitle = title == null ? "" : title;
         mSiteIdentity = new SiteIdentity();
         mHistoryIndex = -1;
         mContentType = "";
         mZoomConstraints = new ZoomConstraints(false);
         mPluginViews = new ArrayList<View>();
-        mPluginLayers = new HashMap<Object, Layer>();
         mState = shouldShowProgress(url) ? STATE_LOADING : STATE_SUCCESS;
         mLoadProgress = LOAD_PROGRESS_INIT;
 
         // At startup, the background is set to a color specified by LayerView
         // when the LayerView is created. Shortly after, this background color
         // will be used before the tab's content is shown.
         mBackgroundColor = DEFAULT_BACKGROUND_COLOR;
 
@@ -801,40 +798,16 @@ public class Tab {
     public void removePluginView(View view) {
         mPluginViews.remove(view);
     }
 
     public View[] getPluginViews() {
         return mPluginViews.toArray(new View[mPluginViews.size()]);
     }
 
-    public void addPluginLayer(Object surfaceOrView, Layer layer) {
-        synchronized (mPluginLayers) {
-            mPluginLayers.put(surfaceOrView, layer);
-        }
-    }
-
-    public Layer getPluginLayer(Object surfaceOrView) {
-        synchronized (mPluginLayers) {
-            return mPluginLayers.get(surfaceOrView);
-        }
-    }
-
-    public Collection<Layer> getPluginLayers() {
-        synchronized (mPluginLayers) {
-            return new ArrayList<Layer>(mPluginLayers.values());
-        }
-    }
-
-    public Layer removePluginLayer(Object surfaceOrView) {
-        synchronized (mPluginLayers) {
-            return mPluginLayers.remove(surfaceOrView);
-        }
-    }
-
     public int getBackgroundColor() {
         return mBackgroundColor;
     }
 
     /** Sets a new color for the background. */
     public void setBackgroundColor(int color) {
         mBackgroundColor = color;
     }
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -234,35 +234,32 @@ geckoview_java_files = [
     'gfx/DisplayPortMetrics.java',
     'gfx/DrawTimingQueue.java',
     'gfx/DynamicToolbarAnimator.java',
     'gfx/FloatSize.java',
     'gfx/FullScreenState.java',
     'gfx/GeckoLayerClient.java',
     'gfx/ImmutableViewportMetrics.java',
     'gfx/IntSize.java',
-    'gfx/Layer.java',
     'gfx/LayerRenderer.java',
     'gfx/LayerView.java',
     'gfx/NativePanZoomController.java',
     'gfx/Overscroll.java',
     'gfx/OverscrollEdgeEffect.java',
     'gfx/PanningPerfAPI.java',
     'gfx/PanZoomController.java',
     'gfx/PanZoomTarget.java',
-    'gfx/PluginLayer.java',
     'gfx/PointUtils.java',
     'gfx/ProgressiveUpdateData.java',
     'gfx/RectUtils.java',
     'gfx/RenderTask.java',
     'gfx/SimpleScaleGestureDetector.java',
     'gfx/StackScroller.java',
     'gfx/SubdocumentScrollHelper.java',
     'gfx/ViewTransform.java',
-    'gfx/VirtualLayer.java',
     'InputConnectionListener.java',
     'InputMethods.java',
     'notifications/AppNotificationClient.java',
     'notifications/NotificationClient.java',
     'notifications/NotificationHandler.java',
     'notifications/NotificationHelper.java',
     'notifications/NotificationReceiver.java',
     'notifications/NotificationService.java',
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
@@ -41,18 +41,16 @@ class GeckoLayerClient implements LayerV
     private final Context mContext;
     private IntSize mScreenSize;
     private IntSize mWindowSize;
     private DisplayPortMetrics mDisplayPort;
 
     private boolean mRecordDrawTimes;
     private final DrawTimingQueue mDrawTimingQueue;
 
-    private VirtualLayer mRootLayer;
-
     /* The Gecko viewport as per the UI thread. Must be touched only on the UI thread.
      * If any events being sent to Gecko that are relative to the Gecko viewport position,
      * they must (a) be relative to this viewport, and (b) be sent on the UI thread to
      * avoid races. As long as these two conditions are satisfied, and the events being
      * sent to Gecko are processed in FIFO order, the events will properly be relative
      * to the Gecko viewport position. Note that if Gecko updates its viewport independently,
      * we get notified synchronously and also update this on the UI thread.
      */
@@ -154,17 +152,16 @@ class GeckoLayerClient implements LayerV
         return mGeckoIsReady;
     }
 
     /** Attaches to root layer so that Gecko appears. */
     @WrapForJNI(calledFrom = "gecko")
     private void onGeckoReady() {
         mGeckoIsReady = true;
 
-        mRootLayer = new VirtualLayer(new IntSize(mView.getWidth(), mView.getHeight()));
         mLayerRenderer = mView.getRenderer();
 
         sendResizeEventIfNecessary(true, null);
 
         DisplayPortCalculator.initPrefs();
 
         // Gecko being ready is one of the two conditions (along with having an available
         // surface) that cause us to create the compositor. So here, now that we know gecko
@@ -198,20 +195,16 @@ class GeckoLayerClient implements LayerV
         if (!mPanZoomController.getRedrawHint()) {
             return false;
         }
 
         return DisplayPortCalculator.aboutToCheckerboard(mViewportMetrics,
                 mPanZoomController.getVelocityVector(), mDisplayPort);
     }
 
-    Layer getRoot() {
-        return mGeckoIsReady ? mRootLayer : null;
-    }
-
     public LayerView getView() {
         return mView;
     }
 
     public FloatSize getViewportSize() {
         return mViewportMetrics.getSize();
     }
 
@@ -622,22 +615,16 @@ class GeckoLayerClient implements LayerV
         // of the compositor thread.
         mFrameMetrics = getViewportMetrics();
 
         if (paintSyncId == sPaintSyncId) {
             mToolbarAnimator.scrollChangeResizeCompleted();
         }
         mToolbarAnimator.populateViewTransform(mCurrentViewTransform, mFrameMetrics);
 
-        if (mRootLayer != null) {
-            mRootLayer.setPositionAndResolution(
-                x, y, x + width, y + height,
-                resolution);
-        }
-
         if (layersUpdated && mRecordDrawTimes) {
             // If we got a layers update, that means a draw finished. Check to see if the area drawn matches
             // one of our requested displayports; if it does calculate the draw time and notify the
             // DisplayPortCalculator
             DisplayPortMetrics drawn = new DisplayPortMetrics(x, y, x + width, y + height, resolution);
             long time = mDrawTimingQueue.findTimeFor(drawn);
             if (time >= 0) {
                 long now = SystemClock.uptimeMillis();
@@ -901,29 +888,16 @@ class GeckoLayerClient implements LayerV
         try {
             return mLayerRenderer.createFrame(mFrameMetrics);
         } catch (Exception e) {
             Log.w(LOGTAG, e);
             return null;
         }
     }
 
-    @WrapForJNI
-    public void activateProgram() {
-        mLayerRenderer.activateDefaultProgram();
-    }
-
-    @WrapForJNI
-    public void deactivateProgramAndRestoreState(boolean enableScissor,
-            int scissorX, int scissorY, int scissorW, int scissorH)
-    {
-        mLayerRenderer.deactivateDefaultProgram();
-        mLayerRenderer.restoreState(enableScissor, scissorX, scissorY, scissorW, scissorH);
-    }
-
     private void geometryChanged(DisplayPortMetrics displayPort) {
         /* Let Gecko know if the screensize has changed */
         sendResizeEventIfNecessary(false, null);
     }
 
     /** Implementation of LayerView.Listener */
     @Override
     public void renderRequested() {
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/Layer.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * 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.util.FloatUtils;
-
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.graphics.RectF;
-
-import java.nio.FloatBuffer;
-import java.util.concurrent.locks.ReentrantLock;
-
-public abstract class Layer {
-    private final ReentrantLock mTransactionLock;
-    private boolean mInTransaction;
-    private Rect mNewPosition;
-    private float mNewResolution;
-
-    protected Rect mPosition;
-    protected float mResolution;
-
-    public Layer() {
-        this(null);
-    }
-
-    public Layer(IntSize size) {
-        mTransactionLock = new ReentrantLock();
-        if (size == null) {
-            mPosition = new Rect();
-        } else {
-            mPosition = new Rect(0, 0, size.width, size.height);
-        }
-        mResolution = 1.0f;
-    }
-
-    /**
-     * Updates the layer. This returns false if there is still work to be done
-     * after this update.
-     */
-    public final boolean update(RenderContext context) {
-        if (mTransactionLock.isHeldByCurrentThread()) {
-            throw new RuntimeException("draw() called while transaction lock held by this " +
-                                       "thread?!");
-        }
-
-        if (mTransactionLock.tryLock()) {
-            try {
-                performUpdates(context);
-                return true;
-            } finally {
-                mTransactionLock.unlock();
-            }
-        }
-
-        return false;
-    }
-
-    /** Subclasses override this function to draw the layer. */
-    public abstract void draw(RenderContext context);
-
-    /** Given the intrinsic size of the layer, returns the pixel boundaries of the layer rect. */
-    protected RectF getBounds(RenderContext context) {
-        return RectUtils.scale(new RectF(mPosition), context.zoomFactor / mResolution);
-    }
-
-    /**
-     * Call this before modifying the layer. Note that, for TileLayers, "modifying the layer"
-     * includes altering the underlying BufferedImage in any way. Thus you must call this function
-     * before modifying the byte buffer associated with this layer.
-     *
-     * This function may block, so you should never call this on the main UI thread.
-     */
-    public void beginTransaction() {
-        if (mTransactionLock.isHeldByCurrentThread())
-            throw new RuntimeException("Nested transactions are not supported");
-        mTransactionLock.lock();
-        mInTransaction = true;
-        mNewResolution = mResolution;
-    }
-
-    /** Call this when you're done modifying the layer. */
-    public void endTransaction() {
-        if (!mInTransaction)
-            throw new RuntimeException("endTransaction() called outside a transaction");
-        mInTransaction = false;
-        mTransactionLock.unlock();
-    }
-
-    /** Returns true if the layer is currently in a transaction and false otherwise. */
-    protected boolean inTransaction() {
-        return mInTransaction;
-    }
-
-    /** Returns the current layer position. */
-    public Rect getPosition() {
-        return mPosition;
-    }
-
-    /** Sets the position. Only valid inside a transaction. */
-    public void setPosition(Rect newPosition) {
-        if (!mInTransaction)
-            throw new RuntimeException("setPosition() is only valid inside a transaction");
-        mNewPosition = newPosition;
-    }
-
-    /** Returns the current layer's resolution. */
-    public float getResolution() {
-        return mResolution;
-    }
-
-    /**
-     * Sets the layer resolution. This value is used to determine how many pixels per
-     * device pixel this layer was rendered at. This will be reflected by scaling by
-     * the reciprocal of the resolution in the layer's transform() function.
-     * Only valid inside a transaction. */
-    public void setResolution(float newResolution) {
-        if (!mInTransaction)
-            throw new RuntimeException("setResolution() is only valid inside a transaction");
-        mNewResolution = newResolution;
-    }
-
-    /**
-     * Subclasses may override this method to perform custom layer updates. This will be called
-     * with the transaction lock held. Subclass implementations of this method must call the
-     * superclass implementation. Returns false if there is still work to be done after this
-     * update is complete.
-     */
-    protected void performUpdates(RenderContext context) {
-        if (mNewPosition != null) {
-            mPosition = mNewPosition;
-            mNewPosition = null;
-        }
-        if (mNewResolution != 0.0f) {
-            mResolution = mNewResolution;
-            mNewResolution = 0.0f;
-        }
-    }
-
-    /**
-     * This function fills in the provided <tt>dest</tt> array with values to render a texture.
-     * The array is filled with 4 sets of {x, y, z, texture_x, texture_y} values (so 20 values
-     * in total) corresponding to the corners of the rect.
-     */
-    protected final void fillRectCoordBuffer(float[] dest, RectF rect, float viewWidth, float viewHeight,
-                                             Rect cropRect, float texWidth, float texHeight) {
-        //x, y, z, texture_x, texture_y
-        dest[0] = rect.left / viewWidth;
-        dest[1] = rect.bottom / viewHeight;
-        dest[2] = 0;
-        dest[3] = cropRect.left / texWidth;
-        dest[4] = cropRect.top / texHeight;
-
-        dest[5] = rect.left / viewWidth;
-        dest[6] = rect.top / viewHeight;
-        dest[7] = 0;
-        dest[8] = cropRect.left / texWidth;
-        dest[9] = cropRect.bottom / texHeight;
-
-        dest[10] = rect.right / viewWidth;
-        dest[11] = rect.bottom / viewHeight;
-        dest[12] = 0;
-        dest[13] = cropRect.right / texWidth;
-        dest[14] = cropRect.top / texHeight;
-
-        dest[15] = rect.right / viewWidth;
-        dest[16] = rect.top / viewHeight;
-        dest[17] = 0;
-        dest[18] = cropRect.right / texWidth;
-        dest[19] = cropRect.bottom / texHeight;
-    }
-
-    public static class RenderContext {
-        public final RectF viewport;
-        public final RectF pageRect;
-        public final float zoomFactor;
-        public final int positionHandle;
-        public final int textureHandle;
-        public final FloatBuffer coordBuffer;
-
-        public RenderContext(RectF aViewport, RectF aPageRect, float aZoomFactor,
-                             int aPositionHandle, int aTextureHandle, FloatBuffer aCoordBuffer) {
-            viewport = aViewport;
-            pageRect = aPageRect;
-            zoomFactor = aZoomFactor;
-            positionHandle = aPositionHandle;
-            textureHandle = aTextureHandle;
-            coordBuffer = aCoordBuffer;
-        }
-
-        public boolean fuzzyEquals(RenderContext other) {
-            if (other == null) {
-                return false;
-            }
-            return RectUtils.fuzzyEquals(viewport, other.viewport)
-                && RectUtils.fuzzyEquals(pageRect, other.pageRect)
-                && FloatUtils.fuzzyEquals(zoomFactor, other.zoomFactor);
-        }
-    }
-}
-
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerRenderer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerRenderer.java
@@ -3,17 +3,16 @@
  * 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.AppConstants;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.R;
-import org.mozilla.gecko.gfx.Layer.RenderContext;
 import org.mozilla.gecko.mozglue.DirectBufferAllocator;
 
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Matrix;
 import android.graphics.PointF;
@@ -42,201 +41,67 @@ import javax.microedition.khronos.egl.EG
 public class LayerRenderer {
     private static final String LOGTAG = "GeckoLayerRenderer";
 
     /*
      * The amount of time a frame is allowed to take to render before we declare it a dropped
      * frame.
      */
     private static final int MAX_FRAME_TIME = 16;   /* 1000 ms / 60 FPS */
-
-    private static final int FRAME_RATE_METER_WIDTH = 128;
-    private static final int FRAME_RATE_METER_HEIGHT = 32;
-
     private static final long NANOS_PER_MS = 1000000;
-    private static final int NANOS_PER_SECOND = 1000000000;
-
     private static final int MAX_SCROLL_SPEED_TO_REQUEST_ZOOM_RENDER = 5;
 
     private final LayerView mView;
     private ByteBuffer mCoordByteBuffer;
     private FloatBuffer mCoordBuffer;
-    private RenderContext mLastPageContext;
     private int mMaxTextureSize;
-    private int mBackgroundColor;
 
     private long mLastFrameTime;
     private final CopyOnWriteArrayList<RenderTask> mTasks;
 
     // Dropped frames display
     private final int[] mFrameTimings;
     private int mCurrentFrame, mFrameTimingsSum, mDroppedFrames;
 
     private IntBuffer mPixelBuffer;
-
-    // Used by GLES 2.0
-    private int mProgram;
-    private int mPositionHandle;
-    private int mTextureHandle;
-    private int mSampleHandle;
-    private int mTMatrixHandle;
-
     private List<LayerView.ZoomedViewListener> mZoomedViewListeners;
     private float mLastViewLeft;
     private float mLastViewTop;
 
-    // column-major matrix applied to each vertex to shift the viewport from
-    // one ranging from (-1, -1),(1,1) to (0,0),(1,1) and to scale all sizes by
-    // a factor of 2 to fill up the screen
-    public static final float[] DEFAULT_TEXTURE_MATRIX = {
-        2.0f, 0.0f, 0.0f, 0.0f,
-        0.0f, 2.0f, 0.0f, 0.0f,
-        0.0f, 0.0f, 2.0f, 0.0f,
-        -1.0f, -1.0f, 0.0f, 1.0f
-    };
-
-    private static final int COORD_BUFFER_SIZE = 20;
-
-    // The shaders run on the GPU directly, the vertex shader is only applying the
-    // matrix transform detailed above
-
-    // Note we flip the y-coordinate in the vertex shader from a
-    // coordinate system with (0,0) in the top left to one with (0,0) in
-    // the bottom left.
-
-    public static final String DEFAULT_VERTEX_SHADER =
-        "uniform mat4 uTMatrix;\n" +
-        "attribute vec4 vPosition;\n" +
-        "attribute vec2 aTexCoord;\n" +
-        "varying vec2 vTexCoord;\n" +
-        "void main() {\n" +
-        "    gl_Position = uTMatrix * vPosition;\n" +
-        "    vTexCoord.x = aTexCoord.x;\n" +
-        "    vTexCoord.y = 1.0 - aTexCoord.y;\n" +
-        "}\n";
-
-    // We use highp because the screenshot textures
-    // we use are large and we stretch them alot
-    // so we need all the precision we can get.
-    // Unfortunately, highp is not required by ES 2.0
-    // so on GPU's like Mali we end up getting mediump
-    public static final String DEFAULT_FRAGMENT_SHADER =
-        "precision highp float;\n" +
-        "varying vec2 vTexCoord;\n" +
-        "uniform sampler2D sTexture;\n" +
-        "void main() {\n" +
-        "    gl_FragColor = texture2D(sTexture, vTexCoord);\n" +
-        "}\n";
-
     public LayerRenderer(LayerView view) {
         mView = view;
 
-        final BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
-        bitmapOptions.inScaled = false;
-        Bitmap scrollbarImage =
-                BitmapUtils.decodeResource(view.getContext(), R.drawable.scrollbar, bitmapOptions);
-        IntSize size = new IntSize(scrollbarImage.getWidth(), scrollbarImage.getHeight());
-        scrollbarImage = expandCanvasToPowerOfTwo(scrollbarImage, size);
-
         mTasks = new CopyOnWriteArrayList<RenderTask>();
         mLastFrameTime = System.nanoTime();
 
         mFrameTimings = new int[60];
         mCurrentFrame = mFrameTimingsSum = mDroppedFrames = 0;
 
         mZoomedViewListeners = new ArrayList<LayerView.ZoomedViewListener>();
     }
 
-    private Bitmap expandCanvasToPowerOfTwo(Bitmap image, IntSize size) {
-        IntSize potSize = size.nextPowerOfTwo();
-        if (size.equals(potSize)) {
-            return image;
-        }
-        // make the bitmap size a power-of-two in both dimensions if it's not already.
-        Bitmap potImage = Bitmap.createBitmap(potSize.width, potSize.height, image.getConfig());
-        new Canvas(potImage).drawBitmap(image, new Matrix(), null);
-        return potImage;
-    }
-
-    private Bitmap diagonalFlip(Bitmap image) {
-        Matrix rotation = new Matrix();
-        rotation.setValues(new float[] { 0, 1, 0, 1, 0, 0, 0, 0, 1 }); // transform (x,y) into (y,x)
-        Bitmap rotated = Bitmap.createBitmap(image, 0, 0, image.getWidth(), image.getHeight(), rotation, true);
-        return rotated;
-    }
-
     public void destroy() {
         if (mCoordByteBuffer != null) {
             DirectBufferAllocator.free(mCoordByteBuffer);
             mCoordByteBuffer = null;
             mCoordBuffer = null;
         }
         mZoomedViewListeners.clear();
     }
 
     void onSurfaceCreated(EGLConfig config) {
         createDefaultProgram();
-        activateDefaultProgram();
     }
 
     public void createDefaultProgram() {
-        int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, DEFAULT_VERTEX_SHADER);
-        int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, DEFAULT_FRAGMENT_SHADER);
-
-        mProgram = GLES20.glCreateProgram();
-        GLES20.glAttachShader(mProgram, vertexShader);   // add the vertex shader to program
-        GLES20.glAttachShader(mProgram, fragmentShader); // add the fragment shader to program
-        GLES20.glLinkProgram(mProgram);                  // creates OpenGL program executables
-
-        // Get handles to the vertex shader's vPosition, aTexCoord, sTexture, and uTMatrix members.
-        mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
-        mTextureHandle = GLES20.glGetAttribLocation(mProgram, "aTexCoord");
-        mSampleHandle = GLES20.glGetUniformLocation(mProgram, "sTexture");
-        mTMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uTMatrix");
-
         int maxTextureSizeResult[] = new int[1];
         GLES20.glGetIntegerv(GLES20.GL_MAX_TEXTURE_SIZE, maxTextureSizeResult, 0);
         mMaxTextureSize = maxTextureSizeResult[0];
     }
 
-    // Activates the shader program.
-    public void activateDefaultProgram() {
-        // Add the program to the OpenGL environment
-        GLES20.glUseProgram(mProgram);
-
-        // Set the transformation matrix
-        GLES20.glUniformMatrix4fv(mTMatrixHandle, 1, false, DEFAULT_TEXTURE_MATRIX, 0);
-
-        // Enable the arrays from which we get the vertex and texture coordinates
-        GLES20.glEnableVertexAttribArray(mPositionHandle);
-        GLES20.glEnableVertexAttribArray(mTextureHandle);
-
-        GLES20.glUniform1i(mSampleHandle, 0);
-
-        // TODO: Move these calls into a separate deactivate() call that is called after the
-        // underlay and overlay are rendered.
-    }
-
-    // Deactivates the shader program. This must be done to avoid crashes after returning to the
-    // Gecko C++ compositor from Java.
-    public void deactivateDefaultProgram() {
-        GLES20.glDisableVertexAttribArray(mTextureHandle);
-        GLES20.glDisableVertexAttribArray(mPositionHandle);
-        GLES20.glUseProgram(0);
-    }
-
-    void restoreState(boolean enableScissor, int scissorX, int scissorY, int scissorW, int scissorH) {
-        GLES20.glScissor(scissorX, scissorY, scissorW, scissorH);
-        if (enableScissor) {
-            GLES20.glEnable(GLES20.GL_SCISSOR_TEST);
-        } else {
-            GLES20.glDisable(GLES20.GL_SCISSOR_TEST);
-        }
-    }
-
     public int getMaxTextureSize() {
         return mMaxTextureSize;
     }
 
     public void postRenderTask(RenderTask aTask) {
         mTasks.add(aTask);
         mView.requestRender();
     }
@@ -270,206 +135,67 @@ public class LayerRenderer {
                 pixelBuffer.wait();
             } catch (InterruptedException ie) {
             }
             mPixelBuffer = null;
         }
         return pixelBuffer;
     }
 
-    private RenderContext createScreenContext(ImmutableViewportMetrics metrics) {
-        RectF viewport = new RectF(0.0f, 0.0f, metrics.getWidth(), metrics.getHeight());
-        RectF pageRect = metrics.getPageRect();
-
-        return createContext(viewport, pageRect, 1.0f);
-    }
-
-    private RenderContext createPageContext(ImmutableViewportMetrics metrics) {
-        RectF viewport = metrics.getViewport();
-        RectF pageRect = metrics.getPageRect();
-        float zoomFactor = metrics.zoomFactor;
-
-        return createContext(new RectF(RectUtils.round(viewport)), pageRect, zoomFactor);
-    }
-
-    private RenderContext createContext(RectF viewport, RectF pageRect, float zoomFactor) {
-        if (mCoordBuffer == null) {
-            // Initialize the FloatBuffer that will be used to store all vertices and texture
-            // coordinates in draw() commands.
-            mCoordByteBuffer = DirectBufferAllocator.allocate(COORD_BUFFER_SIZE * 4);
-            mCoordByteBuffer.order(ByteOrder.nativeOrder());
-            mCoordBuffer = mCoordByteBuffer.asFloatBuffer();
-            if (mCoordBuffer == null) {
-                throw new IllegalStateException();
-            }
-        }
-        return new RenderContext(viewport, pageRect, zoomFactor,
-                                 mPositionHandle, mTextureHandle, mCoordBuffer);
-    }
-
     private void updateDroppedFrames(long frameStartTime) {
         int frameElapsedTime = (int)((System.nanoTime() - frameStartTime) / NANOS_PER_MS);
 
         /* Update the running statistics. */
         mFrameTimingsSum -= mFrameTimings[mCurrentFrame];
         mFrameTimingsSum += frameElapsedTime;
         mDroppedFrames -= (mFrameTimings[mCurrentFrame] + 1) / MAX_FRAME_TIME;
         mDroppedFrames += (frameElapsedTime + 1) / MAX_FRAME_TIME;
 
         mFrameTimings[mCurrentFrame] = frameElapsedTime;
         mCurrentFrame = (mCurrentFrame + 1) % mFrameTimings.length;
 
         int averageTime = mFrameTimingsSum / mFrameTimings.length;
     }
 
-    /*
-     * create a vertex shader type (GLES20.GL_VERTEX_SHADER)
-     * or a fragment shader type (GLES20.GL_FRAGMENT_SHADER)
-     */
-    public static int loadShader(int type, String shaderCode) {
-        int shader = GLES20.glCreateShader(type);
-        GLES20.glShaderSource(shader, shaderCode);
-        GLES20.glCompileShader(shader);
-        return shader;
-    }
-
     public Frame createFrame(ImmutableViewportMetrics metrics) {
         return new Frame(metrics);
     }
 
-    class FadeRunnable implements Runnable {
-        private boolean mStarted;
-        long mRunAt; // Would be private but we need both file access and high performance.
-
-        void scheduleStartFade(long delay) {
-            mRunAt = SystemClock.elapsedRealtime() + delay;
-            if (!mStarted) {
-                mView.postDelayed(this, delay);
-                mStarted = true;
-            }
-        }
-
-        void scheduleNextFadeFrame() {
-            if (mStarted) {
-                Log.e(LOGTAG, "scheduleNextFadeFrame() called while scheduled for starting fade");
-            }
-            mView.postDelayed(this, 1000L / 60L); // request another frame at 60fps
-        }
-
-        boolean timeToFade() {
-            return !mStarted;
-        }
-
-        @Override
-        public void run() {
-            long timeDelta = mRunAt - SystemClock.elapsedRealtime();
-            if (timeDelta > 0) {
-                // the run-at time was pushed back, so reschedule
-                mView.postDelayed(this, timeDelta);
-            } else {
-                // reached the run-at time, execute
-                mStarted = false;
-                mView.requestRender();
-            }
-        }
-    }
-
     public class Frame {
         // The timestamp recording the start of this frame.
         private long mFrameStartTime;
         // A fixed snapshot of the viewport metrics that this frame is using to render content.
         private final ImmutableViewportMetrics mFrameMetrics;
-        // A rendering context for page-positioned layers, and one for screen-positioned layers.
-        private final RenderContext mPageContext, mScreenContext;
-        // Whether a layer was updated.
-        private boolean mUpdated;
-        private final Rect mPageRect;
-        private final Rect mAbsolutePageRect;
 
         public Frame(ImmutableViewportMetrics metrics) {
             mFrameMetrics = metrics;
-
-            // Work out the offset due to margins
-            Layer rootLayer = mView.getLayerClient().getRoot();
-            mPageContext = createPageContext(metrics);
-            mScreenContext = createScreenContext(metrics);
-
-            RectF pageRect = mFrameMetrics.getPageRect();
-            mAbsolutePageRect = RectUtils.round(pageRect);
-
-            PointF origin = mFrameMetrics.getOrigin();
-            pageRect.offset(-origin.x, -origin.y);
-            mPageRect = RectUtils.round(pageRect);
         }
 
         /** This function is invoked via JNI; be careful when modifying signature. */
         @WrapForJNI
         public void beginDrawing() {
             mFrameStartTime = System.nanoTime();
 
-            mUpdated = true;
-
-            Layer rootLayer = mView.getLayerClient().getRoot();
-
             // Run through pre-render tasks
             runRenderTasks(mTasks, false, mFrameStartTime);
-
-            /* Update layers. */
-            if (rootLayer != null) {
-                // Called on compositor thread.
-                mUpdated &= rootLayer.update(mPageContext);
-            }
-        }
-
-        private void clear(int color) {
-            GLES20.glClearColor(((color >> 16) & 0xFF) / 255.0f,
-                                ((color >> 8) & 0xFF) / 255.0f,
-                                (color & 0xFF) / 255.0f,
-                                0.0f);
-            // The bits set here need to match up with those used
-            // in gfx/layers/opengl/LayerManagerOGL.cpp.
-            GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT |
-                           GLES20.GL_DEPTH_BUFFER_BIT);
         }
 
-        /** This function is invoked via JNI; be careful when modifying signature. */
-        @WrapForJNI
-        public void drawBackground() {
-            // Any GL state which is changed here must be restored in
-            // restoreState(...)
 
-            GLES20.glDisable(GLES20.GL_SCISSOR_TEST);
-
-            // Update background color.
-            mBackgroundColor = mView.getBackgroundColor();
-
-            // Clear the page area to the page background colour.
-            clear(mBackgroundColor);
-        }
-
-        @WrapForJNI
-        public void drawForeground() {
-            // Any GL state which is changed here must be restored in
-            // restoreState(...)
-
-            runRenderTasks(mTasks, true, mFrameStartTime);
-        }
-
-        private void maybeRequestZoomedViewRender(RenderContext context) {
+        private void maybeRequestZoomedViewRender() {
             // Concurrently update of mZoomedViewListeners should not be an issue here
             // because the following line is just a short-circuit
             if (mZoomedViewListeners.size() == 0) {
                 return;
             }
 
             // When scrolling fast, do not request zoomed view render to avoid to slow down
             // the scroll in the main view.
             // Speed is estimated using the offset changes between 2 display frame calls
-            final float viewLeft = context.viewport.left;
-            final float viewTop = context.viewport.top;
+            final float viewLeft = Math.round(mFrameMetrics.getViewport().left);
+            final float viewTop = Math.round(mFrameMetrics.getViewport().top);
             boolean shouldWaitToRender = false;
 
             if (Math.abs(mLastViewLeft - viewLeft) > MAX_SCROLL_SPEED_TO_REQUEST_ZOOM_RENDER ||
                 Math.abs(mLastViewTop - viewTop) > MAX_SCROLL_SPEED_TO_REQUEST_ZOOM_RENDER) {
                 shouldWaitToRender = true;
             }
 
             mLastViewLeft = viewLeft;
@@ -484,34 +210,32 @@ public class LayerRenderer {
                 public void run() {
                     for (LayerView.ZoomedViewListener listener : mZoomedViewListeners) {
                         listener.requestZoomedViewRender();
                     }
                 }
             });
         }
 
+
         /** This function is invoked via JNI; be careful when modifying signature. */
         @WrapForJNI
         public void endDrawing() {
-            // If a layer update requires further work, schedule another redraw
-            if (!mUpdated)
-                mView.requestRender();
-
             PanningPerfAPI.recordFrameTime();
 
-            maybeRequestZoomedViewRender(mPageContext);
+            runRenderTasks(mTasks, true, mFrameStartTime);
+            maybeRequestZoomedViewRender();
 
             /* Used by robocop for testing purposes */
             IntBuffer pixelBuffer = mPixelBuffer;
-            if (mUpdated && pixelBuffer != null) {
+            if (pixelBuffer != null) {
                 synchronized (pixelBuffer) {
                     pixelBuffer.position(0);
-                    GLES20.glReadPixels(0, 0, (int)mScreenContext.viewport.width(),
-                                        (int)mScreenContext.viewport.height(), GLES20.GL_RGBA,
+                    GLES20.glReadPixels(0, 0, Math.round(mFrameMetrics.getWidth()),
+                                        Math.round(mFrameMetrics.getHeight()), GLES20.GL_RGBA,
                                         GLES20.GL_UNSIGNED_BYTE, pixelBuffer);
                     pixelBuffer.notify();
                 }
             }
 
             // Remove background color once we've painted. GeckoLayerClient is
             // responsible for setting this flag before current document is
             // composited.
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/PluginLayer.java
+++ /dev/null
@@ -1,167 +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;
-
-import org.mozilla.gecko.GeckoAppShell;
-import org.mozilla.gecko.util.FloatUtils;
-import org.mozilla.gecko.util.ThreadUtils;
-
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.view.SurfaceView;
-import android.view.View;
-import android.widget.AbsoluteLayout;
-
-public class PluginLayer extends Layer {
-    private static final String LOGTAG = "PluginLayer";
-
-    private final View mView;
-    private SurfaceView mSurfaceView;
-    private final PluginLayoutParams mLayoutParams;
-    private final AbsoluteLayout mContainer;
-
-    private boolean mDestroyed;
-    private boolean mViewVisible;
-
-    private RectF mLastViewport;
-    private float mLastZoomFactor;
-
-    private static final float TEXTURE_MAP[] = {
-                0.0f, 1.0f, // top left
-                0.0f, 0.0f, // bottom left
-                1.0f, 1.0f, // top right
-                1.0f, 0.0f, // bottom right
-    };
-
-    public PluginLayer(View view, RectF rect, int maxDimension) {
-        super(new IntSize(0, 0));
-
-        mView = view;
-        mContainer = GeckoAppShell.getGeckoInterface().getPluginContainer();
-
-        mView.setWillNotDraw(false);
-        if (mView instanceof SurfaceView) {
-            mSurfaceView = (SurfaceView)view;
-            mSurfaceView.setZOrderOnTop(false);
-            mSurfaceView.setZOrderMediaOverlay(true);
-        }
-
-        mLayoutParams = new PluginLayoutParams(rect, maxDimension);
-    }
-
-    public void setVisible(boolean visible) {
-        if (visible) {
-            showView();
-        } else {
-            hideView();
-        }
-    }
-
-    private void hideView() {
-        if (mViewVisible) {
-            ThreadUtils.postToUiThread(new Runnable() {
-                @Override
-                public void run() {
-                    mView.setVisibility(View.GONE);
-                    mViewVisible = false;
-                }
-            });
-        }
-    }
-
-    public void showView() {
-        ThreadUtils.postToUiThread(new Runnable() {
-            @Override
-            public void run() {
-                if (mContainer.indexOfChild(mView) < 0) {
-                    mContainer.addView(mView, mLayoutParams);
-                } else {
-                    mContainer.updateViewLayout(mView, mLayoutParams);
-                    mView.setVisibility(View.VISIBLE);
-                }
-                mViewVisible = true;
-            }
-        });
-    }
-
-    public void destroy() {
-        mDestroyed = true;
-
-        mContainer.removeView(mView);
-    }
-
-    public void reset(RectF rect) {
-        mLayoutParams.reset(rect);
-    }
-
-    @Override
-    protected void performUpdates(RenderContext context) {
-        if (mDestroyed)
-            return;
-
-        if (!RectUtils.fuzzyEquals(context.viewport, mLastViewport) ||
-            !FloatUtils.fuzzyEquals(context.zoomFactor, mLastZoomFactor)) {
-
-            mLastZoomFactor = context.zoomFactor;
-            mLastViewport = context.viewport;
-            mLayoutParams.reposition(context.viewport, context.zoomFactor);
-
-            showView();
-        }
-    }
-
-    @Override
-    public void draw(RenderContext context) {
-    }
-
-    class PluginLayoutParams extends AbsoluteLayout.LayoutParams
-    {
-        private static final String LOGTAG = "GeckoApp.PluginLayoutParams";
-
-        private RectF mRect;
-        private final int mMaxDimension;
-        private float mLastResolution;
-
-        public PluginLayoutParams(RectF rect, int maxDimension) {
-            super(0, 0, 0, 0);
-
-            mMaxDimension = maxDimension;
-            reset(rect);
-        }
-
-        private void clampToMaxSize() {
-            if (width > mMaxDimension || height > mMaxDimension) {
-                if (width > height) {
-                    height = Math.round(((float) height / width) * mMaxDimension);
-                    width = mMaxDimension;
-                } else {
-                    width = Math.round(((float) width / height) * mMaxDimension);
-                    height = mMaxDimension;
-                }
-            }
-        }
-
-        public void reset(RectF rect) {
-            mRect = rect;
-        }
-
-        public void reposition(RectF viewport, float zoomFactor) {
-
-            RectF scaled = RectUtils.scale(mRect, zoomFactor);
-
-            this.x = Math.round(scaled.left - viewport.left);
-            this.y = Math.round(scaled.top - viewport.top);
-
-            if (!FloatUtils.fuzzyEquals(mLastResolution, zoomFactor)) {
-                width = Math.round(mRect.width() * zoomFactor);
-                height = Math.round(mRect.height() * zoomFactor);
-                mLastResolution = zoomFactor;
-
-                clampToMaxSize();
-            }
-        }
-    }
-}
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/VirtualLayer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * 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;
-
-public class VirtualLayer extends Layer {
-    public VirtualLayer(IntSize size) {
-        super(size);
-    }
-
-    @Override
-    public void draw(RenderContext context) {
-        // No-op.
-    }
-
-    void setPositionAndResolution(int left, int top, int right, int bottom, float newResolution) {
-        // This is an optimized version of the following code:
-        // beginTransaction();
-        // try {
-        //     setPosition(new Rect(left, top, right, bottom));
-        //     setResolution(newResolution);
-        //     performUpdates(null);
-        // } finally {
-        //     endTransaction();
-        // }
-
-        // it is safe to drop the transaction lock in this instance (i.e. for the
-        // VirtualLayer that is just a shadow of what gecko is painting) because
-        // the position and resolution of this layer are always touched on the compositor
-        // thread, and therefore do not require synchronization.
-        mPosition.set(left, top, right, bottom);
-        mResolution = newResolution;
-    }
-}
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -1240,48 +1240,32 @@ constexpr char DisplayPortMetrics::Resol
 auto DisplayPortMetrics::Resolution() const -> float
 {
     return mozilla::jni::Field<Resolution_t>::Get(DisplayPortMetrics::mCtx, nullptr);
 }
 
 const char GeckoLayerClient::name[] =
         "org/mozilla/gecko/gfx/GeckoLayerClient";
 
-constexpr char GeckoLayerClient::ActivateProgram_t::name[];
-constexpr char GeckoLayerClient::ActivateProgram_t::signature[];
-
-auto GeckoLayerClient::ActivateProgram() const -> void
-{
-    return mozilla::jni::Method<ActivateProgram_t>::Call(GeckoLayerClient::mCtx, nullptr);
-}
-
 constexpr char GeckoLayerClient::ContentDocumentChanged_t::name[];
 constexpr char GeckoLayerClient::ContentDocumentChanged_t::signature[];
 
 auto GeckoLayerClient::ContentDocumentChanged() const -> void
 {
     return mozilla::jni::Method<ContentDocumentChanged_t>::Call(GeckoLayerClient::mCtx, nullptr);
 }
 
 constexpr char GeckoLayerClient::CreateFrame_t::name[];
 constexpr char GeckoLayerClient::CreateFrame_t::signature[];
 
 auto GeckoLayerClient::CreateFrame() const -> mozilla::jni::Object::LocalRef
 {
     return mozilla::jni::Method<CreateFrame_t>::Call(GeckoLayerClient::mCtx, nullptr);
 }
 
-constexpr char GeckoLayerClient::DeactivateProgramAndRestoreState_t::name[];
-constexpr char GeckoLayerClient::DeactivateProgramAndRestoreState_t::signature[];
-
-auto GeckoLayerClient::DeactivateProgramAndRestoreState(bool a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4) const -> void
-{
-    return mozilla::jni::Method<DeactivateProgramAndRestoreState_t>::Call(GeckoLayerClient::mCtx, nullptr, a0, a1, a2, a3, a4);
-}
-
 constexpr char GeckoLayerClient::IsContentDocumentDisplayed_t::name[];
 constexpr char GeckoLayerClient::IsContentDocumentDisplayed_t::signature[];
 
 auto GeckoLayerClient::IsContentDocumentDisplayed() const -> bool
 {
     return mozilla::jni::Method<IsContentDocumentDisplayed_t>::Call(GeckoLayerClient::mCtx, nullptr);
 }
 
@@ -1369,32 +1353,16 @@ const char LayerRenderer::Frame::name[] 
 constexpr char LayerRenderer::Frame::BeginDrawing_t::name[];
 constexpr char LayerRenderer::Frame::BeginDrawing_t::signature[];
 
 auto LayerRenderer::Frame::BeginDrawing() const -> void
 {
     return mozilla::jni::Method<BeginDrawing_t>::Call(Frame::mCtx, nullptr);
 }
 
-constexpr char LayerRenderer::Frame::DrawBackground_t::name[];
-constexpr char LayerRenderer::Frame::DrawBackground_t::signature[];
-
-auto LayerRenderer::Frame::DrawBackground() const -> void
-{
-    return mozilla::jni::Method<DrawBackground_t>::Call(Frame::mCtx, nullptr);
-}
-
-constexpr char LayerRenderer::Frame::DrawForeground_t::name[];
-constexpr char LayerRenderer::Frame::DrawForeground_t::signature[];
-
-auto LayerRenderer::Frame::DrawForeground() const -> void
-{
-    return mozilla::jni::Method<DrawForeground_t>::Call(Frame::mCtx, nullptr);
-}
-
 constexpr char LayerRenderer::Frame::EndDrawing_t::name[];
 constexpr char LayerRenderer::Frame::EndDrawing_t::signature[];
 
 auto LayerRenderer::Frame::EndDrawing() const -> void
 {
     return mozilla::jni::Method<EndDrawing_t>::Call(Frame::mCtx, nullptr);
 }
 
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -3986,35 +3986,16 @@ public:
 
 class GeckoLayerClient : public mozilla::jni::ObjectBase<GeckoLayerClient>
 {
 public:
     static const char name[];
 
     explicit GeckoLayerClient(const Context& ctx) : ObjectBase<GeckoLayerClient>(ctx) {}
 
-    struct ActivateProgram_t {
-        typedef GeckoLayerClient Owner;
-        typedef void ReturnType;
-        typedef void SetterType;
-        typedef mozilla::jni::Args<> Args;
-        static constexpr char name[] = "activateProgram";
-        static constexpr char signature[] =
-                "()V";
-        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 ActivateProgram() const -> void;
-
     struct ContentDocumentChanged_t {
         typedef GeckoLayerClient Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "contentDocumentChanged";
         static constexpr char signature[] =
                 "()V";
@@ -4043,40 +4024,16 @@ public:
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
                 mozilla::jni::DispatchTarget::CURRENT;
     };
 
     auto CreateFrame() const -> mozilla::jni::Object::LocalRef;
 
-    struct DeactivateProgramAndRestoreState_t {
-        typedef GeckoLayerClient Owner;
-        typedef void ReturnType;
-        typedef void SetterType;
-        typedef mozilla::jni::Args<
-                bool,
-                int32_t,
-                int32_t,
-                int32_t,
-                int32_t> Args;
-        static constexpr char name[] = "deactivateProgramAndRestoreState";
-        static constexpr char signature[] =
-                "(ZIIII)V";
-        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 DeactivateProgramAndRestoreState(bool, int32_t, int32_t, int32_t, int32_t) const -> void;
-
     struct IsContentDocumentDisplayed_t {
         typedef GeckoLayerClient Owner;
         typedef bool ReturnType;
         typedef bool SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "isContentDocumentDisplayed";
         static constexpr char signature[] =
                 "()Z";
@@ -4375,54 +4332,16 @@ public:
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
                 mozilla::jni::DispatchTarget::CURRENT;
     };
 
     auto BeginDrawing() const -> void;
 
-    struct DrawBackground_t {
-        typedef Frame Owner;
-        typedef void ReturnType;
-        typedef void SetterType;
-        typedef mozilla::jni::Args<> Args;
-        static constexpr char name[] = "drawBackground";
-        static constexpr char signature[] =
-                "()V";
-        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 DrawBackground() const -> void;
-
-    struct DrawForeground_t {
-        typedef Frame Owner;
-        typedef void ReturnType;
-        typedef void SetterType;
-        typedef mozilla::jni::Args<> Args;
-        static constexpr char name[] = "drawForeground";
-        static constexpr char signature[] =
-                "()V";
-        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 DrawForeground() const -> void;
-
     struct EndDrawing_t {
         typedef Frame Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "endDrawing";
         static constexpr char signature[] =
                 "()V";
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -3312,56 +3312,31 @@ nsWindow::DrawWindowUnderlay(LayerManage
     if (NS_WARN_IF(!mLayerRendererFrame)) {
         return;
     }
 
     if (!WidgetPaintsBackground()) {
         return;
     }
 
-    CompositorOGL *compositor = static_cast<CompositorOGL*>(aManager->GetCompositor());
-    compositor->ResetProgram();
-    gl::GLContext* gl = compositor->gl();
-    bool scissorEnabled = gl->fIsEnabled(LOCAL_GL_SCISSOR_TEST);
-    GLint scissorRect[4];
-    gl->fGetIntegerv(LOCAL_GL_SCISSOR_BOX, scissorRect);
-
-    client->ActivateProgram();
     frame->BeginDrawing();
-    frame->DrawBackground();
-    client->DeactivateProgramAndRestoreState(scissorEnabled,
-        scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);
 }
 
 void
 nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager,
                             LayoutDeviceIntRect aRect)
 {
     PROFILER_LABEL("nsWindow", "DrawWindowOverlay",
         js::ProfileEntry::Category::GRAPHICS);
 
     if (Destroyed() || NS_WARN_IF(!mLayerRendererFrame)) {
         return;
     }
 
-    CompositorOGL *compositor = static_cast<CompositorOGL*>(aManager->GetCompositor());
-    compositor->ResetProgram();
-    gl::GLContext* gl = compositor->gl();
-    bool scissorEnabled = gl->fIsEnabled(LOCAL_GL_SCISSOR_TEST);
-    GLint scissorRect[4];
-    gl->fGetIntegerv(LOCAL_GL_SCISSOR_BOX, scissorRect);
-
-    MOZ_ASSERT(mLayerViewSupport);
-    GeckoLayerClient::LocalRef client = mLayerViewSupport->GetLayerClient();
-
-    client->ActivateProgram();
-    mLayerRendererFrame->DrawForeground();
     mLayerRendererFrame->EndDrawing();
-    client->DeactivateProgramAndRestoreState(scissorEnabled,
-        scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);
     mLayerRendererFrame = nullptr;
 }
 
 // off-main-thread compositor fields and functions
 
 void
 nsWindow::InvalidateAndScheduleComposite()
 {