Capturing profiler screenshots with WebRender on Android is really slow on the Moto G5
Categories
(Core :: Graphics: WebRender, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox70 | --- | fixed |
People
(Reporter: mstange, Assigned: jnicol)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Profile: https://perfht.ml/32AFfk6
read_pixels_into_pbo is taking up 150ms per call and looks to be doing pixel format conversions on the CPU.
Updated•7 years ago
|
| Assignee | ||
Comment 1•6 years ago
|
||
I would guess this is the inverse problem as bug 1498732. That ReadPixels cannot be done asynchronously because the stride of the data being transferred is not 256 bytes. I think the "convert" in the function names is a red herring, it's probably just that the slow path is the same regardless of whether the format needs conversion?
If I change the width in read_pixels_into_pbo to a multiple of 256 / 4 then read pixels disappears from the profiles.
| Reporter | ||
Comment 2•6 years ago
|
||
I see! So could we fix this by just upping the screenshot size from 350 to 384 in ProfilerScreenshots.h?
| Assignee | ||
Comment 3•6 years ago
•
|
||
We could fix it by making sure the screenshot width a multiple of 64, yes. But I don't think setting ScreenshotSize() to 384x384 is quite be enough - currently on my device the size we choose is 213x350, because the width and height are both scaled to fit inside 350x350. If we changed it to 384 it'd choose 233x384 or something like that, and will choose something else on a screen with a different aspect ratio. So the logic to choose the scale needs to be a wee bit smarter.
| Reporter | ||
Comment 4•6 years ago
|
||
Oh, I assumed we always read back the entire square and cropped it afterwards. (At least in the non-WebRender implementation, the scale down buffers are all square.)
| Assignee | ||
Comment 5•6 years ago
|
||
I've only really skimmed this code but presumably we could round up the width of the final scale-down buffer. (and then we'd have to return both the width and the stride so that the calling code knows how to crop it?)
| Assignee | ||
Comment 6•6 years ago
|
||
Been getting up to speed on this this today. The scale down buffers are indeed square, but we ReadPixels the rectangular area to the PBO (which is obviously 1-dimensional, but we tightly pack it and assume that width == stride later on when we map it). This shouldn't be too hard to fix.
| Assignee | ||
Comment 7•6 years ago
|
||
The glReadPixels call for capturing profiler screenshots is very slow
on Adreno devices. Similarly to bug 1498732, this is because the
stride of the data being transferred is not a multiple of 256, so the
driver is taking the synchronous path instead of reading in to a PBO
asynchronously.
This solves this problem by increasing the width of the area we read
so that we hit the fast path. To do this we must ensure that the PBO
and the final scale-down texture are large enough to include the extra
pixels in each row. As the required size of the PBO or texture may now
change, for example after a screen rotation, we now handle deleting
and recreating them when necessary.
Comment 9•6 years ago
|
||
| bugherder | ||
Description
•