Closed
Bug 1379714
Opened 7 years ago
Closed 7 years ago
Improve ID3D11Buffer caching in Advanced Layers
Categories
(Core :: Graphics: Layers, enhancement)
Core
Graphics: Layers
Tracking
()
RESOLVED
FIXED
mozilla56
Tracking | Status | |
---|---|---|
firefox56 | --- | fixed |
People
(Reporter: dvander, Assigned: dvander)
References
Details
(Whiteboard: [gfx-noted])
Attachments
(2 files)
(deleted),
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
When constant buffer offsetting doesn't work, we fallback to allocating one-off ID3D11Buffers. Unfortunately that seems to be quite slow, especially on integrated GPUs. Even just allocating D3D11 objects shows up in profiles.
When Advanced Layers landed I included a quick hack to cache buffers, but it doesn't work very well. Buffers get freed too quickly, so they get allocated again rather than reclaimed.
I'd like to just remove whatever the old caching mechanism was and write a new one. This is a precursor to enabling on Windows 7 and dropping the Intel HD Graphics blocklist entry.
Assignee | ||
Updated•7 years ago
|
Whiteboard: [gfx-noted]
Assignee | ||
Comment 1•7 years ago
|
||
This just guts the old BufferCache class, so it's easier to read the next patch.
Attachment #8884946 -
Flags: review?(bas)
Assignee | ||
Comment 2•7 years ago
|
||
This patch caches buffers by bumping allocation requests up to the nearest power-of-2. We cache a pool of buffers for each pow2 allocation size. Each pool is a deque: oldest buffers at the end, newest at the back. A buffer is reclaimed by popping the front and moving it to the back.
Each cache entry also tracks the frame # it was last used. If a buffer was already used this frame it cannot be re-used. We also don't use buffers from the previous frame, just to alleviate aliasing in the driver.
Each frame we also pick a size class and see if it can be shrunk. If a buffer hasn't been used for 300 frames it gets deleted.
This strategy effectively caches things for a very long time, but it doesn't seem to affect memory use. Buffers are usually small and are only mapped when being written. Even browsing to sites like nojs, the cache showed up as 0.03MB in about:memory. And this has the advantage that complex sites can sit idle for a little bit and then go active again without reallocating ID3D11Buffers.
Attachment #8884951 -
Flags: review?(bas)
Updated•7 years ago
|
Attachment #8884946 -
Flags: review?(bas) → review+
Updated•7 years ago
|
Attachment #8884951 -
Flags: review?(bas) → review+
Pushed by danderson@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/cbfd864c4722
Remove Advanced Layers' buffer cache in preparation for a new one. (bug 1379714 part 1, r=bas)
https://hg.mozilla.org/integration/mozilla-inbound/rev/218d34629869
Cache MLGBuffers for systems that don't support constant buffer offsetting. (bug 1379714 part 2, r=bas)
Comment 4•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/cbfd864c4722
https://hg.mozilla.org/mozilla-central/rev/218d34629869
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in
before you can comment on or make changes to this bug.
Description
•