From dfc7d4cc7b6ece90b50fede1de04a6d92e7e8e7a Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Wed, 24 Mar 2021 13:26:56 -0400 Subject: [PATCH] Add a system property to control Skia reduceOpsTaskSplitting We are testing this flag with a subset of devices in dogfood and need to have this plumbing available. Bug: 183612348 Change-Id: I8041053ff3da94b08cd6793fac3ff282bc73da9a --- libs/hwui/renderthread/RenderThread.cpp | 6 ++++++ libs/hwui/renderthread/RenderThread.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp index 5dc02e8454ac4..db7642d99bb12 100644 --- a/libs/hwui/renderthread/RenderThread.cpp +++ b/libs/hwui/renderthread/RenderThread.cpp @@ -40,6 +40,7 @@ #include #include +#include #include namespace android { @@ -251,6 +252,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() { diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h index a7d1ba8dafd77..48e3e12536d2c 100644 --- a/libs/hwui/renderthread/RenderThread.h +++ b/libs/hwui/renderthread/RenderThread.h @@ -38,6 +38,12 @@ #include "thread/ThreadBase.h" #include "utils/TimeUtils.h" +/** + * (Bool) Turns on the Skia GPU option "reduceOpsTaskSplitting" which improves GPU + * efficiency but may increase VRAM consumption. Default is false. + */ +#define PROPERTY_REDUCE_OPS_TASK_SPLITTING "renderthread.skia.reduceopstasksplitting" + namespace android { class Bitmap;