Texture upload is inefficient on Android
Categories
(Core :: Graphics: WebRender, enhancement, P1)
Tracking
()
People
(Reporter: mstange, Assigned: jnicol)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
Updated•6 years ago
|
Updated•6 years ago
|
Comment 1•6 years ago
|
||
Updated•6 years ago
|
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 4•6 years ago
|
||
Here's another profile of texture upload problems https://perfht.ml/2R3ylkb from bug 1511731
Comment 5•6 years ago
|
||
log_gpu_snapshot
is also showing up there. (not sure if that's expected)
Comment 6•6 years ago
|
||
WebRender won't be in Android until after 67
Assignee | ||
Comment 7•6 years ago
|
||
We're already using a PBO, but we're hitting a path in the driver which means it cannot do the upload asynchronously. In the profile under glTexSubImage3D you can see function names showing software copies and lots of waiting.
This is because the stride of the data in the buffer is not a multiple of 256 bytes. If we ensure the stride (and offset) is correct then the driver can do the upload asynchronously.
I have a naive implementation of this working, using glBufferSubData individually for each row to ensure the buffer is packed correctly. My profiles show the time for glTexSubImage3D pretty much disappears, and is now internally a quick hardware copy. However, the multiple calls to glBufferSubData is now slow. I'm working on using glMapBufferRange to eliminate that cost, then all should be good hopefully.
Assignee | ||
Comment 8•6 years ago
|
||
Okay, got MapBufferRange working. Here's a profile: https://perfht.ml/2Xcykut
All in all it looks much better than before. The bulk of the time is now the memcpy in to the buffer, and it's tiny compared to before.
I've made a pull request to add the required functions to gleam (https://github.com/servo/gleam/pull/183) and will tidy up my webrender patch and put it up for review.
Comment 9•6 years ago
|
||
The gleam stuff has been uploaded to crates.io as 0.6.9
Assignee | ||
Comment 10•6 years ago
|
||
This provides the functions glMapBufferRange and glUnmapBuffer.
Assignee | ||
Comment 11•6 years ago
|
||
Currently on Android we upload texture data to the webrender texture
cache using a PBO. On Adreno GPUs, however, this upload is still being
done synchronously, and profiles show a lot of time spent waiting in
glTexSubImage3D.
The problem is that the stride of the data in the PBO is not a
multiple of 256 bytes, so the driver is not able to DMA the upload.
This patch ensures that data is laid out optimally in the PBO, using
glMapBufferRange then copying the data line-by-line if required. This
allows the driver to perform the upload asynchronously as intended.
Depends on D20491
Assignee | ||
Comment 12•6 years ago
|
||
I tested this on a Galaxy S6 (Mali) and found that texture upload is fine even without my patch. So I've made the patch adreno-specific for now, but it will be easy to add other GPUs/platforms if required
Comment 13•6 years ago
|
||
Comment 14•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/dd8f4d598a43
https://hg.mozilla.org/mozilla-central/rev/a9eee2d6d9b8
Description
•