diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 58c078c69aa7..bcdb8edd252b 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -2351,11 +2351,9 @@ void gfxPlatform::InitAcceleration() { // explicit. MOZ_ASSERT(NS_IsMainThread(), "can only initialize prefs on the main thread"); -#ifndef MOZ_WIDGET_GTK nsCOMPtr gfxInfo = components::GfxInfo::Service(); nsCString discardFailureId; int32_t status; -#endif if (XRE_IsParentProcess()) { gfxVars::SetBrowserTabsRemoteAutostart(BrowserTabsRemoteAutostart()); @@ -2380,30 +2378,28 @@ void gfxPlatform::InitAcceleration() { #endif } - if (StaticPrefs::media_hardware_video_decoding_enabled_AtStartup()) { -#ifdef MOZ_WIDGET_GTK - sLayersSupportsHardwareVideoDecoding = - gfxPlatformGtk::GetPlatform()->InitVAAPIConfig( - StaticPrefs:: - media_hardware_video_decoding_force_enabled_AtStartup() || - StaticPrefs::media_ffmpeg_vaapi_enabled()); -#else - if ( -# ifdef XP_WIN - Preferences::GetBool("media.wmf.dxva.enabled", true) && -# endif - NS_SUCCEEDED(gfxInfo->GetFeatureStatus( - nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, discardFailureId, - &status))) { - if (status == nsIGfxInfo::FEATURE_STATUS_OK || - StaticPrefs:: - media_hardware_video_decoding_force_enabled_AtStartup()) { - sLayersSupportsHardwareVideoDecoding = true; - } - } + if (Preferences::GetBool("media.hardware-video-decoding.enabled", false) && +#ifdef XP_WIN + Preferences::GetBool("media.wmf.dxva.enabled", true) && #endif + NS_SUCCEEDED( + gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, + discardFailureId, &status))) { + if (status == nsIGfxInfo::FEATURE_STATUS_OK || +#ifdef MOZ_WAYLAND + StaticPrefs::media_ffmpeg_vaapi_enabled() || +#endif + StaticPrefs::media_hardware_video_decoding_force_enabled_AtStartup()) { + sLayersSupportsHardwareVideoDecoding = true; + } } +#ifdef MOZ_WAYLAND + sLayersSupportsHardwareVideoDecoding = + gfxPlatformGtk::GetPlatform()->InitVAAPIConfig( + sLayersSupportsHardwareVideoDecoding); +#endif + sLayersAccelerationPrefsInitialized = true; if (XRE_IsParentProcess()) { diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index 37f8b5a0827a..24f456347d78 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -225,16 +225,12 @@ void gfxPlatformGtk::InitDmabufConfig() { #endif } -bool gfxPlatformGtk::InitVAAPIConfig(bool aForceEnabledByUser) { +bool gfxPlatformGtk::InitVAAPIConfig(bool aEnabledByPlatform) { FeatureState& feature = gfxConfig::GetFeature(Feature::HARDWARE_VIDEO_DECODING); #ifdef MOZ_WAYLAND feature.EnableByDefault(); - if (aForceEnabledByUser) { - feature.UserForceEnable("Force enabled by pref"); - } - nsCString failureId; int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; nsCOMPtr gfxInfo = components::GfxInfo::Service(); @@ -242,14 +238,16 @@ bool gfxPlatformGtk::InitVAAPIConfig(bool aForceEnabledByUser) { nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, failureId, &status))) { feature.Disable(FeatureStatus::BlockedNoGfxInfo, "gfxInfo is broken", "FEATURE_FAILURE_NO_GFX_INFO"_ns); - } else if (status == nsIGfxInfo::FEATURE_BLOCKED_PLATFORM_TEST) { - feature.ForceDisable(FeatureStatus::Unavailable, - "Force disabled by gfxInfo", failureId); } else if (status != nsIGfxInfo::FEATURE_STATUS_OK) { feature.Disable(FeatureStatus::Blocklisted, "Blocklisted by gfxInfo", failureId); } - + if (status != nsIGfxInfo::FEATURE_STATUS_OK && aEnabledByPlatform) { + feature.UserForceEnable("Force enabled by pref"); + } + if (!aEnabledByPlatform) { + feature.Disable(FeatureStatus::Blocked, "Blocked by platform", failureId); + } if (!gfxVars::UseEGL()) { feature.ForceDisable(FeatureStatus::Unavailable, "Requires EGL", "FEATURE_FAILURE_REQUIRES_EGL"_ns); diff --git a/gfx/thebes/gfxPlatformGtk.h b/gfx/thebes/gfxPlatformGtk.h index 5878f021f836..15647b325657 100644 --- a/gfx/thebes/gfxPlatformGtk.h +++ b/gfx/thebes/gfxPlatformGtk.h @@ -68,7 +68,7 @@ class gfxPlatformGtk final : public gfxPlatform { protected: void InitX11EGLConfig(); void InitDmabufConfig(); - bool InitVAAPIConfig(bool aForceEnabledByUser); + bool InitVAAPIConfig(bool aEnabledByPlatform); void InitPlatformGPUProcessPrefs() override; void InitWebRenderConfig() override; bool CheckVariationFontSupport() override; diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 18b05559617f..6088cac84b8b 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -9385,11 +9385,6 @@ value: false mirror: always -- name: media.hardware-video-decoding.enabled - type: bool - value: true - mirror: once - - name: media.hardware-video-decoding.force-enabled type: bool value: false diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 4d28837e0cf6..51f7002750ad 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -256,6 +256,8 @@ pref("media.volume_scale", "1.0"); // opened as top-level documents, as opposed to inside a media element. pref("media.play-stand-alone", true); +pref("media.hardware-video-decoding.enabled", true); + #ifdef MOZ_WMF pref("media.wmf.dxva.enabled", true); pref("media.wmf.play-stand-alone", true); diff --git a/widget/gtk/GfxInfo.cpp b/widget/gtk/GfxInfo.cpp index 888f77b66368..ae4ca5a5de03 100644 --- a/widget/gtk/GfxInfo.cpp +++ b/widget/gtk/GfxInfo.cpp @@ -1008,7 +1008,7 @@ nsresult GfxInfo::GetFeatureStatusImpl( if (aFeature == nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING && !mIsVAAPISupported) { - *aStatus = nsIGfxInfo::FEATURE_BLOCKED_PLATFORM_TEST; + *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_VIDEO_DECODING_TEST_FAILED"; return NS_OK; } diff --git a/widget/nsIGfxInfo.idl b/widget/nsIGfxInfo.idl index 1430cc40882c..010818725251 100644 --- a/widget/nsIGfxInfo.idl +++ b/widget/nsIGfxInfo.idl @@ -207,8 +207,6 @@ interface nsIGfxInfo : nsISupports const long FEATURE_ALLOW_ALWAYS = 9; /* This feature is safe to be on this device due to the allowlist, depending on qualified/experiment status. */ const long FEATURE_ALLOW_QUALIFIED = 10; - /* This feature failed in a startup test, e.g. due to a crashing driver. */ - const long FEATURE_BLOCKED_PLATFORM_TEST = 11; /** * Ask about a feature, and return the status of that feature.