Skip to content

Commit dfc880b

Browse files
Adlai-HollerSkia Commit-Bot
authored andcommitted
Yank out old reduceOpsTaskSplitting code
The behavior previously triggered by this flag is reimplemented in review.skia.org/345168 . The current implementation isn't used and can't really be used safely because it may go over the GPU memory budget. Bug: skia:10877 Change-Id: I2759c688aa60a618ef76dfec0a49ef5e5f0a9afc Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345477 Reviewed-by: Robert Phillips <[email protected]> Reviewed-by: Brian Salomon <[email protected]> Commit-Queue: Brian Salomon <[email protected]> Auto-Submit: Adlai Holler <[email protected]>
1 parent dcd2f86 commit dfc880b

File tree

3 files changed

+55
-103
lines changed

3 files changed

+55
-103
lines changed

include/gpu/GrContextOptions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,9 @@ struct SK_API GrContextOptions {
174174
Enable fUseDrawInsteadOfClear = Enable::kDefault;
175175

176176
/**
177-
* Allow Ganesh to more aggressively reorder operations.
177+
* Experimental: Allow Ganesh to more aggressively reorder operations.
178178
* Eventually this will just be what is done and will not be optional.
179+
* Note: This option currently has no effect while we update its implementation.
179180
*/
180181
Enable fReduceOpsTaskSplitting = Enable::kDefault;
181182

src/gpu/GrDrawingManager.cpp

Lines changed: 52 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -629,44 +629,31 @@ void GrDrawingManager::createDDLTask(sk_sp<const SkDeferredDisplayList> ddl,
629629

630630
#ifdef SK_DEBUG
631631
void GrDrawingManager::validate() const {
632-
if (fReduceOpsTaskSplitting) {
633-
SkASSERT(!fActiveOpsTask);
634-
} else {
635-
if (fActiveOpsTask) {
636-
SkASSERT(!fDAG.empty());
637-
SkASSERT(!fActiveOpsTask->isClosed());
638-
SkASSERT(fActiveOpsTask == fDAG.back().get());
639-
}
632+
if (fActiveOpsTask) {
633+
SkASSERT(!fDAG.empty());
634+
SkASSERT(!fActiveOpsTask->isClosed());
635+
SkASSERT(fActiveOpsTask == fDAG.back().get());
636+
}
640637

641-
for (int i = 0; i < fDAG.count(); ++i) {
642-
if (fActiveOpsTask != fDAG[i].get()) {
643-
// The resolveTask associated with the activeTask remains open for as long as the
644-
// activeTask does.
645-
bool isActiveResolveTask =
646-
fActiveOpsTask && fActiveOpsTask->fTextureResolveTask == fDAG[i].get();
647-
SkASSERT(isActiveResolveTask || fDAG[i]->isClosed());
648-
}
638+
for (int i = 0; i < fDAG.count(); ++i) {
639+
if (fActiveOpsTask != fDAG[i].get()) {
640+
// The resolveTask associated with the activeTask remains open for as long as the
641+
// activeTask does.
642+
bool isActiveResolveTask =
643+
fActiveOpsTask && fActiveOpsTask->fTextureResolveTask == fDAG[i].get();
644+
SkASSERT(isActiveResolveTask || fDAG[i]->isClosed());
649645
}
646+
}
650647

651-
if (!fDAG.empty() && !fDAG.back()->isClosed()) {
652-
SkASSERT(fActiveOpsTask == fDAG.back().get());
653-
}
648+
if (!fDAG.empty() && !fDAG.back()->isClosed()) {
649+
SkASSERT(fActiveOpsTask == fDAG.back().get());
654650
}
655651
}
656652
#endif
657653

658-
void GrDrawingManager::closeRenderTasksForNewRenderTask(GrSurfaceProxy* target) {
659-
if (target && fReduceOpsTaskSplitting) {
660-
// In this case we need to close all the renderTasks that rely on the current contents of
661-
// 'target'. That is bc we're going to update the content of the proxy so they need to be
662-
// split in case they use both the old and new content. (This is a bit of an overkill: they
663-
// really only need to be split if they ever reference proxy's contents again but that is
664-
// hard to predict/handle).
665-
if (GrRenderTask* lastRenderTask = this->getLastRenderTask(target)) {
666-
lastRenderTask->closeThoseWhoDependOnMe(*fContext->priv().caps());
667-
}
668-
} else if (fActiveOpsTask) {
669-
// This is a temporary fix for the partial-MDB world. In that world we're not
654+
void GrDrawingManager::closeActiveOpsTask() {
655+
if (fActiveOpsTask) {
656+
// This is a temporary fix for the partial-MDB world. In that world we're not
670657
// reordering so ops that (in the single opsTask world) would've just glommed onto the
671658
// end of the single opsTask but referred to a far earlier RT need to appear in their
672659
// own opsTask.
@@ -680,22 +667,19 @@ sk_sp<GrOpsTask> GrDrawingManager::newOpsTask(GrSurfaceProxyView surfaceView,
680667
SkDEBUGCODE(this->validate());
681668
SkASSERT(fContext);
682669

683-
GrSurfaceProxy* proxy = surfaceView.proxy();
684-
this->closeRenderTasksForNewRenderTask(proxy);
670+
this->closeActiveOpsTask();
685671

686672
sk_sp<GrOpsTask> opsTask(new GrOpsTask(this, fContext->priv().arenas(),
687673
std::move(surfaceView),
688674
fContext->priv().auditTrail()));
689-
SkASSERT(this->getLastRenderTask(proxy) == opsTask.get());
675+
SkASSERT(this->getLastRenderTask(opsTask->target(0).proxy()) == opsTask.get());
690676

691677
if (flushTimeOpsTask) {
692678
fOnFlushRenderTasks.push_back(opsTask);
693679
} else {
694680
this->appendTask(opsTask);
695681

696-
if (!fReduceOpsTaskSplitting) {
697-
fActiveOpsTask = opsTask.get();
698-
}
682+
fActiveOpsTask = opsTask.get();
699683
}
700684

701685
SkDEBUGCODE(this->validate());
@@ -727,65 +711,36 @@ void GrDrawingManager::newWaitRenderTask(sk_sp<GrSurfaceProxy> proxy,
727711
sk_sp<GrWaitRenderTask> waitTask = sk_make_sp<GrWaitRenderTask>(GrSurfaceProxyView(proxy),
728712
std::move(semaphores),
729713
numSemaphores);
730-
if (fReduceOpsTaskSplitting) {
731-
GrRenderTask* lastTask = this->getLastRenderTask(proxy.get());
732-
if (lastTask && !lastTask->isClosed()) {
733-
// We directly make the currently open renderTask depend on waitTask instead of using
734-
// the proxy version of addDependency. The waitTask will never need to trigger any
735-
// resolves or mip map generation which is the main advantage of going through the proxy
736-
// version. Additionally we would've had to temporarily set the wait task as the
737-
// lastRenderTask on the proxy, add the dependency, and then reset the lastRenderTask to
738-
// lastTask. Additionally we add all dependencies of lastTask to waitTask so that the
739-
// waitTask doesn't get reordered before them and unnecessarily block those tasks.
740-
// Note: Any previous Ops already in lastTask will get blocked by the wait semaphore
741-
// even though they don't need to be for correctness.
742-
743-
// Make sure we add the dependencies of lastTask to waitTask first or else we'll get a
744-
// circular self dependency of waitTask on waitTask.
745-
waitTask->addDependenciesFromOtherTask(lastTask);
746-
lastTask->addDependency(waitTask.get());
747-
} else {
748-
// If there is a last task we set the waitTask to depend on it so that it doesn't get
749-
// reordered in front of the lastTask causing the lastTask to be blocked by the
750-
// semaphore. Again we directly just go through adding the dependency to the task and
751-
// not the proxy since we don't need to worry about resolving anything.
752-
if (lastTask) {
753-
waitTask->addDependency(lastTask);
754-
}
755-
this->setLastRenderTask(proxy.get(), waitTask.get());
756-
}
757-
this->appendTask(waitTask);
714+
715+
if (fActiveOpsTask && (fActiveOpsTask->target(0).proxy() == proxy.get())) {
716+
SkASSERT(this->getLastRenderTask(proxy.get()) == fActiveOpsTask);
717+
this->insertTaskBeforeLast(waitTask);
718+
// In this case we keep the current renderTask open but just insert the new waitTask
719+
// before it in the list. The waitTask will never need to trigger any resolves or mip
720+
// map generation which is the main advantage of going through the proxy version.
721+
// Additionally we would've had to temporarily set the wait task as the lastRenderTask
722+
// on the proxy, add the dependency, and then reset the lastRenderTask to
723+
// fActiveOpsTask. Additionally we make the waitTask depend on all of fActiveOpsTask
724+
// dependencies so that we don't unnecessarily reorder the waitTask before them.
725+
// Note: Any previous Ops already in fActiveOpsTask will get blocked by the wait
726+
// semaphore even though they don't need to be for correctness.
727+
728+
// Make sure we add the dependencies of fActiveOpsTask to waitTask first or else we'll
729+
// get a circular self dependency of waitTask on waitTask.
730+
waitTask->addDependenciesFromOtherTask(fActiveOpsTask);
731+
fActiveOpsTask->addDependency(waitTask.get());
758732
} else {
759-
if (fActiveOpsTask && (fActiveOpsTask->target(0).proxy() == proxy.get())) {
760-
SkASSERT(this->getLastRenderTask(proxy.get()) == fActiveOpsTask);
761-
this->insertTaskBeforeLast(waitTask);
762-
// In this case we keep the current renderTask open but just insert the new waitTask
763-
// before it in the list. The waitTask will never need to trigger any resolves or mip
764-
// map generation which is the main advantage of going through the proxy version.
765-
// Additionally we would've had to temporarily set the wait task as the lastRenderTask
766-
// on the proxy, add the dependency, and then reset the lastRenderTask to
767-
// fActiveOpsTask. Additionally we make the waitTask depend on all of fActiveOpsTask
768-
// dependencies so that we don't unnecessarily reorder the waitTask before them.
769-
// Note: Any previous Ops already in fActiveOpsTask will get blocked by the wait
770-
// semaphore even though they don't need to be for correctness.
771-
772-
// Make sure we add the dependencies of fActiveOpsTask to waitTask first or else we'll
773-
// get a circular self dependency of waitTask on waitTask.
774-
waitTask->addDependenciesFromOtherTask(fActiveOpsTask);
775-
fActiveOpsTask->addDependency(waitTask.get());
776-
} else {
777-
// In this case we just close the previous RenderTask and start and append the waitTask
778-
// to the DAG. Since it is the last task now we call setLastRenderTask on the proxy. If
779-
// there is a lastTask on the proxy we make waitTask depend on that task. This
780-
// dependency isn't strictly needed but it does keep the DAG from reordering the
781-
// waitTask earlier and blocking more tasks.
782-
if (GrRenderTask* lastTask = this->getLastRenderTask(proxy.get())) {
783-
waitTask->addDependency(lastTask);
784-
}
785-
this->setLastRenderTask(proxy.get(), waitTask.get());
786-
this->closeRenderTasksForNewRenderTask(proxy.get());
787-
this->appendTask(waitTask);
788-
}
733+
// In this case we just close the previous RenderTask and start and append the waitTask
734+
// to the DAG. Since it is the last task now we call setLastRenderTask on the proxy. If
735+
// there is a lastTask on the proxy we make waitTask depend on that task. This
736+
// dependency isn't strictly needed but it does keep the DAG from reordering the
737+
// waitTask earlier and blocking more tasks.
738+
if (GrRenderTask* lastTask = this->getLastRenderTask(proxy.get())) {
739+
waitTask->addDependency(lastTask);
740+
}
741+
this->setLastRenderTask(proxy.get(), waitTask.get());
742+
this->closeActiveOpsTask();
743+
this->appendTask(waitTask);
789744
}
790745
waitTask->makeClosed(caps);
791746

@@ -800,8 +755,7 @@ void GrDrawingManager::newTransferFromRenderTask(sk_sp<GrSurfaceProxy> srcProxy,
800755
size_t dstOffset) {
801756
SkDEBUGCODE(this->validate());
802757
SkASSERT(fContext);
803-
// This copies from srcProxy to dstBuffer so it doesn't have a real target.
804-
this->closeRenderTasksForNewRenderTask(nullptr);
758+
this->closeActiveOpsTask();
805759

806760
GrRenderTask* task = this->appendTask(sk_make_sp<GrTransferFromRenderTask>(
807761
srcProxy, srcRect, surfaceColorType, dstColorType,
@@ -828,7 +782,7 @@ bool GrDrawingManager::newCopyRenderTask(GrSurfaceProxyView srcView,
828782
SkDEBUGCODE(this->validate());
829783
SkASSERT(fContext);
830784

831-
this->closeRenderTasksForNewRenderTask(dstView.proxy());
785+
this->closeActiveOpsTask();
832786
const GrCaps& caps = *fContext->priv().caps();
833787

834788
GrSurfaceProxy* srcProxy = srcView.proxy();

src/gpu/GrDrawingManager.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ class GrDrawingManager {
126126

127127
bool wasAbandoned() const;
128128

129-
// Closes the target's dependent render tasks (or, if not in sorting/opsTask-splitting-reduction
130-
// mode, closes fActiveOpsTask) in preparation for us opening a new opsTask that will write to
131-
// 'target'.
132-
void closeRenderTasksForNewRenderTask(GrSurfaceProxy* target);
129+
void closeActiveOpsTask();
133130

134131
// return true if any GrRenderTasks were actually executed; false otherwise
135132
bool executeRenderTasks(int startIndex, int stopIndex, GrOpFlushState*,

0 commit comments

Comments
 (0)