diff options
author | Jim Van Verth <jvanverth@google.com> | 2017-09-22 19:07:22 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-22 19:07:29 +0000 |
commit | 4935a019125a15f8c56bfd2a6b3d3629a64cad33 (patch) | |
tree | ea4a2b96ff0e012928b029a3082467294b81daf8 /src/gpu/GrDrawOpAtlas.h | |
parent | fddc21547de58bbbce6a0b50c1c65c0392dd09e4 (diff) |
Revert "Shrink GrDrawOpAtlases when no longer needed"
This reverts commit 7cf59526c9b1ab3682e875d449200e51f3b6ff32.
Reason for revert: Red red bots... it's tearing me apart...
Original change's description:
> Shrink GrDrawOpAtlases when no longer needed
>
> Bug: skia:3550
> Change-Id: I7b09aa2b0fd22ed99694f32f9f395392ef80e238
> Reviewed-on: https://skia-review.googlesource.com/49901
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=jvanverth@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: I8331ec79b0796e1f75d7cc53b9753f886aea7fcd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:3550
Reviewed-on: https://skia-review.googlesource.com/50220
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/gpu/GrDrawOpAtlas.h')
-rw-r--r-- | src/gpu/GrDrawOpAtlas.h | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/src/gpu/GrDrawOpAtlas.h b/src/gpu/GrDrawOpAtlas.h index d4a81a0106..87d9c5b619 100644 --- a/src/gpu/GrDrawOpAtlas.h +++ b/src/gpu/GrDrawOpAtlas.h @@ -26,29 +26,14 @@ struct GrDrawOpAtlasConfig { }; /** - * This class manages one or more atlas textures on behalf of GrDrawOps. The draw ops that use the - * atlas perform texture uploads when preparing their draws during flush. The class provides - * facilities for using GrDrawOpUploadToken to detect data hazards. Op's uploads are performed in - * "asap" mode until it is impossible to add data without overwriting texels read by draws that - * have not yet executed on the gpu. At that point, the atlas will attempt to allocate a new - * atlas texture (or "page") of the same size, up to a maximum number of textures, and upload - * to that texture. If that's not possible, the uploads are performed "inline" between draws. If a - * single draw would use enough subimage space to overflow the atlas texture then the atlas will - * fail to add a subimage. This gives the op the chance to end the draw and begin a new one. - * Additional uploads will then succeed in inline mode. - * - * When the atlas has multiple pages, new uploads are prioritized to the lower index pages, i.e., - * it will try to upload to page 0 before page 1 or 2. To keep the atlas from continually using - * excess space, periodic garbage collection is needed to shift data from the higher index pages to - * the lower ones, and then eventually remove any pages that are no longer in use. "In use" is - * determined by using the GrDrawUploadToken system: After a flush each subarea of the page - * is checked to see whether it was used in that flush; if it is not, a counter is incremented. - * Once that counter reaches a threshold that subarea is considered to be no longer in use. - * - * Garbage collection is initiated by the GrDrawOpAtlas's client via the compact() method. One - * solution is to make the client a subclass of GrOnFlushCallbackObject, register it with the - * GrContext via addOnFlushCallbackObject(), and the client's postFlush() method calls compact() - * and passes in the given GrDrawUploadToken. + * This class manages an atlas texture on behalf of GrDrawOps. The draw ops that use the atlas + * perform texture uploads when preparing their draws during flush. The class provides facilities + * for using GrDrawOpUploadToken to detect data hazards. Op's uploads are performed in "asap" mode + * until it is impossible to add data without overwriting texels read by draws that have not yet + * executed on the gpu. At that point the uploads are performed "inline" between draws. If a single + * draw would use enough subimage space to overflow the atlas texture then the atlas will fail to + * add a subimage. This gives the op the chance to end the draw and begin a new one. Additional + * uploads will then succeed in inline mode. */ class GrDrawOpAtlas { public: @@ -201,8 +186,6 @@ public: } } - void compact(GrDrawOpUploadToken startTokenForNextFlush); - static constexpr auto kGlyphMaxDim = 256; static bool GlyphTooLargeForAtlas(int width, int height) { return width > kGlyphMaxDim || height > kGlyphMaxDim; @@ -257,10 +240,6 @@ private: void uploadToTexture(GrDrawOp::WritePixelsFn&, GrTextureProxy*); void resetRects(); - int flushesSinceLastUsed() { return fFlushesSinceLastUse; } - void resetFlushesSinceLastUsed() { fFlushesSinceLastUse = 0; } - void incFlushesSinceLastUsed() { fFlushesSinceLastUse++; } - private: Plot(int pageIndex, int plotIndex, uint64_t genID, int offX, int offY, int width, int height, GrPixelConfig config); @@ -286,8 +265,6 @@ private: GrDrawOpUploadToken fLastUpload; GrDrawOpUploadToken fLastUse; - // the number of flushes since this plot has been last used - int fFlushesSinceLastUse; struct { const uint32_t fPageIndex : 16; @@ -333,12 +310,10 @@ private: fPages[pageIdx].fPlotList.remove(plot); fPages[pageIdx].fPlotList.addToHead(plot); - // No MRU update for pages -- since we will always try to add from - // the front and remove from the back there is no need for MRU. + // TODO: make page MRU } bool createNewPage(); - void deleteLastPage(); inline void processEviction(AtlasID); @@ -351,8 +326,6 @@ private: SkDEBUGCODE(uint32_t fNumPlots;) uint64_t fAtlasGeneration; - // nextTokenToFlush() value at the end of the previous flush - GrDrawOpUploadToken fPrevFlushToken; struct EvictionData { EvictionFunc fFunc; |