Remove dead code

Test: builds
Change-Id: I57cf72ca460115463d7759097d5ba598b5ec1775
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index e2e3420..2454ae3 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -170,7 +170,6 @@
         "pipeline/skia/SkiaRecordingCanvas.cpp",
         "pipeline/skia/SkiaVulkanPipeline.cpp",
         "pipeline/skia/VectorDrawableAtlas.cpp",
-        "renderstate/OffscreenBufferPool.cpp",
         "renderstate/PixelBufferState.cpp",
         "renderstate/RenderState.cpp",
         "renderstate/TextureState.cpp",
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 8cf115e..2541444 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -44,12 +44,10 @@
 // Constructors/destructor
 ///////////////////////////////////////////////////////////////////////////////
 
-Caches::Caches(RenderState& renderState) : mRenderState(&renderState), mInitialized(false) {
+Caches::Caches(RenderState& renderState) : mInitialized(false) {
     INIT_LOGD("Creating OpenGL renderer caches");
     init();
-    initConstraints();
     initStaticProperties();
-    initExtensions();
 }
 
 bool Caches::init() {
@@ -68,23 +66,6 @@
     return true;
 }
 
-void Caches::initExtensions() {
-    if (extensions().hasDebugMarker()) {
-        eventMark = glInsertEventMarkerEXT;
-
-        startMark = glPushGroupMarkerEXT;
-        endMark = glPopGroupMarkerEXT;
-    } else {
-        eventMark = eventMarkNull;
-        startMark = startMarkNull;
-        endMark = endMarkNull;
-    }
-}
-
-void Caches::initConstraints() {
-    maxTextureSize = DeviceInfo::get()->maxTextureSize();
-}
-
 void Caches::initStaticProperties() {
     // OpenGL ES 3.0+ specific features
     gpuPixelBuffersEnabled = extensions().hasPixelBufferObjects() &&
@@ -105,49 +86,6 @@
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-// Debug
-///////////////////////////////////////////////////////////////////////////////
-
-uint32_t Caches::getOverdrawColor(uint32_t amount) const {
-    static uint32_t sOverdrawColors[2][4] = {{0x2f0000ff, 0x2f00ff00, 0x3fff0000, 0x7fff0000},
-                                             {0x2f0000ff, 0x4fffff00, 0x5fff8ad8, 0x7fff0000}};
-    if (amount < 1) amount = 1;
-    if (amount > 4) amount = 4;
-
-    int overdrawColorIndex = static_cast<int>(Properties::overdrawColorSet);
-    return sOverdrawColors[overdrawColorIndex][amount - 1];
-}
-
-void Caches::dumpMemoryUsage() {
-    String8 stringLog;
-    dumpMemoryUsage(stringLog);
-    ALOGD("%s", stringLog.string());
-}
-
-void Caches::dumpMemoryUsage(String8& log) {
-    uint32_t total = 0;
-    log.appendFormat("Current memory usage / total memory usage (bytes):\n");
-    if (mRenderState) {
-        int memused = 0;
-        for (std::set<Layer*>::iterator it = mRenderState->mActiveLayers.begin();
-             it != mRenderState->mActiveLayers.end(); it++) {
-            const Layer* layer = *it;
-            LOG_ALWAYS_FATAL_IF(layer->getApi() != Layer::Api::OpenGL);
-            const GlLayer* glLayer = static_cast<const GlLayer*>(layer);
-            log.appendFormat("    GlLayer size %dx%d; texid=%u refs=%d\n", layer->getWidth(),
-                             layer->getHeight(), glLayer->getTextureId(), layer->getStrongCount());
-            memused += layer->getWidth() * layer->getHeight() * 4;
-        }
-        log.appendFormat("  Layers total   %8d (numLayers = %zu)\n", memused,
-                         mRenderState->mActiveLayers.size());
-        total += memused;
-    }
-
-    log.appendFormat("Total memory usage:\n");
-    log.appendFormat("  %d bytes, %.2f MB\n", total, total / 1024.0f / 1024.0f);
-}
-
-///////////////////////////////////////////////////////////////////////////////
 // Memory management
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -161,17 +99,5 @@
     GLUtils::dumpGLErrors();
 }
 
-///////////////////////////////////////////////////////////////////////////////
-// Regions
-///////////////////////////////////////////////////////////////////////////////
-
-TextureVertex* Caches::getRegionMesh() {
-    return nullptr;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Temporary Properties
-///////////////////////////////////////////////////////////////////////////////
-
 };  // namespace uirenderer
 };  // namespace android
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index 5afa92c..642f9dc 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -90,30 +90,12 @@
     void terminate();
 
     /**
-     * Returns a non-premultiplied ARGB color for the specified
-     * amount of overdraw (1 for 1x, 2 for 2x, etc.)
-     */
-    uint32_t getOverdrawColor(uint32_t amount) const;
-
-    /**
      * Call this on each frame to ensure that garbage is deleted from
      * GPU memory.
      */
     void clearGarbage();
 
     /**
-     * Can be used to delete a layer from a non EGL thread.
-     */
-    void deleteLayerDeferred(Layer* layer);
-
-    /**
-     * Returns the mesh used to draw regions. Calling this method will
-     * bind a VBO of type GL_ELEMENT_ARRAY_BUFFER that contains the
-     * indices for the region mesh.
-     */
-    TextureVertex* getRegionMesh();
-
-    /**
      * Returns the GL RGBA internal format to use for the current device
      * If the device supports linear blending and needSRGB is true,
      * this function returns GL_SRGB8_ALPHA8, otherwise it returns GL_RGBA
@@ -122,46 +104,25 @@
         return extensions().hasLinearBlending() && needSRGB ? GL_SRGB8_ALPHA8 : GL_RGBA;
     }
 
-    /**
-     * Displays the memory usage of each cache and the total sum.
-     */
-    void dumpMemoryUsage();
-    void dumpMemoryUsage(String8& log);
-
-    // Misc
-    GLint maxTextureSize;
-
 public:
     TaskManager tasks;
 
     bool gpuPixelBuffersEnabled;
 
-    // Debug methods
-    PFNGLINSERTEVENTMARKEREXTPROC eventMark;
-    PFNGLPUSHGROUPMARKEREXTPROC startMark;
-    PFNGLPOPGROUPMARKEREXTPROC endMark;
-
     const Extensions& extensions() const { return DeviceInfo::get()->extensions(); }
     PixelBufferState& pixelBufferState() { return *mPixelBufferState; }
     TextureState& textureState() { return *mTextureState; }
 
 private:
-    void initExtensions();
-    void initConstraints();
     void initStaticProperties();
 
     static void eventMarkNull(GLsizei length, const GLchar* marker) {}
     static void startMarkNull(GLsizei length, const GLchar* marker) {}
     static void endMarkNull() {}
 
-    RenderState* mRenderState;
-
     // Used to render layers
     std::unique_ptr<TextureVertex[]> mRegionMesh;
 
-    mutable Mutex mGarbageLock;
-    std::vector<Layer*> mLayerGarbage;
-
     bool mInitialized;
 
     // TODO: move below to RenderState
diff --git a/libs/hwui/GlLayer.cpp b/libs/hwui/GlLayer.cpp
index 42ae29d..432bb85 100644
--- a/libs/hwui/GlLayer.cpp
+++ b/libs/hwui/GlLayer.cpp
@@ -19,14 +19,6 @@
 #include "Caches.h"
 #include "RenderNode.h"
 #include "renderstate/RenderState.h"
-#include "utils/TraceUtils.h"
-
-#include <utils/Log.h>
-
-#define ATRACE_LAYER_WORK(label)                                                       \
-    ATRACE_FORMAT("%s HW Layer DisplayList %s %ux%u", label,                           \
-                  (renderNode.get() != NULL) ? renderNode->getName() : "", getWidth(), \
-                  getHeight())
 
 namespace android {
 namespace uirenderer {
diff --git a/libs/hwui/GlLayer.h b/libs/hwui/GlLayer.h
index 28749a0..9f70fda 100644
--- a/libs/hwui/GlLayer.h
+++ b/libs/hwui/GlLayer.h
@@ -50,12 +50,8 @@
 
     inline GLuint getTextureId() const { return texture.id(); }
 
-    inline Texture& getTexture() { return texture; }
-
     inline GLenum getRenderTarget() const { return texture.target(); }
 
-    inline bool isRenderable() const { return texture.target() != GL_NONE; }
-
     void setRenderTarget(GLenum renderTarget);
 
     void generateTexture();
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index 45a53f9..dc962f3 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -48,7 +48,6 @@
 namespace uirenderer {
 
 class CanvasState;
-class OffscreenBuffer;
 class Rect;
 class SkiaShader;
 struct RenderNodeOp;
@@ -172,9 +171,6 @@
     }
 
     const DisplayList* getDisplayList() const { return mDisplayList; }
-    OffscreenBuffer* getLayer() const { return mLayer; }
-    OffscreenBuffer** getLayerHandle() { return &mLayer; }  // ugh...
-    void setLayer(OffscreenBuffer* layer) { mLayer = layer; }
 
     // Note: The position callbacks are relying on the listener using
     // the frameNumber to appropriately batch/synchronize these transactions.
@@ -250,10 +246,6 @@
     friend class AnimatorManager;
     AnimatorManager mAnimatorManager;
 
-    // Owned by RT. Lifecycle is managed by prepareTree(), with the exception
-    // being in ~RenderNode() which may happen on any thread.
-    OffscreenBuffer* mLayer = nullptr;
-
     /**
      * Draw time state - these properties are only set and used during rendering
      */
@@ -292,7 +284,7 @@
      * Returns true if an offscreen layer from any renderPipeline is attached
      * to this node.
      */
-    bool hasLayer() const { return mLayer || mSkiaLayer.get(); }
+    bool hasLayer() const { return mSkiaLayer.get(); }
 
     /**
      * Used by the RenderPipeline to attach an offscreen surface to the RenderNode.
diff --git a/libs/hwui/renderstate/OffscreenBufferPool.cpp b/libs/hwui/renderstate/OffscreenBufferPool.cpp
deleted file mode 100644
index 8b27020..0000000
--- a/libs/hwui/renderstate/OffscreenBufferPool.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "OffscreenBufferPool.h"
-
-#include "Caches.h"
-#include "Properties.h"
-#include "renderstate/RenderState.h"
-#include "utils/FatVector.h"
-#include "utils/TraceUtils.h"
-
-#include <utils/Color.h>
-#include <utils/Log.h>
-
-#include <GLES2/gl2.h>
-
-namespace android {
-namespace uirenderer {
-
-////////////////////////////////////////////////////////////////////////////////
-// OffscreenBuffer
-////////////////////////////////////////////////////////////////////////////////
-
-OffscreenBuffer::OffscreenBuffer(RenderState& renderState, Caches& caches, uint32_t viewportWidth,
-                                 uint32_t viewportHeight, bool wideColorGamut)
-        : GpuMemoryTracker(GpuObjectType::OffscreenBuffer)
-        , renderState(renderState)
-        , viewportWidth(viewportWidth)
-        , viewportHeight(viewportHeight)
-        , texture(caches)
-        , wideColorGamut(wideColorGamut) {
-    uint32_t width = computeIdealDimension(viewportWidth);
-    uint32_t height = computeIdealDimension(viewportHeight);
-    ATRACE_FORMAT("Allocate %ux%u HW Layer", width, height);
-    caches.textureState().activateTexture(0);
-    texture.resize(width, height, wideColorGamut ? GL_RGBA16F : caches.rgbaInternalFormat(),
-                   GL_RGBA);
-    texture.blend = true;
-    texture.setWrap(GL_CLAMP_TO_EDGE);
-    // not setting filter on texture, since it's set when drawing, based on transform
-}
-
-Rect OffscreenBuffer::getTextureCoordinates() {
-    const float texX = 1.0f / static_cast<float>(texture.width());
-    const float texY = 1.0f / static_cast<float>(texture.height());
-    return Rect(0, viewportHeight * texY, viewportWidth * texX, 0);
-}
-
-void OffscreenBuffer::dirty(Rect dirtyArea) {
-    dirtyArea.doIntersect(0, 0, viewportWidth, viewportHeight);
-    if (!dirtyArea.isEmpty()) {
-        region.orSelf(
-                android::Rect(dirtyArea.left, dirtyArea.top, dirtyArea.right, dirtyArea.bottom));
-    }
-}
-
-void OffscreenBuffer::updateMeshFromRegion() {
-    // DEAD CODE
-}
-
-uint32_t OffscreenBuffer::computeIdealDimension(uint32_t dimension) {
-    return uint32_t(ceilf(dimension / float(LAYER_SIZE)) * LAYER_SIZE);
-}
-
-OffscreenBuffer::~OffscreenBuffer() {
-    // DEAD CODE
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// OffscreenBufferPool
-///////////////////////////////////////////////////////////////////////////////
-
-OffscreenBufferPool::OffscreenBufferPool()
-        // 4 screen-sized RGBA_8888 textures
-        : mMaxSize(DeviceInfo::multiplyByResolution(4 * 4)) {}
-
-OffscreenBufferPool::~OffscreenBufferPool() {
-    clear();  // TODO: unique_ptr?
-}
-
-int OffscreenBufferPool::Entry::compare(const Entry& lhs, const Entry& rhs) {
-    int deltaInt = int(lhs.width) - int(rhs.width);
-    if (deltaInt != 0) return deltaInt;
-
-    deltaInt = int(lhs.height) - int(rhs.height);
-    if (deltaInt != 0) return deltaInt;
-
-    return int(lhs.wideColorGamut) - int(rhs.wideColorGamut);
-}
-
-void OffscreenBufferPool::clear() {
-    for (auto& entry : mPool) {
-        delete entry.layer;
-    }
-    mPool.clear();
-    mSize = 0;
-}
-
-OffscreenBuffer* OffscreenBufferPool::get(RenderState& renderState, const uint32_t width,
-                                          const uint32_t height, bool wideColorGamut) {
-    OffscreenBuffer* layer = nullptr;
-
-    Entry entry(width, height, wideColorGamut);
-    auto iter = mPool.find(entry);
-
-    if (iter != mPool.end()) {
-        entry = *iter;
-        mPool.erase(iter);
-
-        layer = entry.layer;
-        layer->viewportWidth = width;
-        layer->viewportHeight = height;
-        mSize -= layer->getSizeInBytes();
-    } else {
-        layer = new OffscreenBuffer(renderState, Caches::getInstance(), width, height,
-                                    wideColorGamut);
-    }
-
-    return layer;
-}
-
-OffscreenBuffer* OffscreenBufferPool::resize(OffscreenBuffer* layer, const uint32_t width,
-                                             const uint32_t height) {
-    RenderState& renderState = layer->renderState;
-    if (layer->texture.width() == OffscreenBuffer::computeIdealDimension(width) &&
-        layer->texture.height() == OffscreenBuffer::computeIdealDimension(height)) {
-        // resize in place
-        layer->viewportWidth = width;
-        layer->viewportHeight = height;
-
-        // entire area will be repainted (and may be smaller) so clear usage region
-        layer->region.clear();
-        return layer;
-    }
-    bool wideColorGamut = layer->wideColorGamut;
-    putOrDelete(layer);
-    return get(renderState, width, height, wideColorGamut);
-}
-
-void OffscreenBufferPool::dump() {
-    for (auto entry : mPool) {
-        ALOGD("  Layer size %dx%d", entry.width, entry.height);
-    }
-}
-
-void OffscreenBufferPool::putOrDelete(OffscreenBuffer* layer) {
-    const uint32_t size = layer->getSizeInBytes();
-    // Don't even try to cache a layer that's bigger than the cache
-    if (size < mMaxSize) {
-        // TODO: Use an LRU
-        while (mSize + size > mMaxSize) {
-            OffscreenBuffer* victim = mPool.begin()->layer;
-            mSize -= victim->getSizeInBytes();
-            delete victim;
-            mPool.erase(mPool.begin());
-        }
-
-        // clear region, since it's no longer valid
-        layer->region.clear();
-
-        Entry entry(layer);
-
-        mPool.insert(entry);
-        mSize += size;
-    } else {
-        delete layer;
-    }
-}
-
-};  // namespace uirenderer
-};  // namespace android
diff --git a/libs/hwui/renderstate/OffscreenBufferPool.h b/libs/hwui/renderstate/OffscreenBufferPool.h
deleted file mode 100644
index 4d6b7be6..0000000
--- a/libs/hwui/renderstate/OffscreenBufferPool.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HWUI_OFFSCREEN_BUFFER_POOL_H
-#define ANDROID_HWUI_OFFSCREEN_BUFFER_POOL_H
-
-#include <GpuMemoryTracker.h>
-#include <ui/Region.h>
-#include "Caches.h"
-#include "Matrix.h"
-#include "Texture.h"
-#include "utils/Macros.h"
-
-#include <set>
-
-namespace android {
-namespace uirenderer {
-
-class RenderState;
-
-/**
- * Lightweight alternative to Layer. Owns the persistent state of an offscreen render target, and
- * encompasses enough information to draw it back on screen (minus paint properties, which are held
- * by LayerOp).
- *
- * Has two distinct sizes - viewportWidth/viewportHeight describe content area,
- * texture.width/.height are actual allocated texture size. Texture will tend to be larger than the
- * viewport bounds, since textures are always allocated with width / height as a multiple of 64, for
- * the purpose of improving reuse.
- */
-class OffscreenBuffer : GpuMemoryTracker {
-public:
-    OffscreenBuffer(RenderState& renderState, Caches& caches, uint32_t viewportWidth,
-                    uint32_t viewportHeight, bool wideColorGamut = false);
-    ~OffscreenBuffer();
-
-    Rect getTextureCoordinates();
-
-    void dirty(Rect dirtyArea);
-
-    // must be called prior to rendering, to construct/update vertex buffer
-    void updateMeshFromRegion();
-
-    // Set by RenderNode for HW layers, TODO for clipped saveLayers
-    void setWindowTransform(const Matrix4& transform) {
-        inverseTransformInWindow.loadInverse(transform);
-    }
-
-    static uint32_t computeIdealDimension(uint32_t dimension);
-
-    uint32_t getSizeInBytes() { return texture.objectSize(); }
-
-    RenderState& renderState;
-
-    uint32_t viewportWidth;
-    uint32_t viewportHeight;
-    Texture texture;
-
-    bool wideColorGamut = false;
-
-    // Portion of layer that has been drawn to. Used to minimize drawing area when
-    // drawing back to screen / parent FBO.
-    Region region;
-
-    Matrix4 inverseTransformInWindow;
-
-    // vbo / size of mesh
-    GLsizei elementCount = 0;
-    GLuint vbo = 0;
-
-    bool hasRenderedSinceRepaint;
-};
-
-/**
- * Pool of OffscreenBuffers allocated, but not currently in use.
- */
-class OffscreenBufferPool {
-public:
-    OffscreenBufferPool();
-    ~OffscreenBufferPool();
-
-    WARN_UNUSED_RESULT OffscreenBuffer* get(RenderState& renderState, const uint32_t width,
-                                            const uint32_t height, bool wideColorGamut = false);
-
-    WARN_UNUSED_RESULT OffscreenBuffer* resize(OffscreenBuffer* layer, const uint32_t width,
-                                               const uint32_t height);
-
-    void putOrDelete(OffscreenBuffer* layer);
-
-    /**
-     * Clears the pool. This causes all layers to be deleted.
-     */
-    void clear();
-
-    /**
-     * Returns the maximum size of the pool in bytes.
-     */
-    uint32_t getMaxSize() { return mMaxSize; }
-
-    /**
-     * Returns the current size of the pool in bytes.
-     */
-    uint32_t getSize() { return mSize; }
-
-    size_t getCount() { return mPool.size(); }
-
-    /**
-     * Prints out the content of the pool.
-     */
-    void dump();
-
-private:
-    struct Entry {
-        Entry() {}
-
-        Entry(const uint32_t layerWidth, const uint32_t layerHeight, bool wideColorGamut)
-                : width(OffscreenBuffer::computeIdealDimension(layerWidth))
-                , height(OffscreenBuffer::computeIdealDimension(layerHeight))
-                , wideColorGamut(wideColorGamut) {}
-
-        explicit Entry(OffscreenBuffer* layer)
-                : layer(layer)
-                , width(layer->texture.width())
-                , height(layer->texture.height())
-                , wideColorGamut(layer->wideColorGamut) {}
-
-        static int compare(const Entry& lhs, const Entry& rhs);
-
-        bool operator==(const Entry& other) const { return compare(*this, other) == 0; }
-
-        bool operator!=(const Entry& other) const { return compare(*this, other) != 0; }
-
-        bool operator<(const Entry& other) const { return Entry::compare(*this, other) < 0; }
-
-        OffscreenBuffer* layer = nullptr;
-        uint32_t width = 0;
-        uint32_t height = 0;
-        bool wideColorGamut = false;
-    };  // struct Entry
-
-    std::multiset<Entry> mPool;
-
-    uint32_t mSize = 0;
-    uint32_t mMaxSize;
-};  // class OffscreenBufferCache
-
-};  // namespace uirenderer
-};  // namespace android
-
-#endif  // ANDROID_HWUI_OFFSCREEN_BUFFER_POOL_H
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp
index 6783503..3be84f58 100644
--- a/libs/hwui/renderstate/RenderState.cpp
+++ b/libs/hwui/renderstate/RenderState.cpp
@@ -42,11 +42,6 @@
 void RenderState::onGLContextCreated() {
     GpuMemoryTracker::onGpuContextCreated();
 
-    // Deferred because creation needs GL context for texture limits
-    if (!mLayerPool) {
-        mLayerPool = new OffscreenBufferPool();
-    }
-
     // This is delayed because the first access of Caches makes GL calls
     if (!mCaches) {
         mCaches = &Caches::createInstance(*this);
@@ -61,8 +56,6 @@
 }
 
 void RenderState::onGLContextDestroyed() {
-    mLayerPool->clear();
-
     // TODO: reset all cached state in state objects
     std::for_each(mActiveLayers.begin(), mActiveLayers.end(), layerLostGlContext);
 
@@ -93,15 +86,6 @@
 }
 
 void RenderState::flush(Caches::FlushMode mode) {
-    switch (mode) {
-        case Caches::FlushMode::Full:
-        // fall through
-        case Caches::FlushMode::Moderate:
-        // fall through
-        case Caches::FlushMode::Layers:
-            if (mLayerPool) mLayerPool->clear();
-            break;
-    }
     if (mCaches) mCaches->flush(mode);
 }
 
diff --git a/libs/hwui/renderstate/RenderState.h b/libs/hwui/renderstate/RenderState.h
index 64827686..97785a4 100644
--- a/libs/hwui/renderstate/RenderState.h
+++ b/libs/hwui/renderstate/RenderState.h
@@ -17,7 +17,6 @@
 #define RENDERSTATE_H
 
 #include "Caches.h"
-#include "renderstate/OffscreenBufferPool.h"
 #include "renderstate/PixelBufferState.h"
 #include "utils/Macros.h"
 
@@ -98,8 +97,6 @@
     // more thinking...
     void postDecStrong(VirtualLightRefBase* object);
 
-    OffscreenBufferPool& layerPool() { return *mLayerPool; }
-
     GrContext* getGrContext() const;
 
     void dump();
@@ -115,8 +112,6 @@
     renderthread::RenderThread& mRenderThread;
     Caches* mCaches = nullptr;
 
-    OffscreenBufferPool* mLayerPool = nullptr;
-
     std::set<Layer*> mActiveLayers;
     std::set<DeferredLayerUpdater*> mActiveLayerUpdaters;
     std::set<renderthread::CanvasContext*> mRegisteredContexts;
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 02d0b6d..12220a6 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -193,8 +193,11 @@
     mRenderThread.queue().runSync([]() {});
 }
 
-void RenderProxy::staticFence() {
-    RenderThread::getInstance().queue().runSync([]() {});
+int RenderProxy::maxTextureSize() {
+    static int maxTextureSize = RenderThread::getInstance().queue().runSync([]() {
+        return DeviceInfo::get()->maxTextureSize();
+    });
+    return maxTextureSize;
 }
 
 void RenderProxy::stopDrawing() {
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 9e46161..e7cd091 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -95,7 +95,7 @@
     ANDROID_API static void overrideProperty(const char* name, const char* value);
 
     ANDROID_API void fence();
-    ANDROID_API static void staticFence();
+    ANDROID_API static int maxTextureSize();
     ANDROID_API void stopDrawing();
     ANDROID_API void notifyFramePending();