Loading libs/hwui/Caches.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -50,9 +50,9 @@ Caches* Caches::sInstance = nullptr; /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Caches::Caches(RenderState& renderState) Caches::Caches(RenderState& renderState) : gradientCache(mExtensions) : gradientCache(extensions()) , patchCache(renderState) , patchCache(renderState) , programCache(mExtensions) , programCache(extensions()) , mRenderState(&renderState) , mRenderState(&renderState) , mInitialized(false) { , mInitialized(false) { INIT_LOGD("Creating OpenGL renderer caches"); INIT_LOGD("Creating OpenGL renderer caches"); Loading Loading @@ -80,7 +80,7 @@ bool Caches::init() { } } void Caches::initExtensions() { void Caches::initExtensions() { if (mExtensions.hasDebugMarker()) { if (extensions().hasDebugMarker()) { eventMark = glInsertEventMarkerEXT; eventMark = glInsertEventMarkerEXT; startMark = glPushGroupMarkerEXT; startMark = glPushGroupMarkerEXT; Loading @@ -93,12 +93,12 @@ void Caches::initExtensions() { } } void Caches::initConstraints() { void Caches::initConstraints() { glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); maxTextureSize = DeviceInfo::get()->maxTextureSize(); } } void Caches::initStaticProperties() { void Caches::initStaticProperties() { // OpenGL ES 3.0+ specific features // OpenGL ES 3.0+ specific features gpuPixelBuffersEnabled = mExtensions.hasPixelBufferObjects() gpuPixelBuffersEnabled = extensions().hasPixelBufferObjects() && property_get_bool(PROPERTY_ENABLE_GPU_PIXEL_BUFFERS, true); && property_get_bool(PROPERTY_ENABLE_GPU_PIXEL_BUFFERS, true); } } Loading libs/hwui/Caches.h +2 −5 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #pragma once #include "DeviceInfo.h" #include "Extensions.h" #include "Extensions.h" #include "FboCache.h" #include "FboCache.h" #include "GammaFontRenderer.h" #include "GammaFontRenderer.h" Loading Loading @@ -145,10 +146,6 @@ public: // Misc // Misc GLint maxTextureSize; GLint maxTextureSize; private: // Declared before gradientCache and programCache which need this to initialize. // TODO: cleanup / move elsewhere Extensions mExtensions; public: public: TextureCache textureCache; TextureCache textureCache; RenderBufferCache renderBufferCache; RenderBufferCache renderBufferCache; Loading @@ -174,7 +171,7 @@ public: void setProgram(const ProgramDescription& description); void setProgram(const ProgramDescription& description); void setProgram(Program* program); void setProgram(Program* program); const Extensions& extensions() const { return mExtensions; } const Extensions& extensions() const { return DeviceInfo::get()->extensions(); } Program& program() { return *mProgram; } Program& program() { return *mProgram; } PixelBufferState& pixelBufferState() { return *mPixelBufferState; } PixelBufferState& pixelBufferState() { return *mPixelBufferState; } TextureState& textureState() { return *mTextureState; } TextureState& textureState() { return *mTextureState; } Loading libs/hwui/DeviceInfo.cpp +11 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,8 @@ #include <DeviceInfo.h> #include <DeviceInfo.h> #include "Extensions.h" #include <gui/ISurfaceComposer.h> #include <gui/SurfaceComposerClient.h> #include <thread> #include <thread> #include <mutex> #include <mutex> Loading Loading @@ -46,13 +47,22 @@ void DeviceInfo::initialize() { void DeviceInfo::initialize(int maxTextureSize) { void DeviceInfo::initialize(int maxTextureSize) { std::call_once(sInitializedFlag, [maxTextureSize]() { std::call_once(sInitializedFlag, [maxTextureSize]() { sDeviceInfo = new DeviceInfo(); sDeviceInfo = new DeviceInfo(); sDeviceInfo->loadDisplayInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; sDeviceInfo->mMaxTextureSize = maxTextureSize; }); }); } } void DeviceInfo::load() { void DeviceInfo::load() { loadDisplayInfo(); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); } } void DeviceInfo::loadDisplayInfo() { sp<IBinder> dtoken(SurfaceComposerClient::getBuiltInDisplay( ISurfaceComposer::eDisplayIdMain)); status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &mDisplayInfo); LOG_ALWAYS_FATAL_IF(status, "Failed to get display info, error %d", status); } } /* namespace uirenderer */ } /* namespace uirenderer */ } /* namespace android */ } /* namespace android */ libs/hwui/DeviceInfo.h +13 −0 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,10 @@ #ifndef DEVICEINFO_H #ifndef DEVICEINFO_H #define DEVICEINFO_H #define DEVICEINFO_H #include <ui/DisplayInfo.h> #include "utils/Macros.h" #include "utils/Macros.h" #include "Extensions.h" namespace android { namespace android { namespace uirenderer { namespace uirenderer { Loading @@ -35,14 +38,24 @@ public: static void initialize(int maxTextureSize); static void initialize(int maxTextureSize); int maxTextureSize() const { return mMaxTextureSize; } int maxTextureSize() const { return mMaxTextureSize; } const DisplayInfo& displayInfo() const { return mDisplayInfo; } const Extensions& extensions() const { return mExtensions; } static uint32_t multiplyByResolution(uint32_t in) { auto di = DeviceInfo::get()->displayInfo(); return di.w * di.h * in; } private: private: DeviceInfo() {} DeviceInfo() {} ~DeviceInfo() {} ~DeviceInfo() {} void load(); void load(); void loadDisplayInfo(); int mMaxTextureSize; int mMaxTextureSize; DisplayInfo mDisplayInfo; Extensions mExtensions; }; }; } /* namespace uirenderer */ } /* namespace uirenderer */ Loading libs/hwui/FboCache.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,7 @@ namespace uirenderer { /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// FboCache::FboCache() FboCache::FboCache() : mMaxSize(Properties::fboCacheSize) {} : mMaxSize(0) {} FboCache::~FboCache() { FboCache::~FboCache() { clear(); clear(); Loading Loading
libs/hwui/Caches.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -50,9 +50,9 @@ Caches* Caches::sInstance = nullptr; /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Caches::Caches(RenderState& renderState) Caches::Caches(RenderState& renderState) : gradientCache(mExtensions) : gradientCache(extensions()) , patchCache(renderState) , patchCache(renderState) , programCache(mExtensions) , programCache(extensions()) , mRenderState(&renderState) , mRenderState(&renderState) , mInitialized(false) { , mInitialized(false) { INIT_LOGD("Creating OpenGL renderer caches"); INIT_LOGD("Creating OpenGL renderer caches"); Loading Loading @@ -80,7 +80,7 @@ bool Caches::init() { } } void Caches::initExtensions() { void Caches::initExtensions() { if (mExtensions.hasDebugMarker()) { if (extensions().hasDebugMarker()) { eventMark = glInsertEventMarkerEXT; eventMark = glInsertEventMarkerEXT; startMark = glPushGroupMarkerEXT; startMark = glPushGroupMarkerEXT; Loading @@ -93,12 +93,12 @@ void Caches::initExtensions() { } } void Caches::initConstraints() { void Caches::initConstraints() { glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); maxTextureSize = DeviceInfo::get()->maxTextureSize(); } } void Caches::initStaticProperties() { void Caches::initStaticProperties() { // OpenGL ES 3.0+ specific features // OpenGL ES 3.0+ specific features gpuPixelBuffersEnabled = mExtensions.hasPixelBufferObjects() gpuPixelBuffersEnabled = extensions().hasPixelBufferObjects() && property_get_bool(PROPERTY_ENABLE_GPU_PIXEL_BUFFERS, true); && property_get_bool(PROPERTY_ENABLE_GPU_PIXEL_BUFFERS, true); } } Loading
libs/hwui/Caches.h +2 −5 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #pragma once #include "DeviceInfo.h" #include "Extensions.h" #include "Extensions.h" #include "FboCache.h" #include "FboCache.h" #include "GammaFontRenderer.h" #include "GammaFontRenderer.h" Loading Loading @@ -145,10 +146,6 @@ public: // Misc // Misc GLint maxTextureSize; GLint maxTextureSize; private: // Declared before gradientCache and programCache which need this to initialize. // TODO: cleanup / move elsewhere Extensions mExtensions; public: public: TextureCache textureCache; TextureCache textureCache; RenderBufferCache renderBufferCache; RenderBufferCache renderBufferCache; Loading @@ -174,7 +171,7 @@ public: void setProgram(const ProgramDescription& description); void setProgram(const ProgramDescription& description); void setProgram(Program* program); void setProgram(Program* program); const Extensions& extensions() const { return mExtensions; } const Extensions& extensions() const { return DeviceInfo::get()->extensions(); } Program& program() { return *mProgram; } Program& program() { return *mProgram; } PixelBufferState& pixelBufferState() { return *mPixelBufferState; } PixelBufferState& pixelBufferState() { return *mPixelBufferState; } TextureState& textureState() { return *mTextureState; } TextureState& textureState() { return *mTextureState; } Loading
libs/hwui/DeviceInfo.cpp +11 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,8 @@ #include <DeviceInfo.h> #include <DeviceInfo.h> #include "Extensions.h" #include <gui/ISurfaceComposer.h> #include <gui/SurfaceComposerClient.h> #include <thread> #include <thread> #include <mutex> #include <mutex> Loading Loading @@ -46,13 +47,22 @@ void DeviceInfo::initialize() { void DeviceInfo::initialize(int maxTextureSize) { void DeviceInfo::initialize(int maxTextureSize) { std::call_once(sInitializedFlag, [maxTextureSize]() { std::call_once(sInitializedFlag, [maxTextureSize]() { sDeviceInfo = new DeviceInfo(); sDeviceInfo = new DeviceInfo(); sDeviceInfo->loadDisplayInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; sDeviceInfo->mMaxTextureSize = maxTextureSize; }); }); } } void DeviceInfo::load() { void DeviceInfo::load() { loadDisplayInfo(); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); } } void DeviceInfo::loadDisplayInfo() { sp<IBinder> dtoken(SurfaceComposerClient::getBuiltInDisplay( ISurfaceComposer::eDisplayIdMain)); status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &mDisplayInfo); LOG_ALWAYS_FATAL_IF(status, "Failed to get display info, error %d", status); } } /* namespace uirenderer */ } /* namespace uirenderer */ } /* namespace android */ } /* namespace android */
libs/hwui/DeviceInfo.h +13 −0 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,10 @@ #ifndef DEVICEINFO_H #ifndef DEVICEINFO_H #define DEVICEINFO_H #define DEVICEINFO_H #include <ui/DisplayInfo.h> #include "utils/Macros.h" #include "utils/Macros.h" #include "Extensions.h" namespace android { namespace android { namespace uirenderer { namespace uirenderer { Loading @@ -35,14 +38,24 @@ public: static void initialize(int maxTextureSize); static void initialize(int maxTextureSize); int maxTextureSize() const { return mMaxTextureSize; } int maxTextureSize() const { return mMaxTextureSize; } const DisplayInfo& displayInfo() const { return mDisplayInfo; } const Extensions& extensions() const { return mExtensions; } static uint32_t multiplyByResolution(uint32_t in) { auto di = DeviceInfo::get()->displayInfo(); return di.w * di.h * in; } private: private: DeviceInfo() {} DeviceInfo() {} ~DeviceInfo() {} ~DeviceInfo() {} void load(); void load(); void loadDisplayInfo(); int mMaxTextureSize; int mMaxTextureSize; DisplayInfo mDisplayInfo; Extensions mExtensions; }; }; } /* namespace uirenderer */ } /* namespace uirenderer */ Loading
libs/hwui/FboCache.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,7 @@ namespace uirenderer { /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// FboCache::FboCache() FboCache::FboCache() : mMaxSize(Properties::fboCacheSize) {} : mMaxSize(0) {} FboCache::~FboCache() { FboCache::~FboCache() { clear(); clear(); Loading