diff options
| author | 2018-05-31 16:48:08 +0000 | |
|---|---|---|
| committer | 2018-05-31 16:48:08 +0000 | |
| commit | 14e1c54fa3f38c79cc080670519e15842e248a88 (patch) | |
| tree | 0cb8f53b4096bcacf2d554b752e6d0d564f05df0 | |
| parent | 4769f85fad6b61ae1842ef02fa4970aea9485673 (diff) | |
| parent | e4c1e6c5a18eb9cfa9025363c5a991b2c683ed68 (diff) | |
Merge "Remove dead code"
| -rw-r--r-- | core/jni/android_view_DisplayListCanvas.cpp | 18 | ||||
| -rw-r--r-- | libs/hwui/Android.bp | 1 | ||||
| -rw-r--r-- | libs/hwui/Caches.cpp | 76 | ||||
| -rw-r--r-- | libs/hwui/Caches.h | 39 | ||||
| -rw-r--r-- | libs/hwui/GlLayer.cpp | 8 | ||||
| -rw-r--r-- | libs/hwui/GlLayer.h | 4 | ||||
| -rw-r--r-- | libs/hwui/RenderNode.h | 10 | ||||
| -rw-r--r-- | libs/hwui/renderstate/OffscreenBufferPool.cpp | 184 | ||||
| -rw-r--r-- | libs/hwui/renderstate/OffscreenBufferPool.h | 163 | ||||
| -rw-r--r-- | libs/hwui/renderstate/RenderState.cpp | 16 | ||||
| -rw-r--r-- | libs/hwui/renderstate/RenderState.h | 5 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 7 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.h | 2 |
13 files changed, 12 insertions, 521 deletions
diff --git a/core/jni/android_view_DisplayListCanvas.cpp b/core/jni/android_view_DisplayListCanvas.cpp index 7956bf4ee222..4fdd2bcd4f39 100644 --- a/core/jni/android_view_DisplayListCanvas.cpp +++ b/core/jni/android_view_DisplayListCanvas.cpp @@ -128,18 +128,8 @@ static void android_view_DisplayListCanvas_resetDisplayListCanvas(jlong canvasPt canvas->resetRecording(width, height, renderNode); } -static jint android_view_DisplayListCanvas_getMaxTextureWidth() { - if (!Caches::hasInstance()) { - android::uirenderer::renderthread::RenderProxy::staticFence(); - } - return Caches::getInstance().maxTextureSize; -} - -static jint android_view_DisplayListCanvas_getMaxTextureHeight() { - if (!Caches::hasInstance()) { - android::uirenderer::renderthread::RenderProxy::staticFence(); - } - return Caches::getInstance().maxTextureSize; +static jint android_view_DisplayListCanvas_getMaxTextureSize() { + return android::uirenderer::renderthread::RenderProxy::maxTextureSize(); } static void android_view_DisplayListCanvas_insertReorderBarrier(jlong canvasPtr, @@ -205,8 +195,8 @@ static JNINativeMethod gMethods[] = { // ------------ @CriticalNative -------------- { "nCreateDisplayListCanvas", "(JII)J", (void*) android_view_DisplayListCanvas_createDisplayListCanvas }, { "nResetDisplayListCanvas", "(JJII)V", (void*) android_view_DisplayListCanvas_resetDisplayListCanvas }, - { "nGetMaximumTextureWidth", "()I", (void*) android_view_DisplayListCanvas_getMaxTextureWidth }, - { "nGetMaximumTextureHeight", "()I", (void*) android_view_DisplayListCanvas_getMaxTextureHeight }, + { "nGetMaximumTextureWidth", "()I", (void*) android_view_DisplayListCanvas_getMaxTextureSize }, + { "nGetMaximumTextureHeight", "()I", (void*) android_view_DisplayListCanvas_getMaxTextureSize }, { "nInsertReorderBarrier", "(JZ)V", (void*) android_view_DisplayListCanvas_insertReorderBarrier }, { "nFinishRecording", "(J)J", (void*) android_view_DisplayListCanvas_finishRecording }, { "nDrawRenderNode", "(JJ)V", (void*) android_view_DisplayListCanvas_drawRenderNode }, diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp index e2e34205df7d..2454ae3d9f15 100644 --- a/libs/hwui/Android.bp +++ b/libs/hwui/Android.bp @@ -170,7 +170,6 @@ cc_defaults { "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 8cf115ebc540..254144448859 100644 --- a/libs/hwui/Caches.cpp +++ b/libs/hwui/Caches.cpp @@ -44,12 +44,10 @@ Caches* Caches::sInstance = nullptr; // 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 @@ bool Caches::init() { 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 @@ void Caches::terminate() { } /////////////////////////////////////////////////////////////////////////////// -// 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 @@ void Caches::flush(FlushMode mode) { 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 5afa92c43a3d..642f9dc50eb1 100644 --- a/libs/hwui/Caches.h +++ b/libs/hwui/Caches.h @@ -90,30 +90,12 @@ public: 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 @@ public: 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 42ae29d76898..432bb8526465 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 28749a0d125c..9f70fdae6790 100644 --- a/libs/hwui/GlLayer.h +++ b/libs/hwui/GlLayer.h @@ -50,12 +50,8 @@ public: 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 45a53f9a37df..dc962f307903 100644 --- a/libs/hwui/RenderNode.h +++ b/libs/hwui/RenderNode.h @@ -48,7 +48,6 @@ namespace android { namespace uirenderer { class CanvasState; -class OffscreenBuffer; class Rect; class SkiaShader; struct RenderNodeOp; @@ -172,9 +171,6 @@ public: } 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 @@ private: 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 @@ public: * 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 8b27020f618e..000000000000 --- 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 4d6b7be6c61b..000000000000 --- 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 6783503f4ae8..3be84f588a20 100644 --- a/libs/hwui/renderstate/RenderState.cpp +++ b/libs/hwui/renderstate/RenderState.cpp @@ -42,11 +42,6 @@ RenderState::~RenderState() { 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 @@ static void layerLostGlContext(Layer* layer) { } 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 @@ GrContext* RenderState::getGrContext() const { } 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 64827686f30d..97785a46dcd7 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 @@ public: // more thinking... void postDecStrong(VirtualLightRefBase* object); - OffscreenBufferPool& layerPool() { return *mLayerPool; } - GrContext* getGrContext() const; void dump(); @@ -115,8 +112,6 @@ private: 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 02d0b6d4a77f..12220a6b3776 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -193,8 +193,11 @@ void RenderProxy::fence() { 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 9e46161454fe..e7cd0913231d 100644 --- a/libs/hwui/renderthread/RenderProxy.h +++ b/libs/hwui/renderthread/RenderProxy.h @@ -95,7 +95,7 @@ public: 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(); |