зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1760887 - Expose FEATURE_VP8_HW_DECODE and FEATURE_VP9_HW_DECODE to the downloadable blocklist. r=gfx-reviewers,jnicol,media-playback-reviewers,alwu
This patch also exposes it as a gfxVar for cross process/thread-safe access. Differential Revision: https://phabricator.services.mozilla.com/D141803
This commit is contained in:
Родитель
8245e73b53
Коммит
3df496f168
|
@ -13,6 +13,7 @@
|
||||||
#include "mozilla/ClearOnShutdown.h"
|
#include "mozilla/ClearOnShutdown.h"
|
||||||
#include "mozilla/Components.h"
|
#include "mozilla/Components.h"
|
||||||
#include "mozilla/StaticPrefs_media.h"
|
#include "mozilla/StaticPrefs_media.h"
|
||||||
|
#include "mozilla/gfx/gfxVars.h"
|
||||||
#include "mozilla/java/HardwareCodecCapabilityUtilsWrappers.h"
|
#include "mozilla/java/HardwareCodecCapabilityUtilsWrappers.h"
|
||||||
#include "nsIGfxInfo.h"
|
#include "nsIGfxInfo.h"
|
||||||
#include "nsPromiseFlatString.h"
|
#include "nsPromiseFlatString.h"
|
||||||
|
@ -45,17 +46,6 @@ const nsCString TranslateMimeType(const nsACString& aMimeType) {
|
||||||
return nsCString(aMimeType);
|
return nsCString(aMimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetFeatureStatus(int32_t aFeature) {
|
|
||||||
nsCOMPtr<nsIGfxInfo> gfxInfo = components::GfxInfo::Service();
|
|
||||||
int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
|
|
||||||
nsCString discardFailureId;
|
|
||||||
if (!gfxInfo || NS_FAILED(gfxInfo->GetFeatureStatus(
|
|
||||||
aFeature, discardFailureId, &status))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return status == nsIGfxInfo::FEATURE_STATUS_OK;
|
|
||||||
};
|
|
||||||
|
|
||||||
AndroidDecoderModule::AndroidDecoderModule(CDMProxy* aProxy) {
|
AndroidDecoderModule::AndroidDecoderModule(CDMProxy* aProxy) {
|
||||||
mProxy = static_cast<MediaDrmCDMProxy*>(aProxy);
|
mProxy = static_cast<MediaDrmCDMProxy*>(aProxy);
|
||||||
}
|
}
|
||||||
|
@ -85,9 +75,9 @@ bool AndroidDecoderModule::SupportsMimeType(const nsACString& aMimeType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP8) &&
|
if ((VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP8) &&
|
||||||
!GetFeatureStatus(nsIGfxInfo::FEATURE_VP8_HW_DECODE)) ||
|
!gfx::gfxVars::UseVP8HwDecode()) ||
|
||||||
(VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP9) &&
|
(VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP9) &&
|
||||||
!GetFeatureStatus(nsIGfxInfo::FEATURE_VP9_HW_DECODE))) {
|
!gfx::gfxVars::UseVP9HwDecode())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,9 @@ namespace gfx {
|
||||||
_(WINDOW_OCCLUSION, Feature, "WINDOW_OCCLUSION") \
|
_(WINDOW_OCCLUSION, Feature, "WINDOW_OCCLUSION") \
|
||||||
_(VAAPI, Feature, "VA-API video decoding") \
|
_(VAAPI, Feature, "VA-API video decoding") \
|
||||||
_(VIDEO_OVERLAY, Feature, "video overlay") \
|
_(VIDEO_OVERLAY, Feature, "video overlay") \
|
||||||
/* Add new entries above this comment */
|
_(VP8_HW_DECODE, Feature, "VP8 hardware decoding") \
|
||||||
|
_(VP9_HW_DECODE, Feature, "VP9 hardware decoding")
|
||||||
|
/* Add new entries above this comment */
|
||||||
|
|
||||||
enum class Feature : uint32_t {
|
enum class Feature : uint32_t {
|
||||||
#define MAKE_ENUM(name, type, desc) name,
|
#define MAKE_ENUM(name, type, desc) name,
|
||||||
|
|
|
@ -88,7 +88,9 @@ class gfxVarReceiver;
|
||||||
_(WebRenderRequiresHardwareDriver, bool, false) \
|
_(WebRenderRequiresHardwareDriver, bool, false) \
|
||||||
_(SupportsThreadsafeGL, bool, false) \
|
_(SupportsThreadsafeGL, bool, false) \
|
||||||
_(OffscreenCanvasDomainAllowlist, nsCString, nsCString()) \
|
_(OffscreenCanvasDomainAllowlist, nsCString, nsCString()) \
|
||||||
_(AllowWebGPU, bool, false)
|
_(AllowWebGPU, bool, false) \
|
||||||
|
_(UseVP8HwDecode, bool, false) \
|
||||||
|
_(UseVP9HwDecode, bool, false)
|
||||||
|
|
||||||
/* Add new entries above this line. */
|
/* Add new entries above this line. */
|
||||||
|
|
||||||
|
|
|
@ -910,6 +910,7 @@ void gfxPlatform::Init() {
|
||||||
gPlatform->InitAcceleration();
|
gPlatform->InitAcceleration();
|
||||||
gPlatform->InitWebRenderConfig();
|
gPlatform->InitWebRenderConfig();
|
||||||
|
|
||||||
|
gPlatform->InitHardwareVideoConfig();
|
||||||
gPlatform->InitWebGLConfig();
|
gPlatform->InitWebGLConfig();
|
||||||
gPlatform->InitWebGPUConfig();
|
gPlatform->InitWebGPUConfig();
|
||||||
gPlatform->InitWindowOcclusionConfig();
|
gPlatform->InitWindowOcclusionConfig();
|
||||||
|
@ -2707,6 +2708,35 @@ void gfxPlatform::InitWebRenderConfig() {
|
||||||
gfxUtils::RemoveShaderCacheFromDiskIfNecessary();
|
gfxUtils::RemoveShaderCacheFromDiskIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gfxPlatform::InitHardwareVideoConfig() {
|
||||||
|
if (!XRE_IsParentProcess()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCString message;
|
||||||
|
nsCString failureId;
|
||||||
|
|
||||||
|
FeatureState& featureVP8 = gfxConfig::GetFeature(Feature::VP8_HW_DECODE);
|
||||||
|
featureVP8.EnableByDefault();
|
||||||
|
|
||||||
|
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_VP8_HW_DECODE, &message,
|
||||||
|
failureId)) {
|
||||||
|
featureVP8.Disable(FeatureStatus::Blocklisted, message.get(), failureId);
|
||||||
|
}
|
||||||
|
|
||||||
|
gfxVars::SetUseVP8HwDecode(featureVP8.IsEnabled());
|
||||||
|
|
||||||
|
FeatureState& featureVP9 = gfxConfig::GetFeature(Feature::VP9_HW_DECODE);
|
||||||
|
featureVP9.EnableByDefault();
|
||||||
|
|
||||||
|
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_VP9_HW_DECODE, &message,
|
||||||
|
failureId)) {
|
||||||
|
featureVP9.Disable(FeatureStatus::Blocklisted, message.get(), failureId);
|
||||||
|
}
|
||||||
|
|
||||||
|
gfxVars::SetUseVP9HwDecode(featureVP9.IsEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
void gfxPlatform::InitWebGLConfig() {
|
void gfxPlatform::InitWebGLConfig() {
|
||||||
// Depends on InitWebRenderConfig() for UseWebRender().
|
// Depends on InitWebRenderConfig() for UseWebRender().
|
||||||
|
|
||||||
|
|
|
@ -805,6 +805,7 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
|
||||||
|
|
||||||
virtual void InitAcceleration();
|
virtual void InitAcceleration();
|
||||||
virtual void InitWebRenderConfig();
|
virtual void InitWebRenderConfig();
|
||||||
|
void InitHardwareVideoConfig();
|
||||||
virtual void InitWebGLConfig();
|
virtual void InitWebGLConfig();
|
||||||
virtual void InitWebGPUConfig();
|
virtual void InitWebGPUConfig();
|
||||||
virtual void InitWindowOcclusionConfig();
|
virtual void InitWindowOcclusionConfig();
|
||||||
|
|
|
@ -209,9 +209,10 @@ static const char* GetPrefNameForFeature(int32_t aFeature) {
|
||||||
name = BLOCKLIST_PREF_BRANCH "dx.p016";
|
name = BLOCKLIST_PREF_BRANCH "dx.p016";
|
||||||
break;
|
break;
|
||||||
case nsIGfxInfo::FEATURE_VP8_HW_DECODE:
|
case nsIGfxInfo::FEATURE_VP8_HW_DECODE:
|
||||||
|
name = BLOCKLIST_PREF_BRANCH "vp8.hw-decode";
|
||||||
|
break;
|
||||||
case nsIGfxInfo::FEATURE_VP9_HW_DECODE:
|
case nsIGfxInfo::FEATURE_VP9_HW_DECODE:
|
||||||
// We don't provide prefs for these features as these are
|
name = BLOCKLIST_PREF_BRANCH "vp9.hw-decode";
|
||||||
// not handling downloadable blocklist.
|
|
||||||
break;
|
break;
|
||||||
case nsIGfxInfo::FEATURE_GL_SWIZZLE:
|
case nsIGfxInfo::FEATURE_GL_SWIZZLE:
|
||||||
name = BLOCKLIST_PREF_BRANCH "gl.swizzle";
|
name = BLOCKLIST_PREF_BRANCH "gl.swizzle";
|
||||||
|
@ -472,8 +473,12 @@ static int32_t BlocklistFeatureToGfxFeature(const nsAString& aFeature) {
|
||||||
if (aFeature.EqualsLiteral("DX_NV12")) {
|
if (aFeature.EqualsLiteral("DX_NV12")) {
|
||||||
return nsIGfxInfo::FEATURE_DX_NV12;
|
return nsIGfxInfo::FEATURE_DX_NV12;
|
||||||
}
|
}
|
||||||
// We do not support FEATURE_VP8_HW_DECODE and FEATURE_VP9_HW_DECODE
|
if (aFeature.EqualsLiteral("VP8_HW_DECODE")) {
|
||||||
// in downloadable blocklist.
|
return nsIGfxInfo::FEATURE_VP8_HW_DECODE;
|
||||||
|
}
|
||||||
|
if (aFeature.EqualsLiteral("VP9_HW_DECODE")) {
|
||||||
|
return nsIGfxInfo::FEATURE_VP9_HW_DECODE;
|
||||||
|
}
|
||||||
if (aFeature.EqualsLiteral("GL_SWIZZLE")) {
|
if (aFeature.EqualsLiteral("GL_SWIZZLE")) {
|
||||||
return nsIGfxInfo::FEATURE_GL_SWIZZLE;
|
return nsIGfxInfo::FEATURE_GL_SWIZZLE;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче