Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU Video Decoding is Broken in Windows 7 #1011

Open
Half-Modern opened this issue Nov 12, 2024 · 28 comments
Open

GPU Video Decoding is Broken in Windows 7 #1011

Half-Modern opened this issue Nov 12, 2024 · 28 comments
Labels
Minor bug A bug that does not break the browser

Comments

@Half-Modern
Copy link

Half-Modern commented Nov 12, 2024

Describe the bug
In Windows 10 and Chromium 120, the browser is able to do GPU video decoding via D3D11VideoDecoder using NVIDIA Geforce GT 640.
However in Windows 7 and Supermium (126 R6), the browser won't use GPU for video decoding (D3D11VideoDecoder will fail).
This GPU supports HW encoding and decoding of H264.
GPU page report: GPU Internals.zip

To Reproduce
Steps to reproduce the behavior:

  1. Try to play H264 content via the browser (fastest way is to install enhanced-h264ify extension and play a video from Youtube)
  2. Leave it playing and go to chrome://media-internals on a new tab
  3. Find your content (starts with blob and end with kPlay)
  4. See if it uses D3D11VideoDecoder or not

Expected behavior
Supermium should initialize D3D11VideoDecoder for videos.

Screenshots
image

Desktop (please complete the following information):
OS: Windows 7 Enterprise x64 Service Pack 1 (Platform Update installed)
Browser: Supermium 126.0.6478.254 x86 (Shouldn't matter, right?)
GPU: NVIDIA GeForce GT 640 (475.14)

Additional context
I thought D3D11VideoDecoder actually worked in Windows 7 but for some reason I couldn't get it running (I installed DirectX Runtime to see if it makes a difference but it didn't).

@Half-Modern Half-Modern added the Minor bug A bug that does not break the browser label Nov 12, 2024
@Half-Modern
Copy link
Author

You have been sending the same comment to every "GPU" related issue, I don't think you're reading it completely though. If you have checked my GPU report, you would have noticed that GPU workarounds section is missing which means I've already enabled that option. Also, I never needed to use it to get the Video Decoding working.
Also can be seen in the command line options in the same HTML:
image


I also noticed that it doesn't detect the D3D11 Feature Level of my GPU while Chromium 120 detects it in Windows 10.
Running Chromium 120 in Windows 7 with VxKex didn't give me the wanted result either, so I think something is broken in Supermium where it limits the usage of D3D11VideoDecoder for Windows 10 only.
Tried Supermium + Windows 10 combination as well and I was able to get it working that way, but my problem is Windows 7-specific so it still continues in it.

@Half-Modern Half-Modern changed the title Cannot Get D3D11VideoDecoder to Work on Supported GPU (Windows 7) Can't Get D3D11VideoDecoder to Work on Supported GPU Nov 12, 2024
@Half-Modern Half-Modern closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2024
@Half-Modern Half-Modern changed the title (Windows 7) Can't Get D3D11VideoDecoder to Work on Supported GPU (DEV Doesn't Care) GPU Video Decoding is Broken in Windows 7 Nov 13, 2024
@Half-Modern Half-Modern reopened this Nov 14, 2024
@win32ss
Copy link
Owner

win32ss commented Nov 14, 2024

I didn't have proper D3D11 hardware until recently. So far, I see there isn't even an attempt to use the decoder in one testing configuration, but I will try another one which should have better D3D11 support.

@win32ss win32ss changed the title (DEV Doesn't Care) GPU Video Decoding is Broken in Windows 7 GPU Video Decoding is Broken in Windows 7 Nov 14, 2024
@ZepopaOwleMukasa
Copy link

@win32ss

Hardware decoding (essentially just H264) doesn't work on Windows 7 with any backend API in Supermium. I'm unsure about XP/Vista as they don't ship with that codec in the first place (or if their drivers even support hardware decoding, if a decoder is retroactively installed).

@Vangelis66
Copy link

I'm unsure about XP/Vista as they don't ship with that codec in the first place

Vista SP2 user here; a fully updated OS with Platform Update Supplement (PUS) has Windows Media Foundation (WMF), d3d11 and an OS-supplied h264 decoder; but Google have, since Chrome 25, blacklisted/disabled H/W-h264-decoding under Vista 😞 ; in chrome://gpu/ one gets:

Problems Detected for Hardware GPU
Hardware video decode is only supported in win7+: 159458
Disabled Features: accelerated_video_decode

https://issues.chromium.org/issues/40953931#comment15

Disable accelerated_video_decode on windows that's earlier than win7.
This should not change anything because it's never supported on older windows.
Blacklisting the feature only let chrome know earlier, to avoid a renderer hang.

@ZepopaOwleMukasa
Copy link

@win8-png

Encode capabilities have no bearing on whether or not decode is functional. While the GPU Internals page shows that, at least on a theoretical level, H264 decoding is supported; it still won't work under Windows 7 in Supermium, no matter what hardware or software configuration (Chromium 109 and below have no issues with hardware decoding).

@win32ss
Copy link
Owner

win32ss commented Nov 16, 2024

I looked through some old commits and realized that the D3D11 video decoder was never used on Windows 7 as it was blocked by an explicit version check; the DXVA video decoder was always being used instead.

The problem is that the old decoder has a very different structure compared to the current decoders and can't be easily restored.

I am looking into alternatives but finding the right one can be confusing. Until a few minutes ago, I was under the impression that DXVA2 was linked to D3D9Ex and thus needed Vista (as this page says: https://learn.microsoft.com/en-us/windows/win32/medfound/about-dxva-2-0), but then this example uses standard D3D9 and works on XP even though the readme for this sample says Vista is required: https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7Samples/multimedia/mediafoundation/dxva2_videoproc/dxva2vp.cpp

Indeed the DXVA2 option looks like the most straightforward option as it works well with D3D9 and has the closest structure to the current D3D11 setup.

@ZepopaOwleMukasa
Copy link

@win32ss

I'm pretty sure that D3D11 decoding was first introduced in Windows 8 and never supplied to Windows 7. Windows 7 always used DXVA decoding instead, this is probably why @win8-png has working hardware decode as he uses Windows 8.

MPC-HC cannot use D3D11 as a hardware decoder in Windows 7 either, it'll just tell you that it's only supported on Windows 8+.

@win8-png
Copy link

win8-png commented Nov 18, 2024

After doing some Googling for D3D11VideoDecoder, I found a question about it not working in Vivaldi browser here. People saying there that the D3D9/DXVA decoder has been disabled in Chromium since January 2023 where Windows 7/8.1 support ended.

Someone said there that he runs Vivaldi with DXVA by using --enable-features=DXVAVideoDecoding and --disable_d3d11_video_decoder (maybe only first flag of it is important):

I've managed to enable VDAVideoDecoder in vivaldi 6.1.3035.302 with these args: --enable-features=DXVAVideoDecoding --disable_d3d11_video_decoder
Seems like DXVAVideoDecoder was disabled by default in vivaldi after it's deprecation.

On the other hand, he says that in Edge Browser it doesn't work so only D3D11VideoDecoder will work in the newer versions of Chromium-based browsers.

@win32ss
Copy link
Owner

win32ss commented Nov 19, 2024

D3D11VideoDecoder in its current state requires the presence of the ID3D11VideoDecoder interface, which isn't available on Windows 7. And even newer systems lacking in D3D11 capability can't use it.

So now, here is the start of the D3D9VideoDecoder. This system is running Windows 10 but never showed any valid decoding configs before with D3D11VideoDecoder, partially because FEATURE_LEVEL_10_0 is the maximum supported:
image

@TiberiumFusion
Copy link

TiberiumFusion commented Nov 20, 2024

Maybe the folks at the VLC project could help with this, or at least their code could be useful. The VLC player appropriately uses DXVA2 on Vista and 7 and D3D11 on Windows 8+.

On another note, is the D3D11 decoder even necessary? For example, the nvidia driver's DXVA2 profiles include up to 12-bit HEVC and VP9, which covers almost everything typical and atypical in the wild. Does anyone have an authoritative list of the codecs that lack DXVA(2) support but can be decoded using D3D11?

@win32ss
Copy link
Owner

win32ss commented Nov 21, 2024

I also found out that the main Supermium fallback video decoder, the FFmpeg video decoder, also supports DXVA2. However this code isn't configured to build in Supermium at this time, and the documentation for the configuration script to change the build options for the build of FFmpeg is in the Google intranet. I will weigh my options.

UPDATE: FFmpeg is configured properly, however there seems to be an issue receiving a valid pixel format which causes the hardware rendering to be non-functional.

UPDATE II: Backing code on the Supermium side added which allows for initialization, but test Vista system has an issue decoding frames.

@ZepopaOwleMukasa
Copy link

ZepopaOwleMukasa commented Nov 23, 2024

@win32ss

Technical question; all browsers on Windows 7 always only supported DXVA2 h264 hardware decoding. However, DXVA2, even on Windows 7, is capable of leveraging h265, vp8 and vp9 (as long as the graphics processor supports those codecs) in video players and ffmpeg when using it to decode/encode.

Does this mean, when Supermium uses ffmpeg for DXVA2 decoding now/at some point, that those other codecs could now be leveraged by the browser too? Big if true.

@win32ss
Copy link
Owner

win32ss commented Nov 24, 2024

Yes, as long as the other codecs prioritize FFmpeg, which I believe some do not, like VPx (which prefers the VpxVideoDecoder). This could be changed though.

@win32ss
Copy link
Owner

win32ss commented Dec 3, 2024

There were some significant issues with the FFmpeg solution. It was clear that they would not be resolved in the short term, so I went ahead and started a DXGI/D3D11 port from Windows 8.1 to Vista/7. D3D11VideoDecoder now works, at least on H264 videos. But this comes at a cost of some UI rendering issues in the browser, which will either be resolved by disabling UI GPU compositing or various patches to the D3D11 runtime, or enhancements to my D3DKMT glue:
image
However, webpage rendering has improved considerably over the previous renderers on my Vista setup, eliminating glitches and even GPU process crashes that occurred before.
Any GPUs that support feature level 11.0 and up (GTX 400 series and up, or Ivy Bridge integrated graphics and up) will be able to use this rendering support. I need to verify the situation with slightly older GPUs; I'll check my laptop with Sandy Bridge integrated graphics now.

I hope to eventually try working with the D3D12 runtime as well.

As for VP8/VP9 hardware acceleration, D3D11VideoDecoder also supports it, but it is blocked before Windows 10 1607 by default, due to glitches reported over 7 years ago. I have no way of testing for it though as no GPU in my possession supports those codecs.

@ZepopaOwleMukasa
Copy link

@win32ss

Are you still open for the ffmpeg implementation in the future? The D3D11VideoDecoder will obviously only work on DX11.0(+) graphics hardware and Vista(+), thus excluding older hardware and XP.

@win32ss
Copy link
Owner

win32ss commented Dec 3, 2024

Yes, I'll still do something for systems with weaker to no D3D11 support. But its final form has yet to be determined, and it will only be done after my WASAPI-to-winmm wrapper is completed, which should help prove the viability of wrapping modern interfaces around legacy interfaces while allowing Windows 2000/XP to use Core Audio instead of the old audio codepaths that are prone to breakage.

@Ravenant1234
Copy link

Here are my benchmarks for gpu rendering on my pc, i hope it will be useful

image

@Ravenant1234
Copy link

It seems that D3D9 is better for gpu usage on playback??

@Ravenant1234
Copy link

Ravenant1234 commented Dec 5, 2024

and opengl without gpu-driver-bug-workarounds just break the browser

@Ravenant1234
Copy link

Ravenant1234 commented Dec 5, 2024

My gpu supports directx 10.1 soo.... it wouldnt be able to use the new renderer?

@Ravenant1234
Copy link

Ravenant1234 commented Dec 5, 2024

Also... there is something that i cant understand.... why if i play normally a video my gpu usage is 7-8-9%
image

BUT if i keep the youtube video ui active my Gpu usage spikes to 23% - 26% ????

image

Thats weird AF

@Ravenant1234
Copy link

Here are my benchmarks for gpu rendering on my pc, i hope it will be useful

image

Well, I have executed this fix: https://github.com/ptrumpis/OpenCL-AMD-GPU/tree/main and now I seem to HAVE opengl
image

@Ravenant1234
Copy link

I have installed this fix, it worked on detecting actual opengl version but Nope, Opengl Still breaks the browser......

image

https://github.com/ptrumpis/OpenCL-AMD-GPU/tree/main

image

@Ravenant1234
Copy link

wat is happening

@win32ss
Copy link
Owner

win32ss commented Dec 6, 2024

The GPU is always used, but a video decoder interface such as D3D11VideoDecoder or DXVA is needed to use the video rendering engine of the GPU, which is the most efficient method.

Furthermore, the new binaries seem to have some issues on Windows 7 because of a codepath taken on that system and not on Vista. This will need to be corrected.

@Ravenant1234
Copy link

The GPU is always used, but a video decoder interface such as D3D11VideoDecoder or DXVA is needed to use the video rendering engine of the GPU, which is the most efficient method.

Furthermore, the new binaries seem to have some issues on Windows 7 because of a codepath taken on that system and not on Vista. This will need to be corrected.

Great! Looking forward to those fixes!!!

@Ravenant1234
Copy link

The GPU is always used, but a video decoder interface such as D3D11VideoDecoder or DXVA is needed to use the video rendering engine of the GPU, which is the most efficient method.

Furthermore, the new binaries seem to have some issues on Windows 7 because of a codepath taken on that system and not on Vista. This will need to be corrected.

And what about OpenGL?

@Half-Modern
Copy link
Author

Edit the last post instead posting again so the thread could be kept cleaner. You can't do anything for now since your GPU doesn't support even D3D11_0 which is required for D3D11Decoder to work. You'd need to have VDAVideoDecoder in your browser to get acceleration, which seems to be removed in v117 or so.
If you want to have GPU accelerated video decoding, use Chromium 109 (last official version for 7&8.1) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor bug A bug that does not break the browser
Projects
None yet
Development

No branches or pull requests

7 participants