Revert "Reland "Clear out atlases if they haven't been used in a while.""

This reverts commit 0bd00f438e.

Reason for revert: Causing text issues in Chrome.

Original change's description:
> Reland "Clear out atlases if they haven't been used in a while."
> 
> This is a reland of 79007c9309
> 
> Original change's description:
> > Clear out atlases if they haven't been used in a while.
> > 
> > This will stage out atlas pages one at a time with an interval of
> > 256 flushes between them. Also removes the last page to help
> > conserve memory if text or other atlas-using systems are not in use.
> > 
> > Bug: 1058905
> > Change-Id: I8717621033068d0e24da944356d91b0f35e5373b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276764
> > Commit-Queue: Jim Van Verth <jvanverth@google.com>
> > Reviewed-by: Herb Derby <herb@google.com>
> 
> Bug: 1058905
> Change-Id: I25b0037cb1608ae0bda641e0d0588afaf3dd47e5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276960
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,herb@google.com,robertphillips@google.com,backer@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1058905
Change-Id: I8b6f0d1a1fb522d40cdc34ec8a2d420830117b86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277606
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2020-03-18 15:30:07 +00:00 committed by Skia Commit-Bot
parent 8edacdb6a5
commit 26651883d0
2 changed files with 6 additions and 14 deletions

View File

@ -221,7 +221,6 @@ GrDrawOpAtlas::GrDrawOpAtlas(
, fGenerationCounter(generationCounter)
, fAtlasGeneration(fGenerationCounter->next())
, fPrevFlushToken(GrDeferredUploadToken::AlreadyFlushedToken())
, fFlushesSinceLastUse(0)
, fMaxPages(AllowMultitexturing::kYes == allowMultitexturing ? kMaxMultitexturePages : 1)
, fNumActivePages(0) {
int numPlotsX = width/plotWidth;
@ -408,13 +407,11 @@ GrDrawOpAtlas::ErrorCode GrDrawOpAtlas::addToAtlas(GrResourceProvider* resourceP
}
void GrDrawOpAtlas::compact(GrDeferredUploadToken startTokenForNextFlush) {
if (fNumActivePages < 1) {
if (fNumActivePages <= 1) {
fPrevFlushToken = startTokenForNextFlush;
return;
}
++fFlushesSinceLastUse;
// For all plots, reset number of flushes since used if used this frame.
PlotList::Iter plotIter;
bool atlasUsedThisFlush = false;
@ -431,11 +428,11 @@ void GrDrawOpAtlas::compact(GrDeferredUploadToken startTokenForNextFlush) {
}
}
// We only try to compact if the atlas was used in the recently completed flush or
// hasn't been used in a long time.
// We only try to compact if the atlas was used in the recently completed flush.
// This is to handle the case where a lot of text or path rendering has occurred but then just
// a blinking cursor is drawn.
if (atlasUsedThisFlush || fFlushesSinceLastUse > kRecentlyUsedCount) {
// TODO: consider if we should also do this if it's been a long time since the last atlas use
if (atlasUsedThisFlush) {
SkTArray<Plot*> availablePlots;
uint32_t lastPageIndex = fNumActivePages - 1;
@ -540,16 +537,14 @@ void GrDrawOpAtlas::compact(GrDeferredUploadToken startTokenForNextFlush) {
}
// If none of the plots in the last page have been used recently, delete it.
if (!usedPlots || fFlushesSinceLastUse > kRecentlyUsedCount) {
if (!usedPlots) {
#ifdef DUMP_ATLAS_DATA
if (gDumpAtlasData) {
SkDebugf("delete %d\n", fNumActivePages-1);
SkDebugf("delete %d\n", fNumPages-1);
}
#endif
this->deactivateLastPage();
}
fFlushesSinceLastUse = 0;
}
fPrevFlushToken = startTokenForNextFlush;

View File

@ -435,9 +435,6 @@ private:
// nextTokenToFlush() value at the end of the previous flush
GrDeferredUploadToken fPrevFlushToken;
// the number of flushes since this atlas has been last used
int fFlushesSinceLastUse;
std::vector<EvictionCallback*> fEvictionCallbacks;
struct Page {