Opening specific PDF freezes Firefox for 10s, if hardware acceleration is enabled
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
People
(Reporter: linuxhippy, Unassigned)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0
Steps to reproduce:
opened https://static.nhtsa.gov/odi/tsbs/2015/MC-10124696-9999.pdf
Actual results:
Firefox froze during loading for 10s
Expected results:
firefox should not freeze during loading
Comment 1•5 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::PDF Viewer' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•5 months ago
|
||
Could you install the Firefox profiler and get a profile when loading the pdf ?
I cannot reproduce your issue.
Comment 3•5 months ago
|
||
The severity field is not set for this bug.
:calixte, could you have a look please?
For more information, please visit BugBot documentation.
Comment 4•5 months ago
|
||
I profiled the rendering of the first 10 pages and I don't see anything on Windows 11.
:Clemens, if you can still reproduce this issue, please provide us a performance profile and reopen this bug.
Reporter | ||
Comment 5•5 months ago
|
||
Maybe you should try it on a linux box?
But if you prefer, you can leave it in resolved state too - it won't make any difference.
Firefox profile with pdf.js from github:
https://share.firefox.dev/4a1OVpc
The first page appears, but afterwards firefox doesn't respond 10 seconds on input - even the loading spinner gets stuck.
Reporter | ||
Comment 6•5 months ago
|
||
profile recorded with sysprof
Updated•5 months ago
|
Comment 7•4 months ago
|
||
The severity field is not set for this bug.
:calixte, could you have a look please?
For more information, please visit BugBot documentation.
Comment 8•4 months ago
|
||
The profile shows that we spend too much time in drawing the gradient.
:jrmuizel, could you have a look please ?
Comment 9•4 months ago
|
||
Redirecting NI to Lee.
As a short term fix it might be worth considering having pdf.js use willReadFrequently
to avoid using GPU canvas.
Comment 10•4 months ago
|
||
As a short term fix it might be worth considering having pdf.js use willReadFrequently to avoid using GPU canvas.
Yes I think it's a good idea.
I'll add a pref in order to use willReadFrequently
:
If the pref is:
true
(default in nightly) thenwillReadFrequently
isfalse
false
(default in beta/release) thenwillReadFrequently
istrue
I think it makes sense to havewillReadFrequently
set tofalse
in nightly in order to be able to catch potential regressions.
Comment 11•4 months ago
|
||
(In reply to Calixte Denizet (:calixte) from comment #10)
As a short term fix it might be worth considering having pdf.js use willReadFrequently to avoid using GPU canvas.
Yes I think it's a good idea.
I'll add a pref in order to usewillReadFrequently
:
If the pref is:
true
(default in nightly) thenwillReadFrequently
isfalse
false
(default in beta/release) thenwillReadFrequently
istrue
I think it makes sense to havewillReadFrequently
set tofalse
in nightly in order to be able to catch potential regressions.
As we discussed in the team meeting today, we should have willReadFrequently true
in Nightly too because we need to catch regressions in the configuration we actually ship to users.
If feasible and if it is of interest to the gfx team, we could run the perf tests both with willReadFrequently set to true and with willReadFrequently set to false.
Reporter | ||
Comment 12•4 months ago
|
||
So if PDFJs is reading back frequntly from the Canvas - isn't Canvas the wrong abstraction for rendering PDFs?
Wouldn't it make more sense to open a WebGL context and use that for rendering (which in the end a gpu accelerated canvas will do more or less, too - just without the WebGL API abstraction) and perform the operations required using shaders instead of using an arbitrary limited API interface (Canvas) which causes because of its intentional simplicity many software-fallbacks / readbacks?
Updated•4 months ago
|
Comment 13•4 months ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #9)
Redirecting NI to Lee.
As a short term fix it might be worth considering having pdf.js use
willReadFrequently
to avoid using GPU canvas.
I guess this would also help with bug 1895499.
Updated•3 months ago
|
Updated•2 months ago
|
Comment 14•2 months ago
|
||
The severity field is not set for this bug.
:lsalzman, could you have a look please?
For more information, please visit BugBot documentation.
Updated•2 months ago
|
Description
•