Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: src/gpu/GrDrawingManager.cpp

Issue 2321563006: Make GrResourceCache dynamically change between LRU and random replacement strategies. (Closed)
Patch Set: fix recursive flusing, add asserts Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrDrawingManager.h ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrDrawingManager.h" 8 #include "GrDrawingManager.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 SkASSERT(fDrawTargets.count() == 1); 122 SkASSERT(fDrawTargets.count() == 1);
123 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm arked check 123 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm arked check
124 // won't bark 124 // won't bark
125 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); 125 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag);
126 } 126 }
127 #else 127 #else
128 fDrawTargets.reset(); 128 fDrawTargets.reset();
129 #endif 129 #endif
130 130
131 fFlushState.reset(); 131 fFlushState.reset();
132 // We always have to notify the cache when it requested a flush so it can re set its state. 132 // Avoid notifying the cache about successive client flushes where no render ing occurred between
133 if (flushed || type == GrResourceCache::FlushType::kCacheRequested) { 133 // them.
134 bool skipNotify = false;
135 if (!flushed) {
136 skipNotify = GrResourceCache::kExternal == fLastFlushType &&
137 GrResourceCache::kExternal == type;
138 }
139 if (!skipNotify) {
134 fContext->getResourceCache()->notifyFlushOccurred(type); 140 fContext->getResourceCache()->notifyFlushOccurred(type);
135 } 141 }
142 fLastFlushType = type;
136 fFlushing = false; 143 fFlushing = false;
137 } 144 }
138 145
139 void GrDrawingManager::prepareSurfaceForExternalIO(GrSurface* surface) { 146 void GrDrawingManager::prepareSurfaceForExternalIO(GrSurface* surface) {
140 if (this->wasAbandoned()) { 147 if (this->wasAbandoned()) {
141 return; 148 return;
142 } 149 }
143 SkASSERT(surface); 150 SkASSERT(surface);
144 SkASSERT(surface->getContext() == fContext); 151 SkASSERT(surface->getContext() == fContext);
145 152
146 if (surface->surfacePriv().hasPendingIO()) { 153 if (surface->surfacePriv().hasPendingIO()) {
147 this->flush(); 154 this->flush();
155 } else if (GrResourceCache::kExternal != fLastFlushType) {
156 fContext->getResourceCache()->notifyFlushOccurred(GrResourceCache::kExte rnal);
157 fLastFlushType = GrResourceCache::kExternal;
148 } 158 }
149 159
150 GrRenderTarget* rt = surface->asRenderTarget(); 160 GrRenderTarget* rt = surface->asRenderTarget();
151 if (fContext->getGpu() && rt) { 161 if (fContext->getGpu() && rt) {
152 fContext->getGpu()->resolveRenderTarget(rt); 162 fContext->getGpu()->resolveRenderTarget(rt);
153 } 163 }
154 } 164 }
155 165
156 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { 166 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) {
157 SkASSERT(fContext); 167 SkASSERT(fContext);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 std::move(colorSpace), s urfaceProps, 252 std::move(colorSpace), s urfaceProps,
243 fContext->getAuditTrail( ), fSingleOwner)); 253 fContext->getAuditTrail( ), fSingleOwner));
244 } 254 }
245 } 255 }
246 256
247 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), 257 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
248 std::move(colorSpace), surface Props, 258 std::move(colorSpace), surface Props,
249 fContext->getAuditTrail(), 259 fContext->getAuditTrail(),
250 fSingleOwner)); 260 fSingleOwner));
251 } 261 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawingManager.h ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698