Closed Bug 1392143 Opened 2 years ago Closed 2 years ago

Video decoding isn't hardware accelerated inside GPU process

Categories

(Core :: Audio/Video: Playback, defect, P1)

57 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 + fixed

People

(Reporter: jya, Assigned: jya)

References

(Depends on 1 open bug)

Details

(Whiteboard: [testcoverage])

Attachments

(6 files, 1 obsolete file)

In the GPU process,
WMFDecoderModule:sDXVAEnabled is always false.

With e10s off, it is true.

This cause the RemoteVideoDecoder to be used, yet it's not HW accelerated.

There's been report of much higher CPU usage since the release of 55; this could be the cause maybe
Assignee: nobody → jyavenard
Whiteboard: [testcoverage]
It appears that on this laptop at least (AMD GPU) 
media.hardware-video-decoding.failed is set to true upon starting.

The decoder used in the GPU process is now always the sofware decoder:
 "Video Decoder(video/avc)": "wmf software video decoder (remote)"

when I manually set media.hardware-video-decoding.failed to false and restart
the HW decoder is now in use, (and the VP9 amd hardware decoder also works fine)
The issue was identified by AMD as a bug in some of their cards/drivers.

The reference video used to determine if h264 decoding works is decoded as a green frame, this causes dxva to be disabled on those machines:
Blocks: 1379928
[Tracking Requested - why for this release]: In Firefox 55 we got lots of reports that there were severe performance regression occurring when playing video. This is the result of a combination of hardware and drivers update, that has caused HW acceleration to become disabled.

The working plan is to modify the initial test to decode a video greater than 128x128, and disable hardware acceleration for resolution <= 128 pixels.
Version: unspecified → 57 Branch
On a Mac Pro 2013 with Dual D500 the test always failed, as it read black (0,0,0) instead of white.
Yet, when I open the page manually, with the HW decoder active, everything displays fine.

It appears related to where the window is painted.

In the tester we have:
    // There's no clean way to have an invisible window and ensure it's always painted.
    // Instead, move the window far offscreen so it doesn't show up during launch.
    sanityTest.moveTo(100000000, 1000000000);

 
Doing a readback with this code active, always return 0,0,0 (black) on this machine. which disables the HW acceleration
Depends on: 1397253
Comment on attachment 8905250 [details]
Bug 1392143 - P1. Change video size used for testing if h264 decoder is working.

https://reviewboard.mozilla.org/r/177048/#review182078
Attachment #8905250 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8905251 [details]
Bug 1392143 - P2. Disable hardware decoding for small videos.

https://reviewboard.mozilla.org/r/177050/#review182080
Attachment #8905251 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8905252 [details]
Bug 1392143 - P3. Retry the readback after relocating the window to (0,0).

https://reviewboard.mozilla.org/r/177052/#review182082

I don't love this, we had a lot of bugs filed in the past when people saw the sanity test window.

Can we instead run the layers rendering check first, and do the video test second?

If the layers test fails, then we can skip the video test, since it'll clearly be meaningless.

We still need to fix the underlying issue here.
Attachment #8905252 - Attachment is obsolete: true
Attachment #8905252 - Flags: review?(matt.woodrow)
Pushed by jyavenard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6c13864a1bee
P1. Change video size used for testing if h264 decoder is working. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/acf2ccf34d75
P2. Disable hardware decoding for small videos. r=mattwoodrow
Depends on: 1397681
Backed out for unexpectedly passing gl suite's dom/canvas/test/webgl-mochitest/test_video_fastpath_mp4.html, at least on Windows 7 debug:

https://hg.mozilla.org/integration/autoland/rev/3c5539322b579b27c178fde7af6c3f20c42224ec
https://hg.mozilla.org/integration/autoland/rev/72788198fef321fb56556a9f2c0c5072c68fe01a

Log with unexpected pass: https://treeherder.mozilla.org/logviewer.html#?job_id=129211535&repo=autoland
> TEST-UNEXPECTED-PASS | dom/canvas/test/webgl-mochitest/test_video_fastpath_mp4.html | fail-if condition in manifest - We expected at least one failure
Flags: needinfo?(jyavenard)
See Also: → 1397869
Comment on attachment 8905630 [details]
Bug 1392143 - P3. Resize window after moving it.

https://reviewboard.mozilla.org/r/177420/#review182486
Attachment #8905630 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8905631 [details]
Bug 1392143 - P4. Change test expectations now that it passes.

https://reviewboard.mozilla.org/r/177422/#review182488
Attachment #8905631 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8905632 [details]
Bug 1392143 - P5. Improve rendering test.

https://reviewboard.mozilla.org/r/177424/#review182490
Attachment #8905632 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8905633 [details]
Bug 1392143 - P6. Use constants in coordinate calculations.

https://reviewboard.mozilla.org/r/177426/#review182492
Attachment #8905633 - Flags: review?(matt.woodrow) → review+
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s a8b0d16e21a8 -d 1b2b3bc1d47b: rebasing 418653:a8b0d16e21a8 "Bug 1392143 - P1. Change video size used for testing if h264 decoder is working. r=mattwoodrow"
merging toolkit/components/gfx/SanityTest.js
merging toolkit/components/gfx/content/videotest.mp4
warning: /repos/mozreview-gecko/toolkit/components/gfx/content/videotest.mp4 looks like a binary file.
warning: conflicts while merging toolkit/components/gfx/content/videotest.mp4! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s e53597e1105b -d f82f69a3381a: rebasing 418657:e53597e1105b "Bug 1392143 - P1. Change video size used for testing if h264 decoder is working. r=mattwoodrow"
merging toolkit/components/gfx/SanityTest.js
merging toolkit/components/gfx/content/videotest.mp4
warning: /repos/mozreview-gecko/toolkit/components/gfx/content/videotest.mp4 looks like a binary file.
warning: conflicts while merging toolkit/components/gfx/content/videotest.mp4! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s e53597e1105b -d f82f69a3381a: rebasing 418657:e53597e1105b "Bug 1392143 - P1. Change video size used for testing if h264 decoder is working. r=mattwoodrow"
merging toolkit/components/gfx/SanityTest.js
merging toolkit/components/gfx/content/videotest.mp4
warning: /repos/mozreview-gecko/toolkit/components/gfx/content/videotest.mp4 looks like a binary file.
warning: conflicts while merging toolkit/components/gfx/content/videotest.mp4! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
Pushed by jyavenard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/40e16e34df00
P1. Change video size used for testing if h264 decoder is working. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/b1627a3a5d77
P2. Disable hardware decoding for small videos. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/ff3a335e7111
P3. Resize window after moving it. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/5220b19f1fc0
P4. Change test expectations now that it passes. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/c1fcfceeefae
P5. Improve rendering test. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/5e167360b1f9
P6. Use constants in coordinate calculations. r=mattwoodrow
Flags: needinfo?(jyavenard)
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s 58def334f4c2 -d 5534f9aff56b: rebasing 418815:58def334f4c2 "Bug 1392143 - P1. Change video size used for testing if h264 decoder is working. r=mattwoodrow"
merging toolkit/components/gfx/SanityTest.js
merging toolkit/components/gfx/content/videotest.mp4
warning: /repos/mozreview-gecko/toolkit/components/gfx/content/videotest.mp4 looks like a binary file.
warning: conflicts while merging toolkit/components/gfx/content/videotest.mp4! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
Pushed by jyavenard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/503df830e594
P1. Change video size used for testing if h264 decoder is working. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/bdd70cdbf8f1
P2. Disable hardware decoding for small videos. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/83c640edfe50
P3. Resize window after moving it. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/6714fb98a7f2
P4. Change test expectations now that it passes. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/0e76e3df8749
P5. Improve rendering test. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/9b99855c32ca
P6. Use constants in coordinate calculations. r=mattwoodrow
Hello, since nightly 8/9/17 watching a video on youtube gives me distorted colors, but firefox screenshots takes non-distorted screenshots from the video.
It shows correct colors with media.hardware-video-decoding.enabled set to false

Can't update drivers since is the last driver with support for my gpu (AMD HD 7660D) on windows


Bisecting sent me to this bug
 P6. Use constants in coordinate calculations. r=mattwoodrow

Don't know if i should fill a new bug
(In reply to superwaitsum from comment #60)
> Hello, since nightly 8/9/17 watching a video on youtube gives me distorted
> colors, but firefox screenshots takes non-distorted screenshots from the
> video.
> It shows correct colors with media.hardware-video-decoding.enabled set to
> false
> 
> Can't update drivers since is the last driver with support for my gpu (AMD
> HD 7660D) on windows
> 
> 
> Bisecting sent me to this bug
>  P6. Use constants in coordinate calculations. r=mattwoodrow
> 
> Don't know if i should fill a new bug

Thanks for the report. Yes, please file a new bug blocking this bug.
Please, follow the instructions provided in https://bugzilla.mozilla.org/show_bug.cgi?id=1352016#c63
And see if that helps (after re-enabling hardware decoding of course)

Thank you
Flags: needinfo?(superwaitsum)
Yes, after testing, "media.windows-media-foundation.use-nv12-format" set to false (with hw-decoding on) fix the video after restarting.
Flags: needinfo?(superwaitsum)
Duplicate of this bug: 1389821
Depends on: 1403499
You need to log in before you can comment on or make changes to this bug.