summaryrefslogtreecommitdiff
path: root/libs/hwui/renderstate
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2017-07-17 09:55:02 -0700
committerJohn Reck <jreck@google.com>2017-08-10 17:22:43 +0000
commit642ebea6e14b72c512ef1168dc6edb061035dded (patch)
treed2b562aefd9d4804a936f442422e6576c387f150 /libs/hwui/renderstate
parent15ea142044cd5212ed6fe86987297a64f0d7a4fb (diff)
Delete all ro.hwui.* props
Remove all ro.hwui.* tuning props and instead calculate them from the screen resolution. Or just hardcode them to what all devices were hardcoding them to anyway. Bug: 63741221 Test: Check cache size results on sailfish Change-Id: I8b0d210572a246f4fefb076935cf5156a70c274c Merged-In: I8b0d210572a246f4fefb076935cf5156a70c274c (cherry picked from commit 8dc02f99d09130ace2ee738c2e689db1b3f33181)
Diffstat (limited to 'libs/hwui/renderstate')
-rw-r--r--libs/hwui/renderstate/OffscreenBufferPool.cpp4
-rw-r--r--libs/hwui/renderstate/RenderState.cpp13
-rw-r--r--libs/hwui/renderstate/RenderState.h4
-rw-r--r--libs/hwui/renderstate/Stencil.cpp2
4 files changed, 14 insertions, 9 deletions
diff --git a/libs/hwui/renderstate/OffscreenBufferPool.cpp b/libs/hwui/renderstate/OffscreenBufferPool.cpp
index 2dfa6d4dc839..ea292d678c67 100644
--- a/libs/hwui/renderstate/OffscreenBufferPool.cpp
+++ b/libs/hwui/renderstate/OffscreenBufferPool.cpp
@@ -17,7 +17,6 @@
#include "OffscreenBufferPool.h"
#include "Caches.h"
-#include "Properties.h"
#include "renderstate/RenderState.h"
#include "utils/FatVector.h"
#include "utils/TraceUtils.h"
@@ -118,7 +117,8 @@ OffscreenBuffer::~OffscreenBuffer() {
///////////////////////////////////////////////////////////////////////////////
OffscreenBufferPool::OffscreenBufferPool()
- : mMaxSize(Properties::layerPoolSize) {
+ // 4 screen-sized RGBA_8888 textures
+ : mMaxSize(DeviceInfo::multiplyByResolution(4 * 4)) {
}
OffscreenBufferPool::~OffscreenBufferPool() {
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp
index 2c92924cc12c..ededffb0f4bb 100644
--- a/libs/hwui/renderstate/RenderState.cpp
+++ b/libs/hwui/renderstate/RenderState.cpp
@@ -53,6 +53,11 @@ void RenderState::onGLContextCreated() {
mScissor = new Scissor();
mStencil = new Stencil();
+ // 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);
@@ -67,7 +72,7 @@ static void layerLostGlContext(Layer* layer) {
}
void RenderState::onGLContextDestroyed() {
- mLayerPool.clear();
+ mLayerPool->clear();
// TODO: reset all cached state in state objects
std::for_each(mActiveLayers.begin(), mActiveLayers.end(), layerLostGlContext);
@@ -100,7 +105,7 @@ static void layerDestroyedVkContext(Layer* layer) {
}
void RenderState::onVkContextDestroyed() {
- mLayerPool.clear();
+ mLayerPool->clear();
std::for_each(mActiveLayers.begin(), mActiveLayers.end(), layerDestroyedVkContext);
GpuMemoryTracker::onGpuContextDestroyed();
}
@@ -116,10 +121,10 @@ void RenderState::flush(Caches::FlushMode mode) {
case Caches::FlushMode::Moderate:
// fall through
case Caches::FlushMode::Layers:
- mLayerPool.clear();
+ if (mLayerPool) mLayerPool->clear();
break;
}
- mCaches->flush(mode);
+ if (mCaches) mCaches->flush(mode);
}
void RenderState::onBitmapDestroyed(uint32_t pixelRefId) {
diff --git a/libs/hwui/renderstate/RenderState.h b/libs/hwui/renderstate/RenderState.h
index 4b7a86580621..df81e864a0b5 100644
--- a/libs/hwui/renderstate/RenderState.h
+++ b/libs/hwui/renderstate/RenderState.h
@@ -113,7 +113,7 @@ public:
Scissor& scissor() { return *mScissor; }
Stencil& stencil() { return *mStencil; }
- OffscreenBufferPool& layerPool() { return mLayerPool; }
+ OffscreenBufferPool& layerPool() { return *mLayerPool; }
GrContext* getGrContext() const;
@@ -136,7 +136,7 @@ private:
Scissor* mScissor = nullptr;
Stencil* mStencil = nullptr;
- OffscreenBufferPool mLayerPool;
+ OffscreenBufferPool* mLayerPool = nullptr;
std::set<Layer*> mActiveLayers;
std::set<DeferredLayerUpdater*> mActiveLayerUpdaters;
diff --git a/libs/hwui/renderstate/Stencil.cpp b/libs/hwui/renderstate/Stencil.cpp
index d25ad514e892..f59442196af1 100644
--- a/libs/hwui/renderstate/Stencil.cpp
+++ b/libs/hwui/renderstate/Stencil.cpp
@@ -47,7 +47,7 @@ uint8_t Stencil::getStencilSize() {
*/
GLenum Stencil::getLayerStencilFormat() {
#if !DEBUG_STENCIL
- const Extensions& extensions = Caches::getInstance().extensions();
+ const Extensions& extensions = DeviceInfo::get()->extensions();
if (extensions.has4BitStencil()) {
return GL_STENCIL_INDEX4_OES;
}