forked from mirrors/gecko-dev
Bug 1831038 Add FEATURE_H264_HW_DECODE / FEATURE_AV1_HW_DECODE to track HW decode state on Linux r=alwu
- Add H264_HW_DECODE / AV1_HW_DECODE features to track H264/AV1 decoding state on Linux. - Add UseH264HwDecode / UseAV1HwDecode gfx variables to route decode state to RDD process. - Init H264_HW_DECODE / AV1_HW_DECODE features on Linux only and skip all HW decoding features init if VA-API is not supported. Differential Revision: https://phabricator.services.mozilla.com/D177021
This commit is contained in:
parent
924c311c4b
commit
c1968f2af4
5 changed files with 41 additions and 6 deletions
|
|
@ -48,8 +48,10 @@ namespace gfx {
|
||||||
_(REUSE_DECODER_DEVICE, Feature, "Reuse decoder device") \
|
_(REUSE_DECODER_DEVICE, Feature, "Reuse decoder device") \
|
||||||
_(BACKDROP_FILTER, Feature, "Backdrop filter") \
|
_(BACKDROP_FILTER, Feature, "Backdrop filter") \
|
||||||
_(CANVAS_RENDERER_THREAD, Feature, "canvas renderer thread") \
|
_(CANVAS_RENDERER_THREAD, Feature, "canvas renderer thread") \
|
||||||
_(ACCELERATED_CANVAS2D, Feature, "Accelerated Canvas2D")
|
_(ACCELERATED_CANVAS2D, Feature, "Accelerated Canvas2D") \
|
||||||
/* Add new entries above this comment */
|
_(H264_HW_DECODE, Feature, "H.264 hardware decoding") \
|
||||||
|
_(AV1_HW_DECODE, Feature, "AV1 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,6 +88,8 @@ class gfxVarReceiver;
|
||||||
_(AllowWebGPU, bool, false) \
|
_(AllowWebGPU, bool, false) \
|
||||||
_(UseVP8HwDecode, bool, false) \
|
_(UseVP8HwDecode, bool, false) \
|
||||||
_(UseVP9HwDecode, bool, false) \
|
_(UseVP9HwDecode, bool, false) \
|
||||||
|
_(UseAV1HwDecode, bool, false) \
|
||||||
|
_(UseH264HwDecode, bool, false) \
|
||||||
_(HwDecodedVideoZeroCopy, bool, false) \
|
_(HwDecodedVideoZeroCopy, bool, false) \
|
||||||
_(UseDMABufSurfaceExport, bool, true) \
|
_(UseDMABufSurfaceExport, bool, true) \
|
||||||
_(ReuseDecoderDevice, bool, false) \
|
_(ReuseDecoderDevice, bool, false) \
|
||||||
|
|
|
||||||
|
|
@ -2856,10 +2856,12 @@ void gfxPlatform::InitHardwareVideoConfig() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't use selective VP8/9 decode control on Linux.
|
#ifdef MOZ_WIDGET_GTK
|
||||||
if (kIsWayland || kIsX11) {
|
// We don't want to expose codec info if whole HW decoding is disabled.
|
||||||
|
if (!sLayersSupportsHardwareVideoDecoding) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
nsCString message;
|
nsCString message;
|
||||||
nsCString failureId;
|
nsCString failureId;
|
||||||
|
|
@ -2871,7 +2873,6 @@ void gfxPlatform::InitHardwareVideoConfig() {
|
||||||
failureId)) {
|
failureId)) {
|
||||||
featureVP8.Disable(FeatureStatus::Blocklisted, message.get(), failureId);
|
featureVP8.Disable(FeatureStatus::Blocklisted, message.get(), failureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxVars::SetUseVP8HwDecode(featureVP8.IsEnabled());
|
gfxVars::SetUseVP8HwDecode(featureVP8.IsEnabled());
|
||||||
|
|
||||||
FeatureState& featureVP9 = gfxConfig::GetFeature(Feature::VP9_HW_DECODE);
|
FeatureState& featureVP9 = gfxConfig::GetFeature(Feature::VP9_HW_DECODE);
|
||||||
|
|
@ -2881,8 +2882,28 @@ void gfxPlatform::InitHardwareVideoConfig() {
|
||||||
failureId)) {
|
failureId)) {
|
||||||
featureVP9.Disable(FeatureStatus::Blocklisted, message.get(), failureId);
|
featureVP9.Disable(FeatureStatus::Blocklisted, message.get(), failureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxVars::SetUseVP9HwDecode(featureVP9.IsEnabled());
|
gfxVars::SetUseVP9HwDecode(featureVP9.IsEnabled());
|
||||||
|
|
||||||
|
// H264_HW_DECODE/AV1_HW_DECODE is used on Linux only right now.
|
||||||
|
#ifdef MOZ_WIDGET_GTK
|
||||||
|
FeatureState& featureH264 = gfxConfig::GetFeature(Feature::H264_HW_DECODE);
|
||||||
|
featureH264.EnableByDefault();
|
||||||
|
|
||||||
|
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_H264_HW_DECODE, &message,
|
||||||
|
failureId)) {
|
||||||
|
featureH264.Disable(FeatureStatus::Blocklisted, message.get(), failureId);
|
||||||
|
}
|
||||||
|
gfxVars::SetUseH264HwDecode(featureH264.IsEnabled());
|
||||||
|
|
||||||
|
FeatureState& featureAV1 = gfxConfig::GetFeature(Feature::AV1_HW_DECODE);
|
||||||
|
featureAV1.EnableByDefault();
|
||||||
|
|
||||||
|
if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_AV1_HW_DECODE, &message,
|
||||||
|
failureId)) {
|
||||||
|
featureAV1.Disable(FeatureStatus::Blocklisted, message.get(), failureId);
|
||||||
|
}
|
||||||
|
gfxVars::SetUseAV1HwDecode(featureAV1.IsEnabled());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfxPlatform::InitWebGLConfig() {
|
void gfxPlatform::InitWebGLConfig() {
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,12 @@ static const char* GetPrefNameForFeature(int32_t aFeature) {
|
||||||
case nsIGfxInfo::FEATURE_ACCELERATED_CANVAS2D:
|
case nsIGfxInfo::FEATURE_ACCELERATED_CANVAS2D:
|
||||||
name = BLOCKLIST_PREF_BRANCH "accelerated-canvas2d";
|
name = BLOCKLIST_PREF_BRANCH "accelerated-canvas2d";
|
||||||
break;
|
break;
|
||||||
|
case nsIGfxInfo::FEATURE_H264_HW_DECODE:
|
||||||
|
name = BLOCKLIST_PREF_BRANCH "h264.hw-decode";
|
||||||
|
break;
|
||||||
|
case nsIGfxInfo::FEATURE_AV1_HW_DECODE:
|
||||||
|
name = BLOCKLIST_PREF_BRANCH "av1.hw-decode";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!");
|
MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,10 @@ interface nsIGfxInfo : nsISupports
|
||||||
const long FEATURE_BACKDROP_FILTER = 42;
|
const long FEATURE_BACKDROP_FILTER = 42;
|
||||||
/* Whether to use Accelerated Canvas2D, starting in 110. */
|
/* Whether to use Accelerated Canvas2D, starting in 110. */
|
||||||
const long FEATURE_ACCELERATED_CANVAS2D = 43;
|
const long FEATURE_ACCELERATED_CANVAS2D = 43;
|
||||||
|
/* Whether hardware H264 decoding is supported, starting in 114; not for downloadable blocking. */
|
||||||
|
const long FEATURE_H264_HW_DECODE = 44;
|
||||||
|
/* Whether hardware AV1 decoding is supported, starting in 114; not for downloadable blocking. */
|
||||||
|
const long FEATURE_AV1_HW_DECODE = 45;
|
||||||
/* the maximum feature value. */
|
/* the maximum feature value. */
|
||||||
const long FEATURE_MAX_VALUE = FEATURE_ACCELERATED_CANVAS2D;
|
const long FEATURE_MAX_VALUE = FEATURE_ACCELERATED_CANVAS2D;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue