Always try to reduce opList splitting in DDL contexts/drawingManagers
This may get us in trouble w/ local DDL testing (since we run all our GMs through DDLs). For Chrome this shouldn't yet be a problem (since they are only using DDLs for compositing).
This does mean we're on a tight timeline to land predictive intermediate flushes before Chrome starts using DDLs for rasterization.
Change-Id: I0bb95c075cff3ee49498ff267d76c3a61d16373e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199722
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDDLContext.cpp b/src/gpu/GrDDLContext.cpp
index 6836e46..c10659d 100644
--- a/src/gpu/GrDDLContext.cpp
+++ b/src/gpu/GrDDLContext.cpp
@@ -52,9 +52,10 @@
return false;
}
- // DDL contexts/drawing managers always sort the oplists. This, in turn, implies that
- // explicit resource allocation is always on (regardless of how Skia is compiled).
- this->setupDrawingManager(true, true);
+ // DDL contexts/drawing managers always sort the oplists and reduce opList splitting.
+ // This, in turn, implies that explicit resource allocation is always on (regardless
+ // of how Skia is compiled).
+ this->setupDrawingManager(true, true, true);
SkASSERT(this->caps());
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index b6d45ff..fc3866d 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -145,7 +145,7 @@
const GrTextContext::Options& optionsForTextContext,
bool explicitlyAllocating,
bool sortOpLists,
- GrContextOptions::Enable reduceOpListSplitting)
+ bool reduceOpListSplitting)
: fContext(context)
, fOptionsForPathRendererChain(optionsForPathRendererChain)
, fOptionsForTextContext(optionsForTextContext)
@@ -153,16 +153,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 3f2245e..0f5f0df 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -140,7 +140,7 @@
const GrTextContext::Options&,
bool explicitlyAllocating,
bool sortOpLists,
- GrContextOptions::Enable reduceOpListSplitting);
+ bool reduceOpListSplitting);
bool wasAbandoned() const;
diff --git a/src/gpu/GrLegacyDirectContext.cpp b/src/gpu/GrLegacyDirectContext.cpp
index d5bce1b..7a5fad0 100644
--- a/src/gpu/GrLegacyDirectContext.cpp
+++ b/src/gpu/GrLegacyDirectContext.cpp
@@ -86,7 +86,18 @@
sortOpLists = true;
}
- this->setupDrawingManager(this->explicitlyAllocateGPUResources(), sortOpLists);
+ // For now, this is only turned on for direct rendering when explicitly enabled.
+ // Once predictive intermediate flushes are implemented it should be enabled whenever
+ // sorting is enabled.
+ bool reduceOpListSplitting = false; // sortOpLists
+ if (GrContextOptions::Enable::kNo == this->options().fReduceOpListSplitting) {
+ reduceOpListSplitting = false;
+ } else if (GrContextOptions::Enable::kYes == this->options().fReduceOpListSplitting) {
+ reduceOpListSplitting = true;
+ }
+
+ this->setupDrawingManager(this->explicitlyAllocateGPUResources(),
+ sortOpLists, reduceOpListSplitting);
SkASSERT(this->caps());
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 5d907bf..088aebe 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -64,7 +64,9 @@
return true;
}
-void GrRecordingContext::setupDrawingManager(bool explicitlyAllocate, bool sortOpLists) {
+void GrRecordingContext::setupDrawingManager(bool explicitlyAllocate,
+ bool sortOpLists,
+ bool reduceOpListSplitting) {
GrPathRendererChain::Options prcOptions;
prcOptions.fAllowPathMaskCaching = this->options().fAllowPathMaskCaching;
#if GR_TEST_UTILS
@@ -94,16 +96,12 @@
}
#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,
- explicitlyAllocate,
- sortOpLists,
- this->options().fReduceOpListSplitting));
+ prcOptions,
+ textContextOptions,
+ explicitlyAllocate,
+ sortOpLists,
+ reduceOpListSplitting));
}
void GrRecordingContext::abandonContext() {