Bug 1474943 - Enable VP9 benchmark logic when using a non intel GPU on mac. r=mattwoodrow

In bug 1404042, we determined that video playback of software based surface was very slow and power hungry when using the intel GPU, but was working okay when using the dGPU (either AMD or nVidia)

So always return false in IsVP9DecodeFast when the current GPU is an Intel, as well as return a benchmark score of 0

Force a new run of the benchmarking by bumping the version number.

Differential Revision: https://phabricator.services.mozilla.com/D2075

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2018-07-12 08:52:55 +00:00
Родитель 25882d4b33
Коммит a33b077ff8
3 изменённых файлов: 46 добавлений и 5 удалений

Просмотреть файл

@ -22,6 +22,7 @@
#include "mozilla/Telemetry.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/gfx/gfxVars.h"
#include "nsIGfxInfo.h"
#ifndef MOZ_WIDGET_ANDROID
#include "WebMSample.h"
@ -33,7 +34,7 @@ namespace mozilla {
// Update this version number to force re-running the benchmark. Such as when
// an improvement to FFVP9 or LIBVPX is deemed worthwhile.
const uint32_t VP9Benchmark::sBenchmarkVersionID = 4;
const uint32_t VP9Benchmark::sBenchmarkVersionID = 5;
const char* VP9Benchmark::sBenchmarkFpsPref = "media.benchmark.vp9.fps";
const char* VP9Benchmark::sBenchmarkFpsVersionCheck = "media.benchmark.vp9.versioncheck";
@ -41,12 +42,47 @@ bool VP9Benchmark::sHasRunTest = false;
// static
bool
VP9Benchmark::IsVP9DecodeFast(bool aDefault)
VP9Benchmark::ShouldRun()
{
// Disable VP9 estimizer on Mac, see bug 1400787.
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_APPLEMEDIA)
#if defined(MOZ_WIDGET_ANDROID)
// Assume that the VP9 software decoder will always be too slow.
return false;
#else
#if defined(MOZ_APPLEMEDIA)
const nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsString vendorID, deviceID;
gfxInfo->GetAdapterVendorID(vendorID);
// We won't run the VP9 benchmark on mac using an Intel GPU as performance are
// poor, see bug 1404042.
if (vendorID.EqualsLiteral("0x8086")) {
return false;
}
// Fall Through
#endif
return true;
#endif
}
// static
uint32_t
VP9Benchmark::MediaBenchmarkVp9Fps()
{
if (!ShouldRun()) {
return 0;
}
return StaticPrefs::MediaBenchmarkVp9Threshold();
}
// static
bool
VP9Benchmark::IsVP9DecodeFast(bool aDefault)
{
#if defined(MOZ_WIDGET_ANDROID)
return false;
#else
if (!ShouldRun()) {
return false;
}
static StaticMutex sMutex;
uint32_t decodeFps = StaticPrefs::MediaBenchmarkVp9Fps();
uint32_t hadRecentUpdate = StaticPrefs::MediaBenchmarkVp9Versioncheck();

Просмотреть файл

@ -114,6 +114,11 @@ public:
static const char* sBenchmarkFpsVersionCheck;
static const uint32_t sBenchmarkVersionID;
static bool sHasRunTest;
// Return the value of media.benchmark.vp9.fps preference (which will be 0 if
// not known)
static uint32_t MediaBenchmarkVp9Fps();
private:
static bool ShouldRun();
};
}

Просмотреть файл

@ -361,7 +361,7 @@ MediaCapabilities::DecodingInfo(
powerEfficient = decoder->IsHardwareAccelerated(reason);
if (!powerEfficient && VPXDecoder::IsVP9(config->mMimeType)) {
smooth = VP9Benchmark::IsVP9DecodeFast(true /* default */);
uint32_t fps = StaticPrefs::MediaBenchmarkVp9Fps();
uint32_t fps = VP9Benchmark::MediaBenchmarkVp9Fps();
if (!smooth && fps > 0) {
// The VP9 estimizer decode a 1280x720 video. Let's adjust
// the result for the resolution and frame rate of what we