Closed Bug 1131638 Opened 9 years ago Closed 9 years ago

Multiple AMD video cards have issues displaying 1080@60fps videos

Categories

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

36 Branch
x86_64
Windows 8.1
defect

Tracking

()

VERIFIED FIXED
mozilla39
Tracking Status
firefox37 + verified
firefox38 + verified
firefox39 + fixed

People

(Reporter: bmaris, Assigned: mattwoodrow)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 2 obsolete files)

Bug logged based on bug 1120128 comment 42.

In bug 1120128 AMD Radeon HD5800 video card was blacklisted so that 1080p60fps videos would work smooth. I was able to still see the issue on two more AMD cards, HD6450 and HD7700 series.

STR:
1. Visit https://www.youtube.com/watch?v=7SRTEXSpcyI
2. Change the quality of the video to 1080p60fps

Expected: Video runs smooth.

Actual: Video has a lot of black frames and some stuttering.

Graphics
Adapter Description	AMD Radeon HD 6450
Adapter Drivers	aticfx64 aticfx64 aticfx64 aticfx32 aticfx32 aticfx32 atiumd64 atidxx64 atidxx64 atiumdag atidxx32 atidxx32 atiumdva atiumd6a atitmm64
Adapter RAM	1024
Device ID	0x6779
Direct2D Enabled	true
DirectWrite Enabled	true (6.3.9600.17111)
Driver Date	11-20-2014
Driver Version	14.501.1003.0
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
Subsys ID	21251462
Vendor ID	0x1002
WebGL Renderer	Google Inc. -- ANGLE (AMD Radeon HD 6450 Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d 1.1
AzureContentBackend	direct2d 1.1
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0

Graphics
Adapter Description AMD Radeon HD 7700 Series
Adapter Drivers aticfx64 aticfx64 aticfx64 aticfx32 aticfx32 aticfx32 atiumd64 atidxx64 atidxx64 atiumdag atidxx32 atidxx32 atiumdva atiumd6a atitmm64
Adapter RAM 1024
Device ID 0x683f
Direct2D Enabled true
DirectWrite Enabled true (6.3.9600.17111)
Driver Date 11-20-2014
Driver Version 14.501.1003.0
GPU #2 Active false
GPU Accelerated Windows 1/1 Direct3D 11 (OMTC)
Subsys ID 00000000
Vendor ID 0x1002
WebGL Renderer Google Inc. -- ANGLE (AMD Radeon HD 7700 Series Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote true
AzureCanvasBackend direct2d 1.1
AzureContentBackend direct2d 1.1
AzureFallbackCanvasBackend cairo
AzureSkiaAccelerated 0

Catalyst Version: 14.12 AMD Catalyst Omega Software
Blocks: MSE
Priority: -- → P1
Do we need to expand the blacklist, or does this indicate that it's a pan-GPU driver issue?
Flags: needinfo?(matt.woodrow)
I suspect we need to blacklist some more cards, but I'm looking into a black flashing issue with Anthony's machine that could be related.
Flags: needinfo?(matt.woodrow)
On Win7.1 with Radeon HD7770, the video plays normally.
Can you please test with the builds below to see if this still happens.

http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/mwoodrow@mozilla.com-6db0d6b003f5/try-win32/
Flags: needinfo?(bogdan.maris)
Windows 8.1 64bit, Radeon HD5770.
The video "lags" but no black frames with the try build.
(In reply to Matt Woodrow (:mattwoodrow) from comment #4)
> Can you please test with the builds below to see if this still happens.
> 
> http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/mwoodrow@mozilla.
> com-6db0d6b003f5/try-win32/

AMD Radeon HD6450/Windows 8.1 64bit 
- No black frames, but as annaeus said in comment 5 if I switch to full screen the video lags.

AMD Radeon HD7700/Windows 8.1 64bit
- No black frames, no lags, works just fine.
Flags: needinfo?(bogdan.maris)
Attached patch Discard frames that fail to sync (obsolete) — Splinter Review
This fixes the black frames by just dropping them instead.

We might want to consider recording how often this happens, and falling back to software decoding if it's too frequent (though software might still be worse, so it's a bit complex).
Assignee: nobody → matt.woodrow
Attachment #8568262 - Flags: review?(cpearce)
Comment on attachment 8568262 [details] [diff] [review]
Discard frames that fail to sync

Review of attachment 8568262 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/D3D9SurfaceImage.cpp
@@ +167,5 @@
> +      mIsValid = false;
> +    }
> +    break;
> +  }
> +  

Fixed whitespace locally.
Comment on attachment 8568262 [details] [diff] [review]
Discard frames that fail to sync

Review of attachment 8568262 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/D3D9SurfaceImage.cpp
@@ +157,2 @@
>  
> +  int iterations = 0;

Should probably comment here why we do this. Also the comment on line 139 implies that we won't be waiting, but that's not the case now that we sleep here.
Attachment #8568262 - Flags: review?(cpearce) → review+
https://hg.mozilla.org/mozilla-central/rev/78b34d0e414a
https://hg.mozilla.org/mozilla-central/rev/1b55b99dc432
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
I am still experiencing this issue with the latest nightly. 720@60 works flawlessly, 1080 barely works at all. Sapphire Tri-X OC R9 290X with latest drivers
It seems this patch has fixed the flashing black frames, but 1080p@60fps videos still barely play for me, with an extremely low frame rate. My graphics info from about:support:

Adapter Description: AMD Radeon HD 6800 Series
Adapter Drivers: aticfx64 aticfx64 aticfx64 aticfx32 aticfx32 aticfx32 atiumd64 atidxx64 atidxx64 atiumdag atidxx32 atidxx32 atiumdva atiumd6a atitmm64
Adapter RAM: 1024
Device ID: 0x6738
Direct2D Enabled: true
DirectWrite Enabled: true (6.3.9600.17415)
Driver Date: 11-20-2014
Driver Version: 14.501.1003.0
GPU #2 Active: false
GPU Accelerated Windows: 1/1 Direct3D 11 (OMTC)
Subsys ID: 174b174b
Vendor ID: 0x1002
WebGL Renderer: Google Inc. -- ANGLE (AMD Radeon HD 6800 Series Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote: true
AzureCanvasBackend: direct2d 1.1
AzureContentBackend: direct2d 1.1
AzureFallbackCanvasBackend: cairo
AzureSkiaAccelerated: 0
Same issue for me, actually. Here's my about:support information

Adapter Description	AMD Radeon R9 200 Series
Adapter Drivers	aticfx64 aticfx64 aticfx64 aticfx32 aticfx32 aticfx32 atiumd64 atidxx64 atidxx64 atiumdag atidxx32 atidxx32 atiumdva atiumd6a atitmm64
Adapter RAM	4095
Device ID	0x67b0
Direct2D Enabled	true
DirectWrite Enabled	true (6.3.9600.17415)
Driver Date	11-20-2014
Driver Version	14.501.1003.0
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 11 (OMTC)
Subsys ID	00000000
Vendor ID	0x1002
WebGL Renderer	Google Inc. -- ANGLE (AMD Radeon R9 200 Series Direct3D11 vs_5_0 ps_5_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d 1.1
AzureContentBackend	direct2d 1.1
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0
I have a machine with a radeon card now, am investigating this further.
Depends on: 1138945
Depends on: 1139748
Depends on: 1140675
Backing this out for causing a bunch of regressions.

https://hg.mozilla.org/integration/mozilla-inbound/rev/3bd19a1cf4b4
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #8575731 - Flags: review?(cpearce)
Attachment #8568262 - Attachment is obsolete: true
Attachment #8575731 - Flags: review?(cpearce) → review+
Comment on attachment 8575734 [details] [diff] [review]
Disable hardware decoding if too many frames are invalid

Review of attachment 8575734 [details] [diff] [review]:
-----------------------------------------------------------------

Looks fine, but if we can use MP4Reader::DecoderData::mError instead of adding a very similar MP4Reader::DecoderData::mPendingError, we should.

::: dom/media/MediaDecoderStateMachine.cpp
@@ +2909,5 @@
>    if (container) {
>      if (aData->mImage && !aData->mImage->IsValid()) {
>        MediaDecoder::FrameStatistics& frameStats = mDecoder->GetFrameStatistics();
>        frameStats.NotifyCorruptFrame();
> +      if (frameStats.GetCorruptedFrames() == MAX_CORRUPTED_FRAMES) {

Maybe we should only attempt to disable hardware acceleration if mReader->VideoIsHardwareAccelerated() returns true?

@@ +2910,5 @@
>      if (aData->mImage && !aData->mImage->IsValid()) {
>        MediaDecoder::FrameStatistics& frameStats = mDecoder->GetFrameStatistics();
>        frameStats.NotifyCorruptFrame();
> +      if (frameStats.GetCorruptedFrames() == MAX_CORRUPTED_FRAMES) {
> +        DecodeTaskQueue()->Dispatch(new DisableHardwareAccelerationRunnable(mReader));

You should be able to use:

NS_NewRunnableMethod(mReader, &MediaDecoderReader::DisableHardwareAcceleration)

Right?

::: dom/media/fmp4/MP4Reader.cpp
@@ +594,5 @@
> +      mVideo.mError = true;
> +      if (mVideo.HasPromise()) {
> +        mVideo.RejectPromise(DECODE_ERROR, __func__);
> +      } else {
> +        mVideo.mPendingError = true;

Can we get away with using mError here instead?

@@ +644,5 @@
>    }
>  
>    MonitorAutoLock lock(mVideo.mMonitor);
>    nsRefPtr<VideoDataPromise> p = mVideo.mPromise.Ensure(__func__);
> +  if (mVideo.mPendingError) {

And can we use mError here too?

If we've previously error'd we should be unable to continue decoding.

::: dom/media/mediasource/MediaSourceReader.h
@@ +84,5 @@
>  
>    void NotifyTimeRangesChanged();
>  
> +  virtual void DisableHardwareAcceleration() MOZ_OVERRIDE {
> +    if (GetVideoReader()) {

Doesn't this need to take the decoder monitor in order to be threadsafe?
Attachment #8575734 - Flags: review?(cpearce) → review+
Attachment #8575733 - Flags: review?(ajones) → review+
Attachment #8575734 - Attachment is obsolete: true
Attachment #8576439 - Flags: review?(cpearce)
> > +  virtual void DisableHardwareAcceleration() MOZ_OVERRIDE {
> > +    if (GetVideoReader()) {
> 
> Doesn't this need to take the decoder monitor in order to be threadsafe?

Do we? Other accesses to GetVideoReader() don't hold the monitor.
Attachment #8576439 - Flags: review?(cpearce) → review+
Depends on: 1142527
Matt - 37 is marked as affected. wdyt about uplifting to Beta?
Flags: needinfo?(matt.woodrow)
Comment on attachment 8575731 [details] [diff] [review]
Discard frames that fail to sync v2

Approval Request Comment
[Feature/regressing bug #]: MSE
[User impact if declined]: Black video frames with a lot of AMD video cards
[Describe test coverage new/current, TreeHerder]: Tested manually, few days on nightly.
[Risks and why]: Fairly low risk, very important to MSE playback performance.
[String/UUID change made/needed]: None
Flags: needinfo?(matt.woodrow)
Attachment #8575731 - Flags: approval-mozilla-beta?
Attachment #8575731 - Flags: approval-mozilla-aurora?
Attachment #8575731 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment on attachment 8575731 [details] [diff] [review]
Discard frames that fail to sync v2

MSE is set to release in 37. Let's take this fix in Beta 6 now that it's had a few days of testing on Nightly. Beta+
Attachment #8575731 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Windows beta builds are still broken even after including bug 1128380 due to bug 1097699 only being on 38+.
https://treeherder.mozilla.org/logviewer.html#?job_id=5681916&repo=try
Flags: needinfo?(matt.woodrow)
Flags: needinfo?(matt.woodrow)
Flags: qe-verify+
No longer depends on: 1142527
I verified that the issue does not reproduce anymore on Firefox 37.0 RC build 2 and Firefox 38 beta 1. I will go ahead and close this issue for now.
Robert and Gustavo, can you still reproduce on this builds?
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/37.0-candidates/build2/win32/en-US/Firefox%20Setup%2037.0.exe
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/38.0b1-candidates/build1/win32/en-US/Firefox%20Setup%2038.0b1.exe
Status: RESOLVED → VERIFIED
Flags: needinfo?(rjward0)
Flags: needinfo?(gtns1994)
Sorry for the delay in responding. The issue no longer occurs on current builds.
Flags: needinfo?(gtns1994)
Flags: qe-verify+
Sorry for the delay as well, WFM
Flags: needinfo?(rjward0)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: