High CPU and GPU usage with YouTube videos with NVIDIA GPU
Categories
(Core :: Graphics: WebRender, defect, P3)
Tracking
()
People
(Reporter: sciguyryan, Unassigned, NeedInfo)
References
(Blocks 2 open bugs)
Details
Attachments
(7 files, 1 obsolete file)
This one is going to be a challenge for me to report since I have been unable to pin down exactly how and why this occurs.
For the last few weeks, every so often, I've noticed my computer lagging and stuttering. After a bit of investigation it is caused by Firefox using a fairly substantial amount of CPU and GPU performance.
Note that I have an Intel i9-1200k, so using 10% of the processing power is insane. I also have a GeForce RTX 3080, which makes using 20% of its processing power even more insane.
The process persists even when I close the tab in which the video is playing. The only way to rectify the problem is to restart the browser, or find the process (see attached) and manually kill the process.
This is an intermittent issue and I've not been able to figure out exactly why this occurs, and it does not reliably reoccur with the same video either.
If anyone has any ideas on how I might be able to narrow this down, or provide additional data when it does occur, then please do let me know.
Reporter | ||
Comment 1•2 years ago
|
||
Reporter | ||
Updated•2 years ago
|
Comment 2•2 years ago
|
||
Hey, could you please post your about:support text so we can get a look at your hardware list?
Also, if you can, please help us out by generating a performance profile to diagnose.
Reporter | ||
Comment 3•2 years ago
|
||
Reporter | ||
Comment 4•2 years ago
|
||
Comment 5•2 years ago
|
||
The severity field is not set for this bug.
:jimm, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 6•2 years ago
|
||
WebRender is pegged @ 100% cpu. Looks like it's spending all it's time in the nvidia driver.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 7•2 years ago
|
||
The severity field is not set for this bug.
:bhood, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•2 years ago
|
Comment 8•2 years ago
|
||
The severity field is not set for this bug.
:bhood, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 9•2 years ago
|
||
Glenn, could you have a look at this when you get a chance? Comment 6 suggests that the path to this is going through WR.
Comment 10•2 years ago
|
||
In this case, that's because the profile was taken with screenshots enabled, so all the time in WR is doing the screenshot recording (which is a known issue, but unrelated to the reported problem).
Would you be able to do another profile with screenshot recording disabled (you can change that in the profiler settings directly, or just use the Graphics preset mode)? That will allow us to see a profile that's not obscured by the slow screenshot recording.
Reporter | ||
Comment 11•2 years ago
|
||
Hi Glenn.
This is a new profile, created with the graphics preset. As you can guess, the problem is still present and it I haven't actually been able to use Firefox as my default browser because of it.
It's causing a lot of problems due to the high GPU usage and the corresponding high power usage too. I've yet to find a solution to this.
I've read the other posts in this bug. I have performed a clean reinstall of the graphics card drivers to check that it wasn't an installation problem. It remains unchanged. If it's something on Nvidia's side of things then I have no way of verifying or reporting that.
Reporter | ||
Comment 12•2 years ago
|
||
(In reply to Glenn Watson [:gw] from comment #10)
In this case, that's because the profile was taken with screenshots enabled, so all the time in WR is doing the screenshot recording (which is a known issue, but unrelated to the reported problem).
Would you be able to do another profile with screenshot recording disabled (you can change that in the profiler settings directly, or just use the Graphics preset mode)? That will allow us to see a profile that's not obscured by the slow screenshot recording.
Also, since I forgot to state this in my last post above: if I kill the sub-process (via task manager or another means) that is causing the high GPU usage, the GPU usage will go back down to normal and remain that way until Firefox is restarted.
While that is a viable work-around, it does make the browser unusable for day-to-day usage.
Comment 13•2 years ago
|
||
Thanks for attaching the profile. This definitely seems odd for a machine of that configuration, there's multiple things in the profile that seem odd.
The first weird thing is in the WR Renderer thread. Around 4.2% of time is spent inside WR itself, submitting draw commands, while around 57% of the time is in WaitForGPU
(mostly in CDevice::GetDeviceRemovedReason
, which is inside Windows/D3D).
The second unexpected thing is event processing jank in some of the content process(es) but this may just be a side effect of whatever is causing all those issues inside D3D.
I wonder if we're seeing driver crashes and the GPU is being restarted? But then, it should fall back to sw-wr, so I don't think it's that. This is quite a mystery. It seems like there is something bad happening inside D3D and/or the GPU driver, but somehow it's being triggered by whatever WR is doing. Could you check if you have any crash reports in about:crashes
and also attach the output of your about:support
, so we can see if we can spot anything unexpected there that might give a clue?
Reporter | ||
Comment 14•2 years ago
|
||
(In reply to Glenn Watson [:gw] from comment #13)
I wonder if we're seeing driver crashes and the GPU is being restarted? But then, it should fall back to sw-wr, so I don't think it's that. This is quite a mystery. It seems like there is something bad happening inside D3D and/or the GPU driver, but somehow it's being triggered by whatever WR is doing. Could you check if you have any crash reports in
about:crashes
and also attach the output of yourabout:support
, so we can see if we can spot anything unexpected there that might give a clue?
about:crashes is completely empty. I don't actively clear those, so if there is some form of crash it certainly isn't hitting the crash catching system.
My current about:support information is as attached.
It is entirely possible that there is something dippy going on with the driver. I've just checked and I'm definitely running with the latest Nividia driver for this GPU. Is there is an issue on that side of things, I have no idea how to debug it, let alone where to report it or whom to report it to.
It's quite a mystery. As far as I can tell, it only happens within Firefox - Edge, Vivaldi, etc. don't appear to be affected by this.
Comment 15•2 years ago
|
||
The driver definitely looks up to date, from your about:support
, as you mentioned. One thing that's interesting is:
"DisplayCount": 2,
"Display0": "2560x1440@59Hz scales:1.000000|1.250000",
"Display1": "1920x1080@60Hz scales:1.000000|1.000000",
"HardwareStretching": "both=1 window-only=0 full-screen-only=1 none=0 error=0",
"OverlaySupport": "NV12=Scaling YUV2=Scaling BGRA8=Software RGB10A2=None"
So you have two displays, one of them with a scale factor (I think?) and one running at native resolution. More interestingly, one is running at 59 Hz and one is running at 60 Hz.
A couple of experiments that'd be worth trying, if feasible, just to see if we can eliminate them as a cause:
- What happens if you disconnect one of your monitors, can you still reproduce then?
- Can you set both of them to run at the same refresh rate, 60 Hz, and if so, does that have an effect?
- What happens if the scaling factors are the same on each monitor?
- If you go to
about:config
and setgfx.webrender.compositor
to be false, does it still reproduce after that? (browser restart is required when changing that config value).
Reporter | ||
Comment 16•2 years ago
|
||
(In reply to Glenn Watson [:gw] from comment #13)
The driver definitely looks up to date, from your
about:support
, as you mentioned. One thing that's interesting is:"DisplayCount": 2, "Display0": "2560x1440@59Hz scales:1.000000|1.250000", "Display1": "1920x1080@60Hz scales:1.000000|1.000000", "HardwareStretching": "both=1 window-only=0 full-screen-only=1 none=0 error=0", "OverlaySupport": "NV12=Scaling YUV2=Scaling BGRA8=Software RGB10A2=None"
So you have two displays, one of them with a scale factor (I think?) and one running at native resolution. More interestingly, one is running at 59 Hz and one is running at 60 Hz.
That is correct. One has a scale factor of 125% since it is a 1440p monitor.
A couple of experiments that'd be worth trying, if feasible, just to see if we can eliminate them as a cause:
I've got no problems with experimenting if it'll help understand this problem. It has been frustrating me for a while.
- What happens if you disconnect one of your monitors, can you still reproduce then?
If I disconnect one of the monitors (either one, I tested both individually) the high GPU usage is still experienced.
- Can you set both of them to run at the same refresh rate, 60 Hz, and if so, does that have an effect?
Unfortunately they do not have the same framerate options, they do not have any in common. This seems unlikely to be the problem here though as it still occurs with one a single monitor enabled.
- What happens if the scaling factors are the same on each monitor?
- If you go to
about:config
and setgfx.webrender.compositor
to be false, does it still reproduce after that? (browser restart is required when changing that config value).
With compositor turned off, the problem is still present, though interestingly the GPU usage is reduced quite significantly by doing so. I would imagine that is expected since the compositor is expected to leverage the GPU.
This one has me completely stumped. It certainly seems to be an issue in the drivers, but I'm still at a loss as to how to go about reporting this, let alone where to report it.
Comment 17•2 years ago
|
||
Probably a shot in the dark, but your about:support
from comment 3 says you're using NVIDIA driver version 516.59. 516.94 is the most current. Any chance you could update to the latest and see if it helps?
Comment 18•2 years ago
|
||
Another couple of things that would be helpful to test:
-
In task manager, do you see any processes (either firefox or system processes like dwm) constantly growing in memory usage? Perhaps there is some kind of memory leak causing bad memory swapping.
-
Can you try enable
gfx.webrender.debug.gpu-time-queries
andgfx.webrender.debug.profiler
inabout:config
and send us a screenshot of the profiler overlay when the problem occurs, it might offer some hints to where the GPU slowness is (no browser restart required). Just keep yourabout:config
tab open during this, as it can be a bit tricky with the overlay enabled to disable it again.
Reporter | ||
Comment 19•2 years ago
|
||
(In reply to Bob Hood [:bhood] from comment #17)
Probably a shot in the dark, but your
about:support
from comment 3 says you're using NVIDIA driver version 516.59. 516.94 is the most current. Any chance you could update to the latest and see if it helps?
It is indeed the most current driver at the time of writing.
(In reply to Glenn Watson [:gw] from comment #18)
Another couple of things that would be helpful to test:
- In task manager, do you see any processes (either firefox or system processes like dwm) constantly growing in memory usage? Perhaps there is some kind of memory leak causing bad memory swapping.
There is another process using the GPU, but closing the process doesn't eliminate the problem. I typically run into this issue while watching YouTube videos. It's typically not evident unless the resolution is above 1080p. It is pretty easy to see when it is occurring since scrolling the page significantly lags when using smooth scrolling. I used this video as my test for this since it is available in a resolution above 1080p.
https://www.youtube.com/watch?v=97hWegCZk2E
- Can you try enable
gfx.webrender.debug.gpu-time-queries
andgfx.webrender.debug.profiler
inabout:config
and send us a screenshot of the profiler overlay when the problem occurs, it might offer some hints to where the GPU slowness is (no browser restart required). Just keep yourabout:config
tab open during this, as it can be a bit tricky with the overlay enabled to disable it again.
That's a tool I've never seen before! I have attached a screenshot here, as requested.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 20•2 years ago
|
||
(In reply to Ryan Jones-Ward [:sciguyryan] from comment #14)
Created attachment 9294583 [details]
support.txt
Firefox nightly was used and the followings are enabled.
- VIDEO_OVERLAY
- HW_DECODED_VIDEO_ZERO_COPY
- REUSE_DECODER_DEVICE
With them, video playback performance should be good. I wonder if hw video decoding might cause the problem.
On Firefox, Microsoft Media Foundation classes are used for hw video decoding.
But on chromium, Microsoft Media Foundation classes are not used directly.
WR Renderer thread waited majority of time in WaitForGPU. It meant that GPU was too busy.
Comment 21•2 years ago
|
||
(In reply to Ryan Jones-Ward [:sciguyryan] from comment #12)
Also, since I forgot to state this in my last post above: if I kill the sub-process (via task manager or another means) that is causing the high GPU usage, the GPU usage will go back down to normal and remain that way until Firefox is restarted.
Both hw video decoding and WebRender rendering is normally done in GPU process on Windows.
:alwu, is it possible to get gecko profile of hw video decoding in GPU process?
Comment 22•2 years ago
|
||
Bug 1769431 also happened on NVIDIA GeForce RTX 3080.
Comment 23•2 years ago
|
||
Yes, I did a quick check on profiling with the media preset, and I can see the profiler captured the media decoder and the media supervisor thread in the GPU process.
Comment 24•2 years ago
•
|
||
Hi :sciguyryan, can you take a profile with media settings when the problem happens? Thank you.
Reporter | ||
Comment 25•2 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #24)
Hi :sciguyryan, can you take a profile with media settings when the problem happens? Thank you.
Here is the profile I recorded: https://share.firefox.dev/3SHAs9Q
Something fascinating I have noted here: when recording, the problem seems to go away. The scrolling does not lag and there is no screen tearing. This persists until the browser is restarted, at which point the problem comes back.
I have no explanation for why this would be the case, but I have tested it four times. The same thing happens each time. It's very weird.
Comment 26•2 years ago
|
||
(In reply to Ryan Jones-Ward [:sciguyryan] from comment #25)
Here is the profile I recorded: https://share.firefox.dev/3SHAs9Q
Something fascinating I have noted here: when recording, the problem seems to go away. The scrolling does not lag and there is no screen tearing. This persists until the browser is restarted, at which point the problem comes back.
I have no explanation for why this would be the case, but I have tested it four times. The same thing happens each time. It's very weird.
Thank you for taking the profile. It might be taken with "Nightly" setting. Since, it has screen shot thumbnails. When the profiler enables screenshot, it disables native compositor(DirectComposition) by RenderCompositorANGLE::EnableNativeCompositor(). And during taking the profile, it get screenshots.
These things might affect to the problem.
Comment 27•2 years ago
|
||
Hi :sciguyryan, can you take a screenshot of GPU performance in Performance Tab of Windows Task Manager(Alt + Ctrl + Delete), when the problem happens? Thank you.
Reporter | ||
Comment 28•2 years ago
|
||
Comment 29•2 years ago
|
||
Thank you! From it, one cause of the problem might be wait at RenderCompositorANGLE::WaitForGPU(). There might be cases that gpu command finish took several frames on NVIDIA gpus.
Comment 30•2 years ago
|
||
:sciguyryan, can you check if the problem still happens with latest nightly? Thank you.
Updated•2 years ago
|
Reporter | ||
Comment 31•2 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #30)
:sciguyryan, can you check if the problem still happens with latest nightly? Thank you.
I can confirm that this still occurs in the latest nightly.
I apologise for the delay in response here, we have had a family bereavement and I have not had much chance to use the computer.
Comment 32•2 years ago
|
||
Thank you for the checking! Can you take a profile with "Graphics" settings(It does not have screenshots) on nightly?
On nightly, wait at RenderCompositorANGLE::WaitForGPU() was disabled by Bug 1793388. We want to know a next blocking function.
Reporter | ||
Comment 33•2 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #32)
Thank you for the checking! Can you take a profile with "Graphics" settings(It does not have screenshots) on nightly?
On nightly, wait at RenderCompositorANGLE::WaitForGPU() was disabled by Bug 1793388. We want to know a next blocking function.
I'm once again running into the problem whereby each time I try to record the problem, the problem goes away. It is incredibly frustrating, but I haven't been able to capture a recording this time around.
I'm not really certain what to do in this instance, each time I restart the browser the problem comes back, as soon as I initiate the recorder, the problem goes away.
Comment 34•2 years ago
|
||
Thank you for trying it!
Comment 35•2 years ago
|
||
I had the same problem!!! Seems like that it is related to windows 11 animation effects!! If you disable them from windows accessibility settings the problem foes away and the gpu usage when video playback goes to just a few percent!! Try it!
Comment 36•2 years ago
|
||
Ryan, any chance you can test the fix suggested by Konstantinos in comment 35 above? It would be interesting to know if you can reproduce it.
Reporter | ||
Comment 37•2 years ago
|
||
(In reply to Bob Hood [:bhood] from comment #36)
Ryan, any chance you can test the fix suggested by Konstantinos in comment 35 above? It would be interesting to know if you can reproduce it.
Apologies for the delay, I've just tested it on my Windows 11 box and disabling the setting doesn't seem to impact the performance at all. I disabled it, restarted Windows to ensure the setting was in effect, it remained disabled.
I tested with the following video, at 1440p 60 FPS. https://www.youtube.com/watch?v=97hWegCZk2E
Comment 38•2 years ago
|
||
(In reply to Ryan Jones-Ward [:sciguyryan] from comment #37)
(In reply to Bob Hood [:bhood] from comment #36)
Ryan, any chance you can test the fix suggested by Konstantinos in comment 35 above? It would be interesting to know if you can reproduce it.
Apologies for the delay, I've just tested it on my Windows 11 box and disabling the setting doesn't seem to impact the performance at all. I disabled it, restarted Windows to ensure the setting was in effect, it remained disabled.
I tested with the following video, at 1440p 60 FPS. https://www.youtube.com/watch?v=97hWegCZk2E
Sorry to hear that this didn't work out for you.
Did a test again today with windows animation effects on and off and the difference for my setup is pretty huge!!
GPU usage with animation effects: https://ibb.co/khGfzhB
GPU usage without animation effects: https://ibb.co/tHPyFDB
Comment 39•2 years ago
|
||
(In reply to Konstantinos Kapatos from comment #38)
(In reply to Ryan Jones-Ward [:sciguyryan] from comment #37)
(In reply to Bob Hood [:bhood] from comment #36)
Ryan, any chance you can test the fix suggested by Konstantinos in comment 35 above? It would be interesting to know if you can reproduce it.
Apologies for the delay, I've just tested it on my Windows 11 box and disabling the setting doesn't seem to impact the performance at all. I disabled it, restarted Windows to ensure the setting was in effect, it remained disabled.
I tested with the following video, at 1440p 60 FPS. https://www.youtube.com/watch?v=97hWegCZk2E
Sorry to hear that this didn't work out for you.
Did a test again today with windows animation effects on and off and the difference for my setup is pretty huge!!GPU usage with animation effects: https://ibb.co/khGfzhB
GPU usage without animation effects: https://ibb.co/tHPyFDB
Also just realized something very strange, if you notice with animation effects on, the video decoding is being done by "GPU 0 - 3D", as reported by the task manager.
When I switch off animation effects then it says: "GPU 0 - Video processing".
Reporter | ||
Comment 40•2 years ago
|
||
(In reply to Konstantinos Kapatos from comment #39)
(In reply to Konstantinos Kapatos from comment #38)
(In reply to Ryan Jones-Ward [:sciguyryan] from comment #37)
(In reply to Bob Hood [:bhood] from comment #36)
Ryan, any chance you can test the fix suggested by Konstantinos in comment 35 above? It would be interesting to know if you can reproduce it.
Apologies for the delay, I've just tested it on my Windows 11 box and disabling the setting doesn't seem to impact the performance at all. I disabled it, restarted Windows to ensure the setting was in effect, it remained disabled.
I tested with the following video, at 1440p 60 FPS. https://www.youtube.com/watch?v=97hWegCZk2E
Sorry to hear that this didn't work out for you.
Did a test again today with windows animation effects on and off and the difference for my setup is pretty huge!!GPU usage with animation effects: https://ibb.co/khGfzhB
GPU usage without animation effects: https://ibb.co/tHPyFDB
Also just realized something very strange, if you notice with animation effects on, the video decoding is being done by "GPU 0 - 3D", as reported by the task manager.
When I switch off animation effects then it says: "GPU 0 - Video processing".
I've also noticed something strange too. It isn't just Firefox that is impacted by this problem, I get the same sort of problem with Vivaldi too.
My guess is that it's something driver related, or something elsewhere with the Nvidia drivers or integration. The problem there is that I don't have any contacts through which to report this to Nvidia, nor do I know of anywhere to report it.
This one is a complete mystery to me.
Comment 41•2 years ago
|
||
Try to set false to media.wmf.dxva.d3d11.enabled
in the about:config page, though I use Intel GPU with eDRAM. This is a provisional workaround, since dxva2 cloud give slightly incorrect color, which is explained in mpv manual:
dxva2 is not safe. It appears to always use BT.601 for forced RGB conversion, but actual behavior depends on the GPU drivers. Some drivers appear to convert to limited range RGB, which gives a faded appearance. In addition to driver-specific behavior, global system settings might affect this additionally. This can give incorrect results even with completely ordinary video sources.
IMHO the high GPU usage is probably caused by large queue size. I use madVR to playback local video file. The GPU clock rate is occasionally unnecessarily significantly higher if GPU queue size of madVR is large.
Reporter | ||
Comment 42•2 years ago
|
||
(In reply to fantasyfate from comment #41)
Try to set false to
media.wmf.dxva.d3d11.enabled
in the about:config page, though I use Intel GPU with eDRAM. This is a provisional workaround, since dxva2 cloud give slightly incorrect color, which is explained in mpv manual:dxva2 is not safe. It appears to always use BT.601 for forced RGB conversion, but actual behavior depends on the GPU drivers. Some drivers appear to convert to limited range RGB, which gives a faded appearance. In addition to driver-specific behavior, global system settings might affect this additionally. This can give incorrect results even with completely ordinary video sources.
IMHO the high GPU usage is probably caused by large queue size. I use madVR to playback local video file. The GPU clock rate is occasionally unnecessarily significantly higher if GPU queue size of madVR is large.
Thanks for the suggestion. Unfortunately it doesn't appear to help at all on my system.
Comment 43•2 years ago
|
||
I perceive that this bug measurably tends to occur when qBittorrent is running, as is shown in the first screenshot by coincidence.
Updated•2 years ago
|
Updated•8 months ago
|
Comment 44•2 months ago
|
||
I also have this issue. 130.0.1, its been at least a year, and possibly two.
Fullscreen on my secondary monitor(1080p) will almost max out my 3060, 3d use on the task manager is maxed. Outside of fullscreen on the secondary monitor, 3d use is roughly 10% in theatre mode.
Additionally if firefox is moved to the primary monitor(1440p), 3d use is 100% in theater mode with firefox maximized(as well as being fullscreen).
Video decode for my either monitor is 5% fullscreen and 10% theatre maximized.
I dont have the same issue using edge, 3d ranged from 20-30% and video decode is 2% regardless of monitor and fullscreen state for comparison
Description
•