summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 5dc02e8454ac..79b938841bc2 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -20,6 +20,7 @@
#include "CanvasContext.h"
#include "DeviceInfo.h"
#include "EglManager.h"
+#include "Properties.h"
#include "Readback.h"
#include "RenderProxy.h"
#include "VulkanManager.h"
@@ -40,6 +41,7 @@
#include <utils/Mutex.h>
#include <thread>
+#include <android-base/properties.h>
#include <ui/FatVector.h>
namespace android {
@@ -151,10 +153,11 @@ JVMAttachHook RenderThread::getOnStartHook() {
}
RenderThread& RenderThread::getInstance() {
- // This is a pointer because otherwise __cxa_finalize
- // will try to delete it like a Good Citizen but that causes us to crash
- // because we don't want to delete the RenderThread normally.
- static RenderThread* sInstance = new RenderThread();
+ [[clang::no_destroy]] static sp<RenderThread> sInstance = []() {
+ sp<RenderThread> thread = sp<RenderThread>::make();
+ thread->start("RenderThread");
+ return thread;
+ }();
gHasRenderThreadInstance = true;
return *sInstance;
}
@@ -169,7 +172,6 @@ RenderThread::RenderThread()
, mFunctorManager(WebViewFunctorManager::instance())
, mGlobalProfileData(mJankDataMutex) {
Properties::load();
- start("RenderThread");
}
RenderThread::~RenderThread() {
@@ -251,6 +253,11 @@ void RenderThread::requireVkContext() {
void RenderThread::initGrContextOptions(GrContextOptions& options) {
options.fPreferExternalImagesOverES3 = true;
options.fDisableDistanceFieldPaths = true;
+ if (android::base::GetBoolProperty(PROPERTY_REDUCE_OPS_TASK_SPLITTING, false)) {
+ options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kYes;
+ } else {
+ options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo;
+ }
}
void RenderThread::destroyRenderingContext() {