Reduce opList splitting by default in Skia
Local Skia and DDL recording will always attempt to reduce opList splitting.
Android, Flutter, Google3 and non-DDL Chrome will not.
Note that this is a bit aggressive. Intermediate flushes based on memory usage have not yet been implemented.
The plan is to run this locally in Skia until the next Chrome branch and then enable it everywhere else (when intermediate flushes have been implemented).
OpList splitting reduction in Chrome is disabled in the following Chrome-side CL:
https://chromium-review.googlesource.com/c/chromium/src/+/1588756/ (Disable opList splitting reduction in Skia)
It is disabled in Android in:
https://googleplex-android-review.git.corp.google.com/c/platform/external/skia/+/7259923 (Update #defines to suppress Ganesh features in SkUserConfigManual.h)
It is disabled in Flutter and Google3 w/in this CL.
Change-Id: I59ff448d2c42629fab6cffccb2894d030c73431d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211101
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrDDLContext.cpp b/src/gpu/GrDDLContext.cpp
index 70e2377..1939348 100644
--- a/src/gpu/GrDDLContext.cpp
+++ b/src/gpu/GrDDLContext.cpp
@@ -52,7 +52,9 @@
return false;
}
- this->setupDrawingManager(true); // DDL contexts/drawing managers always sort the oplists.
+ // DDL contexts/drawing managers always sort the oplists and attempt to reduce opList
+ // splitting.
+ this->setupDrawingManager(true, true);
SkASSERT(this->caps());
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 22d21d3..321810e 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -151,7 +151,7 @@
const GrPathRendererChain::Options& optionsForPathRendererChain,
const GrTextContext::Options& optionsForTextContext,
bool sortOpLists,
- GrContextOptions::Enable reduceOpListSplitting)
+ bool reduceOpListSplitting)
: fContext(context)
, fOptionsForPathRendererChain(optionsForPathRendererChain)
, fOptionsForTextContext(optionsForTextContext)
@@ -159,16 +159,8 @@
, fTextContext(nullptr)
, fPathRendererChain(nullptr)
, fSoftwarePathRenderer(nullptr)
- , fFlushing(false) {
- if (GrContextOptions::Enable::kNo == reduceOpListSplitting) {
- fReduceOpListSplitting = false;
- } else if (GrContextOptions::Enable::kYes == reduceOpListSplitting) {
- fReduceOpListSplitting = true;
- } else {
- // For now, this is only turned on when explicitly enabled. Once mini-flushes are
- // implemented it should be enabled whenever sorting is enabled.
- fReduceOpListSplitting = false; // sortOpLists
- }
+ , fFlushing(false)
+ , fReduceOpListSplitting(reduceOpListSplitting) {
}
void GrDrawingManager::cleanup() {
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index b5655ea..124b89f 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -137,7 +137,7 @@
GrDrawingManager(GrRecordingContext*, const GrPathRendererChain::Options&,
const GrTextContext::Options&,
bool sortOpLists,
- GrContextOptions::Enable reduceOpListSplitting);
+ bool reduceOpListSplitting);
bool wasAbandoned() const;
diff --git a/src/gpu/GrLegacyDirectContext.cpp b/src/gpu/GrLegacyDirectContext.cpp
index d187b2a..6a4a1bc 100644
--- a/src/gpu/GrLegacyDirectContext.cpp
+++ b/src/gpu/GrLegacyDirectContext.cpp
@@ -24,6 +24,12 @@
#include "src/gpu/vk/GrVkGpu.h"
#endif
+#ifdef SK_DISABLE_REDUCE_OPLIST_SPLITTING
+static const bool kDefaultReduceOpListSplitting = false;
+#else
+static const bool kDefaultReduceOpListSplitting = true;
+#endif
+
class SK_API GrLegacyDirectContext : public GrContext {
public:
GrLegacyDirectContext(GrBackendApi backend, const GrContextOptions& options)
@@ -73,7 +79,14 @@
return false;
}
- this->setupDrawingManager(true);
+ bool reduceOpListSplitting = kDefaultReduceOpListSplitting;
+ if (GrContextOptions::Enable::kNo == this->options().fReduceOpListSplitting) {
+ reduceOpListSplitting = false;
+ } else if (GrContextOptions::Enable::kYes == this->options().fReduceOpListSplitting) {
+ reduceOpListSplitting = true;
+ }
+
+ this->setupDrawingManager(true, reduceOpListSplitting);
SkASSERT(this->caps());
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 04b863e..1117ff1 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -64,7 +64,7 @@
return true;
}
-void GrRecordingContext::setupDrawingManager(bool sortOpLists) {
+void GrRecordingContext::setupDrawingManager(bool sortOpLists, bool reduceOpListSplitting) {
GrPathRendererChain::Options prcOptions;
prcOptions.fAllowPathMaskCaching = this->options().fAllowPathMaskCaching;
#if GR_TEST_UTILS
@@ -95,15 +95,11 @@
}
#endif
- // SHORT TERM TODO: until intermediate flushes at allocation time are added we need to obey the
- // reduceOpListSplitting flag. Once that lands we should always reduce opList splitting in
- // DDL contexts/drawing managers. We should still obey the options for non-DDL drawing managers
- // until predictive intermediate flushes are added (i.e., we can't reorder forever).
fDrawingManager.reset(new GrDrawingManager(this,
prcOptions,
textContextOptions,
sortOpLists,
- this->options().fReduceOpListSplitting));
+ reduceOpListSplitting));
}
void GrRecordingContext::abandonContext() {