src/libANGLE/HandleAllocator.h


Log

Author Commit Date CI Message
Solti Ho df4d9667 2023-12-13T18:28:53 Revert "Optimize HandleAllocator for fast ID churning." This reverts commit b25ffe5a9775cc912a304c8552dd9c097a93420a. Reason for revert: b/316162914 Original change's description: > Optimize HandleAllocator for fast ID churning. > > Instead of calculating ranges of IDs and the overhead with updating > them every allocation/release, store a released ID list in a small > FastVector. > > Optimize the allocate path for the "good case" of no reserved IDs so > that it either pops the last released ID or incriments a next value and > returns it. Release has a similar cost of just a push_back when there > are no reserved IDs. > > This adds a small fixed memory cost due to the FastVector and a dynamic > memory cost of mReleasedList having up to N elements where N is the > maxmimum total handles allocated at one time. > > Bug: angleproject:8434 > Change-Id: I7c5aa126b5303c105cd2464d0d0933b922cc2b8f > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5101509 > Reviewed-by: Charlie Lao <cclao@google.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:8434 Change-Id: Ide43d787b6942cc6b622e3b5d938bfbbbf3b3ebb No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5120277 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Geoff Lang b25ffe5a 2023-12-07T16:36:29 Optimize HandleAllocator for fast ID churning. Instead of calculating ranges of IDs and the overhead with updating them every allocation/release, store a released ID list in a small FastVector. Optimize the allocate path for the "good case" of no reserved IDs so that it either pops the last released ID or incriments a next value and returns it. Release has a similar cost of just a push_back when there are no reserved IDs. This adds a small fixed memory cost due to the FastVector and a dynamic memory cost of mReleasedList having up to N elements where N is the maxmimum total handles allocated at one time. Bug: angleproject:8434 Change-Id: I7c5aa126b5303c105cd2464d0d0933b922cc2b8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5101509 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 6399f8d3 2023-09-24T05:01:22 Bugfix in HandleAllocator::reset(...) Cache "maximumHandleValue" passed in via constructor and use this value in reset(...) Bug: angleproject:8354 Test: HandleAllocatorTest.ResetAndReallocate Change-Id: I63bb953186a07d32582a0276af3ac8cb26a007a5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4888690 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Mohan Maiya a7238b52 2022-04-28T12:04:51 Consolidate handle list before pushing to mReleasedList Walk mUnallocatedList and try consolidating the range before pushing the to-be-released handle onto mReleasedList. This avoids a buggy behavior with dEQP which can be reproduced by running the following tests in this order - dEQP.GLES3/functional_samplers_single_cubemap_diff_wrap_t dEQP.GLES3/functional_negative_api_buffer_framebuffer_texture_layer Test: HandleAllocatorTest.ConsolidateRangeDuringRelease Bug: angleproject:7248 Change-Id: I8d2701f193fc6a2f36151c09719284a7832ab2d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3617198 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill fc3463da 2018-01-03T13:46:21 HandleAllocator: Fix heap ordering using std::greater. The default heap ordering is to return the greatest element in the heap. Since the handle allocator expects a minimal return value on a new allocation, this caused a bug. The bug is triggered by reserving handles, allocating new handles, then freeing the handles and allocating again with the same allocator. Fix the bug by using std::greater instead of std::less, which will make the heap return the smallest value instead of largest. Also adds some logging debugging code for the handle allocators. Bug: angleproject:1458 Change-Id: Ibef5dcbed0a664ccad0e0335f081e2355162584b Reviewed-on: https://chromium-review.googlesource.com/848644 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill eccd7ece 2017-09-14T15:46:22 Use a heap for the released handle list. This will prioritize re-allocating smaller handles. It should not affect performance in most cases, but will prefer allocating handles that are in the "fast" portion of the resource map. BUG=angleproject:1458 Change-Id: Ib2853be936f09fc1e6b5bfb870c360ce8424ab5f Reviewed-on: https://chromium-review.googlesource.com/665993 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 96a483bc 2017-06-27T16:49:21 Add a ResourceMap class for faster GL resource maps. This gives a very fast query time for handles that are within a fixed range. For WebGL, where we don't allow create-on-bind, this will be 100% of the time, unless we create a very large number of resources. It is implemented as a two-tier map - the first uses a flat array to index into a handle buffer. The second tier uses a map for out-of- range values. BUG=angleproject:1458 Change-Id: I421bb3725cf523918cdfdbfaab035ad0dd3bf82d Reviewed-on: https://chromium-review.googlesource.com/544684 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez c0281d46 2016-10-17T15:19:01 HandleAllocator: make HandleRange inclusive. Previously part of the code saw it as [begin, end) while others saw it as [begin, end]. BUG=angleproject:1052 BUG=chromium:656485 Change-Id: Id8e9e26b167e02a07dfc5341569df53a14d0623d Reviewed-on: https://chromium-review.googlesource.com/399565 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 5bf9ff4a 2016-02-01T11:13:03 Fix leak with binding Framebuffers directly. Using BindFramebuffer(1) then GenFramebuffers would return 1. This leads to a memory leak and was something that was obscuring debugging a bug in my ReadPixels fix for ES3. This also fixes a bug where running the texture tests along produces some random failures. BUG=angleproject:1290 BUG=angleproject:1299 Change-Id: If11e8c743d2ddde725b12749ac012f670cd290e1 Reviewed-on: https://chromium-review.googlesource.com/324820 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill f0d10f89 2015-03-31T12:56:52 Replace non-copyable macro with a helper class. This class provides a simpler scheme for blocking default copy and assignment operators. It also reduces the amount of code needed since it's inherited to child classes. This also fixes the conflict between our macro and the same-named macro in Chromium code. BUG=angleproject:956 Change-Id: If0dc72aa3f63fbc7b8fa34907418821c64c39e2f Reviewed-on: https://chromium-review.googlesource.com/263257 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org>
Jamie Madill bdd419f9 2015-03-20T15:29:42 Fix ResourceManager create-on-bind reallocations. *re-land with build fix for Clang* We had a funny bug where the Handle Allocator would re-allocate reserved handles after the app layer creates one with Bind rather than using Gen. This affects Textures, Buffers and Renderbuffers. Fix this by using a different allocation scheme. It should still be fast on the "good" case (using Gen) and use tree lookups on the bind case. Also add some unit tests. BUG=angleproject:942 Change-Id: I63ce608fcd6a11f92e2b5421f090551934e729ed Reviewed-on: https://chromium-review.googlesource.com/261591 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 21045f5a 2015-03-20T19:28:45 Revert "Fix ResourceManager create-on-bind reallocations." Build break on GPU FYI Bots on Linux/Mac: http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Mac%20Builder/builds/28092 This reverts commit 61ce1a414e74f6a72a520d6adf59bff13aff03a0. Change-Id: If2e7fb35c769708a783a32932b777dc97eaba8a4 Reviewed-on: https://chromium-review.googlesource.com/261590 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 61ce1a41 2015-03-20T13:13:04 Fix ResourceManager create-on-bind reallocations. We had a funny bug where the Handle Allocator would re-allocate reserved handles after the app layer creates one with Bind rather than using Gen. This affects Textures, Buffers and Renderbuffers. Fix this by using a different allocation scheme. It should still be fast on the "good" case (using Gen) and use tree lookups on the bind case. Also add some unit tests. BUG=angleproject:942 Change-Id: I2e3f4c31b28cb86bd3699035f5d55568a2a1d7d5 Reviewed-on: https://chromium-review.googlesource.com/258904 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 0a73dd85 2014-11-19T16:18:08 Fix include guards. BUG=angle:733 Change-Id: I08b2c11c4831f1161c178c1842b10e807185aced Reviewed-on: https://chromium-review.googlesource.com/230831 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 2b5420c0 2014-11-19T14:20:15 Merge libGLESv2 and libEGL classes into libANGLE. BUG=angle:733 Change-Id: Ic491c971411fe82c56cd97c5c8325ac14ec218df Reviewed-on: https://chromium-review.googlesource.com/230830 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>