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

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

Issue 2321563006: Make GrResourceCache dynamically change between LRU and random replacement strategies. (Closed)
Patch Set: rebase Created 4 years, 3 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
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 redundant client flushes.
robertphillips 2016/09/13 13:05:21 Should this 'fLastFlushType' be 'type' ? I guess I
bsalomon 2016/09/13 13:31:32 Changing it slightly to: // Avoid notifying t
robertphillips 2016/09/13 13:56:48 That is far clearer. \o/
133 if (flushed || type == GrResourceCache::FlushType::kCacheRequested) { 133 bool skipNotify = !flushed && GrResourceCache::kExternal != fLastFlushType;
134 if (!skipNotify) {
134 fContext->getResourceCache()->notifyFlushOccurred(type); 135 fContext->getResourceCache()->notifyFlushOccurred(type);
135 } 136 }
137 fLastFlushType = type;
136 fFlushing = false; 138 fFlushing = false;
137 } 139 }
138 140
139 void GrDrawingManager::prepareSurfaceForExternalIO(GrSurface* surface) { 141 void GrDrawingManager::prepareSurfaceForExternalIO(GrSurface* surface) {
140 if (this->wasAbandoned()) { 142 if (this->wasAbandoned()) {
141 return; 143 return;
142 } 144 }
143 SkASSERT(surface); 145 SkASSERT(surface);
144 SkASSERT(surface->getContext() == fContext); 146 SkASSERT(surface->getContext() == fContext);
145 147
146 if (surface->surfacePriv().hasPendingIO()) { 148 if (surface->surfacePriv().hasPendingIO()) {
147 this->flush(); 149 this->flush();
150 } else if (GrResourceCache::kExternal != fLastFlushType) {
151 fContext->getResourceCache()->notifyFlushOccurred(GrResourceCache::kExte rnal);
152 fLastFlushType = GrResourceCache::kExternal;
148 } 153 }
149 154
150 GrRenderTarget* rt = surface->asRenderTarget(); 155 GrRenderTarget* rt = surface->asRenderTarget();
151 if (fContext->getGpu() && rt) { 156 if (fContext->getGpu() && rt) {
152 fContext->getGpu()->resolveRenderTarget(rt); 157 fContext->getGpu()->resolveRenderTarget(rt);
153 } 158 }
154 } 159 }
155 160
156 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { 161 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) {
157 SkASSERT(fContext); 162 SkASSERT(fContext);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 std::move(colorSpace), s urfaceProps, 244 std::move(colorSpace), s urfaceProps,
240 fContext->getAuditTrail( ), fSingleOwner)); 245 fContext->getAuditTrail( ), fSingleOwner));
241 } 246 }
242 } 247 }
243 248
244 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), 249 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
245 std::move(colorSpace), surface Props, 250 std::move(colorSpace), surface Props,
246 fContext->getAuditTrail(), 251 fContext->getAuditTrail(),
247 fSingleOwner)); 252 fSingleOwner));
248 } 253 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawingManager.h ('k') | src/gpu/GrResourceCache.h » ('j') | src/gpu/GrResourceCache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698