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

video playback glitching out with hwdec "d3d11va" and/or "auto" #3255

Closed
dumpsters opened this issue Jun 15, 2016 · 22 comments
Closed

video playback glitching out with hwdec "d3d11va" and/or "auto" #3255

dumpsters opened this issue Jun 15, 2016 · 22 comments
Labels

Comments

@dumpsters
Copy link

dumpsters commented Jun 15, 2016

So I just updated my mpv and video playback seems to be glitching out when using d3d11va/auto, to be honest I've never used anything other than software or dxva2-copy til now.

Platform:
Windows 10 Enterprise Build 10586.318

Driver:
Radeon Crimson 16.6.1 (VGA: R7 260x)

mpv version tested:
latest from https://bitbucket.org/rorgoroth/mpv-for-windows/downloads (mpv-latest-Win64.zip) as of today/when I'm posting this

MPC-HC version tested:
latest from https://mpc-hc.org/downloads/ ("v1.7.10 which was compiled from d911f14") x64

Two .webm files and one image showing off the problem:
https://u.pomf.is/dazvpi.webm
https://u.pomf.is/cbejfy.webm (with stats)
glitched d3d11va

Same file running on MPC-HC (unchanged configs):
mpc-hc

DXVA Checker:
dxva

hwdec options I tried and their results:

  • d3d11va -> glitched like in the examples
  • d3d11va-copy -> (no glitch)
  • dxva2 -> seems to work fine from what I've seen (no glitch)
  • auto -> goes to d3d11va (glitched)
  • auto-copy -> goes to dxva2-copy (no glitch)

relevant mpv.conf:

vo=opengl-hq:backend=angle:swapinterval=1:icc-profile="~~/monitor-profiles/SM633NW.icm":icc-contrast=0:blend-subtitles:deband:deband-grain=0:scale=ewa_lanczossharp:cscale=ewa_lanczossharp:tscale=oversample
hwdec=auto
video-sync=display-resample
framedrop=no

ontop=yes
geometry=50%:50%
autofit-larger=960x600
keep-open
no-border

ad-lavc-downmix=yes
audio-channels=mono

output log from one of the video files:
output.txt

Let me know if you need any more informations. As a side note, I would love to know how to properly use the monitor profile's constrast and how to properly downsample to mono sound.

@ghost ghost added the os:win label Jun 15, 2016
@ghost
Copy link

ghost commented Jun 15, 2016

I assume --hwdec=auto-copy works? What about a simple --vo=opengl?

@dumpsters
Copy link
Author

dumpsters commented Jun 15, 2016

--hwdec=auto-copy sets it to dxva2-copy.
What do you mean by simple --vo-opengl? just that without anything else in the config file or same config file but opengl instead of opengl-hq?

Also I forgot to mention in the OP that d3d11va-copy seems to work, I don't know the differences between that and d3d11va or anything but just thought I should say.
d3d11va-copy

@ghost
Copy link

ghost commented Jun 15, 2016

d3d11va is the mode --hwdec=auto selects in your case. Can you test --no-config --vo=opengl --hwdec=d3d11va ?

@dumpsters
Copy link
Author

Here's how it plays with those parameters:
https://u.pomf.is/zpivjv.webm

Also I updated the "hwdec options I tried and their results" section in the OP.

@ghost
Copy link

ghost commented Jun 15, 2016

What happens if run with --hwdec=auto --vf=d3d11vpp:interlaced-only=no?

@dumpsters
Copy link
Author

dumpsters commented Jun 15, 2016

https://u.pomf.is/izuiqi.webm
and just with --vf=d3d11vpp and no interlaced-only=no it justs glitches again

@ghost
Copy link

ghost commented Jun 16, 2016

Does the branch d3d_copy_texture help?

@dumpsters
Copy link
Author

Using https://bitbucket.org/rorgoroth/mpv-for-windows/downloads/mpv64__d3d_copy_texture.7z

mpv "Game.of.Thrones.S06E09.1080p.HDTV.x264-BATV.mkv" --no-config --vo=opengl-hq --hwdec=d3d11va

VO does not support requested hardware decoder, or loading it failed.
AO: [wasapi] 44100Hz stereo 2ch float
Using software decoding.

with d3d11va-copy mpv crashes.

@ghost
Copy link

ghost commented Jun 22, 2016

The crash is a small oversight. I fixed it and force-pushed the branch.

Not sure why the d3d11va mode doesn't work for you. It does for me.

@dumpsters
Copy link
Author

I noticed the same glitch happening on youtube and oddshot.tv sometimes so maybe it's not an mpv issue but a driver/os one?

@rossy
Copy link
Member

rossy commented Jul 11, 2016

Possibly related Chrome issue (see the attached WebM): http://crbug.com/623029

It seems like Chrome are solving this by manually blacklisting AMD drivers from using external NV12 textures.

@haasn
Copy link
Member

haasn commented Jul 11, 2016

How about we manually blacklist AMD drivers?

@ghost
Copy link

ghost commented Jul 11, 2016

That issue just says that they reverted the default. Looking forward to seeing how they solve it and it they find the real cause. (Surely they know how to contact the AMD driver team directly.)

@vishnunaini
Copy link

Chrome is working around the bug when it detects AMD drivers by using disable_dxgi_zero_copy_video, disable_nv12_dxgi_video flags when it detects the faulty hardware.

This works in chrome's case because chrome's code has a solid infrastructure to workaround driver bugs on a case by case basis.

It is better if mpv can add some case by case detection code in d3d11va to use d3d11va-copy when it detects AMD hardware. Or only add it to auto code and document d3d11va as faulty on amd hardware.

@ghost
Copy link

ghost commented Oct 21, 2016

How about AMD fixes their shit?

@Jimmy-Z
Copy link

Jimmy-Z commented Oct 21, 2016

still true with 16.9.2 driver, very disappointed in AMD

@ghost
Copy link

ghost commented Oct 21, 2016

To be honest I'm not sure if there could be a user error (documentation about d3d11va and threading isn't very explicit on MSDN). But if even Google chose to use a blacklist, it seems likely that their code is actually correct and AMD's drivers are broken. I'd expect that Google and AMD are in contact with each other. Also, I haven't heard of problems on other platforms (Intel/nvidia).

Is it known whether all AMD hardware is affected?

Also, did anyone try the d3d_copy_texture branch? It's aging, I can rebase it if anyone wants a newer version.

@vishnunaini
Copy link

Based on the chrome source code from https://cs.chromium.org/chromium/src/gpu/config/gpu_driver_bug_list_json.cc almost all AMD hardware i.e vendor id 0x1002 appears to be affected

{ "id": 171, "description": "NV12 DXGI video hangs or displays incorrect colors on AMD drivers", "cr_bugs": [623029, 644293], "os": { "type": "win" }, "vendor_id": "0x1002", "features": [ "disable_dxgi_zero_copy_video", "disable_nv12_dxgi_video" ] },

Firefox currently disables d3d11 on all AMD hardware and falls back to dxva2

Based on both cases it can safely be assumed all AMD hardware is effected.

I tested it on a A10 APU(Radeon 7660G) with 15.7 (15.200.1065.0) driver (Trinity)
and a HD 8670M with 16.9 driver and both cases are effected.

I will try to test it soon on Carrizo chips.

@vishnunaini
Copy link

Don't assume that Google and AMD are in contact with each other. It is likely that they only contact AMD if a workaround is not possible or requires too much effort.

@dumpsters
Copy link
Author

dumpsters commented Nov 23, 2016

Using:

AMD driver 16.11.2
mpv-x86_64-20161119-git-bb48f09.7z

hwdec=d3d11va-copy
profile=opengl-hq
opengl-backend=angle
opengl-pbo=yes
opengl-swapinterval=1
opengl-shaders="~~/scripts/adaptive-sharpen-2pass.glsl"

I get [d3d11va] Failed to create Direct3D11 texture with 22 surfaces: The parameter is incorrect. (0x80070057)

d3d11va without copy: VO does not support requested hardware decoder, or loading it failed.

mpv log (d3d11va-copy):

[auto_profiles] Applying profile SD
Playing: Dawn.of.the.Dead.2004.1080p.mp4
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=und (*) (aac)
AO: [wasapi] 44100Hz stereo 2ch float
[d3d11va] Failed to create Direct3D11 texture with 22 surfaces: The parameter is incorrect. (0x80070057)
[auto_profiles] Applying profile HD
Using software decoding.
VO: [opengl] 1920x812 yuv420p
Resolution: 1920x812, Framerate: 23.976 Hz

Tried using log-file=output.txt but it gets stuck on "Playing: dir/filename" and a spam of [ 0.232][v][lavf] Found 'lrc' at score=5 size=17982. (video never gets to play)

Gonna update to latest AMD driver now and test again.

Edit: same thing with 16.11.4

@ghost
Copy link

ghost commented Nov 23, 2016

Wondering if it doesn't like D3D11_BIND_SHADER_RESOURCE...

@ghost
Copy link

ghost commented Apr 7, 2017

How about AMD fixes their shit?

Apparently this happened, according to: #3464 (comment)

So I'm closing this. If someone still has the problem even with updated AMD drivers, please post here, or open a new issue.

@ghost ghost closed this as completed Apr 7, 2017
rossy added a commit to rossy/mpv that referenced this issue Nov 2, 2017
Like the manual says, this is technically undefined behaviour. See:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff476085.aspx

In particular, MSDN says texture arrays created with the BIND_DECODER
flag cannot be used with CreateShaderResourceView, which means they
can't be sampled through SRVs like normal Direct3D textures. However,
some programs (Google Chrome included) do this anyway for performance
and power-usage reasons, and it appears to work with most drivers.

Older AMD drivers had a "bug" with zero-copy decoding, but this appears
to have been fixed. See mpv-player#3255, mpv-player#3464 and http://crbug.com/623029.
rossy added a commit to rossy/mpv that referenced this issue Nov 3, 2017
Like the manual says, this is technically undefined behaviour. See:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff476085.aspx

In particular, MSDN says texture arrays created with the BIND_DECODER
flag cannot be used with CreateShaderResourceView, which means they
can't be sampled through SRVs like normal Direct3D textures. However,
some programs (Google Chrome included) do this anyway for performance
and power-usage reasons, and it appears to work with most drivers.

Older AMD drivers had a "bug" with zero-copy decoding, but this appears
to have been fixed. See mpv-player#3255, mpv-player#3464 and http://crbug.com/623029.
rossy added a commit to rossy/mpv that referenced this issue Nov 6, 2017
Like the manual says, this is technically undefined behaviour. See:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff476085.aspx

In particular, MSDN says texture arrays created with the BIND_DECODER
flag cannot be used with CreateShaderResourceView, which means they
can't be sampled through SRVs like normal Direct3D textures. However,
some programs (Google Chrome included) do this anyway for performance
and power-usage reasons, and it appears to work with most drivers.

Older AMD drivers had a "bug" with zero-copy decoding, but this appears
to have been fixed. See mpv-player#3255, mpv-player#3464 and http://crbug.com/623029.
rossy added a commit that referenced this issue Nov 7, 2017
Like the manual says, this is technically undefined behaviour. See:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff476085.aspx

In particular, MSDN says texture arrays created with the BIND_DECODER
flag cannot be used with CreateShaderResourceView, which means they
can't be sampled through SRVs like normal Direct3D textures. However,
some programs (Google Chrome included) do this anyway for performance
and power-usage reasons, and it appears to work with most drivers.

Older AMD drivers had a "bug" with zero-copy decoding, but this appears
to have been fixed. See #3255, #3464 and http://crbug.com/623029.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants