pdf.js's image scaling causes readback when it draws a large canvas to a small canvas
Categories
(Core :: Graphics: Canvas2D, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | affected |
People
(Reporter: mstange, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
pdf.js now defaults to using hardware accelerated canvases by default. But as part of drawing, it sometimes draws a large canvas to a small canvas. We have a minimum size for hardware accelerated canvas (128, gfx.canvas.accelerated.min-size), so often these draws go into a non-accelerated canvas, and we're forced to do a readback of the large canvas. For these small canvases we also turn off remoteness, so the readback blocks the content process main thread, rather than just blocking the canvas worker in the GPU process.
The experimental pdf.js workload in Speedometer hits this: https://webkit-speedometer-preview.netlify.app/?suites=PDFViewer-PDFjs
Profile: https://share.firefox.dev/3Vtxrkg
I could see three remedies:
- Remove the minimum size; check where the per-GPU-canvas overhead is coming from and reduce it
- Don't make software canvases render on the main thread, keep using remoteness
- Accelerate small canvases if the first draw to them after buffer reset is a drawImage from an accelerated canvas
Comment 1•2 days ago
|
||
Setting severity S3 / priority P3 by comparison with similar triaged Canvas2D readback and performance bugs (e.g. bug 2038926, S3): a main-thread stall in a specific workload, with the main mitigation (bug 2094308) already landed.
Description
•