forked from mirrors/gecko-dev
		
	Bug 1773282 [Linux] Remove nsIGfxInfo::FEATURE_VAAPI and use nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING r=alwu
nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING is used on all platforms so let's use it on Linux too and don't add new feature for Linux only. Differential Revision: https://phabricator.services.mozilla.com/D149765
This commit is contained in:
		
							parent
							
								
									447c0b7acc
								
							
						
					
					
						commit
						bea11a62d5
					
				
					 8 changed files with 37 additions and 42 deletions
				
			
		|  | @ -39,7 +39,7 @@ namespace gfx { | ||||||
|   _(X11_EGL, Feature, "X11 EGL")                                             \ |   _(X11_EGL, Feature, "X11 EGL")                                             \ | ||||||
|   _(DMABUF, Feature, "DMABUF")                                               \ |   _(DMABUF, Feature, "DMABUF")                                               \ | ||||||
|   _(WINDOW_OCCLUSION, Feature, "WINDOW_OCCLUSION")                           \ |   _(WINDOW_OCCLUSION, Feature, "WINDOW_OCCLUSION")                           \ | ||||||
|   _(VAAPI, Feature, "VA-API video decoding")                                 \ |   _(HARDWARE_VIDEO_DECODING, Feature, "Hardware video decoding")             \ | ||||||
|   _(VIDEO_OVERLAY, Feature, "video overlay")                                 \ |   _(VIDEO_OVERLAY, Feature, "video overlay")                                 \ | ||||||
|   _(HW_DECODED_VIDEO_ZERO_COPY, Feature, "Hardware decoded video zero copy") \ |   _(HW_DECODED_VIDEO_ZERO_COPY, Feature, "Hardware decoded video zero copy") \ | ||||||
|   _(VP8_HW_DECODE, Feature, "VP8 hardware decoding")                         \ |   _(VP8_HW_DECODE, Feature, "VP8 hardware decoding")                         \ | ||||||
|  |  | ||||||
|  | @ -84,7 +84,6 @@ class gfxVarReceiver; | ||||||
|   _(UseEGL, bool, false)                                           \ |   _(UseEGL, bool, false)                                           \ | ||||||
|   _(DrmRenderDevice, nsCString, nsCString())                       \ |   _(DrmRenderDevice, nsCString, nsCString())                       \ | ||||||
|   _(UseDMABuf, bool, false)                                        \ |   _(UseDMABuf, bool, false)                                        \ | ||||||
|   _(UseVAAPI, bool, false)                                         \ |  | ||||||
|   _(WebRenderRequiresHardwareDriver, bool, false)                  \ |   _(WebRenderRequiresHardwareDriver, bool, false)                  \ | ||||||
|   _(SupportsThreadsafeGL, bool, false)                             \ |   _(SupportsThreadsafeGL, bool, false)                             \ | ||||||
|   _(OffscreenCanvasDomainAllowlist, nsCString, nsCString())        \ |   _(OffscreenCanvasDomainAllowlist, nsCString, nsCString())        \ | ||||||
|  |  | ||||||
|  | @ -2379,11 +2379,20 @@ void gfxPlatform::InitAcceleration() { | ||||||
|           gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, |           gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, | ||||||
|                                     discardFailureId, &status))) { |                                     discardFailureId, &status))) { | ||||||
|     if (status == nsIGfxInfo::FEATURE_STATUS_OK || |     if (status == nsIGfxInfo::FEATURE_STATUS_OK || | ||||||
|  | #ifdef MOZ_WAYLAND | ||||||
|  |         StaticPrefs::media_ffmpeg_vaapi_enabled() || | ||||||
|  | #endif | ||||||
|         StaticPrefs::media_hardware_video_decoding_force_enabled_AtStartup()) { |         StaticPrefs::media_hardware_video_decoding_force_enabled_AtStartup()) { | ||||||
|       sLayersSupportsHardwareVideoDecoding = true; |       sLayersSupportsHardwareVideoDecoding = true; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | #ifdef MOZ_WAYLAND | ||||||
|  |   sLayersSupportsHardwareVideoDecoding = | ||||||
|  |       gfxPlatformGtk::GetPlatform()->InitVAAPIConfig( | ||||||
|  |           sLayersSupportsHardwareVideoDecoding); | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|   sLayersAccelerationPrefsInitialized = true; |   sLayersAccelerationPrefsInitialized = true; | ||||||
| 
 | 
 | ||||||
|   if (XRE_IsParentProcess()) { |   if (XRE_IsParentProcess()) { | ||||||
|  |  | ||||||
|  | @ -113,10 +113,6 @@ gfxPlatformGtk::gfxPlatformGtk() { | ||||||
|     if (gfxConfig::IsEnabled(Feature::DMABUF)) { |     if (gfxConfig::IsEnabled(Feature::DMABUF)) { | ||||||
|       gfxVars::SetUseDMABuf(true); |       gfxVars::SetUseDMABuf(true); | ||||||
|     } |     } | ||||||
|     InitVAAPIConfig(); |  | ||||||
|     if (gfxConfig::IsEnabled(Feature::VAAPI)) { |  | ||||||
|       gfxVars::SetUseVAAPI(true); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   InitBackendPrefs(GetBackendPrefs()); |   InitBackendPrefs(GetBackendPrefs()); | ||||||
|  | @ -229,32 +225,29 @@ void gfxPlatformGtk::InitDmabufConfig() { | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void gfxPlatformGtk::InitVAAPIConfig() { | bool gfxPlatformGtk::InitVAAPIConfig(bool aEnabledByPlatform) { | ||||||
|   FeatureState& feature = gfxConfig::GetFeature(Feature::VAAPI); |   FeatureState& feature = | ||||||
|  |       gfxConfig::GetFeature(Feature::HARDWARE_VIDEO_DECODING); | ||||||
| #ifdef MOZ_WAYLAND | #ifdef MOZ_WAYLAND | ||||||
| #  ifdef NIGHTLY_BUILD |  | ||||||
|   feature.EnableByDefault(); |   feature.EnableByDefault(); | ||||||
| #  else | 
 | ||||||
|   feature.DisableByDefault(FeatureStatus::Disabled, |  | ||||||
|                            "VAAPI is disabled by default", |  | ||||||
|                            "FEATURE_VAAPI_DISABLED"_ns); |  | ||||||
| #  endif |  | ||||||
|   nsCString failureId; |   nsCString failureId; | ||||||
|   int32_t status; |   int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; | ||||||
|   nsCOMPtr<nsIGfxInfo> gfxInfo = components::GfxInfo::Service(); |   nsCOMPtr<nsIGfxInfo> gfxInfo = components::GfxInfo::Service(); | ||||||
|   if (NS_FAILED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_VAAPI, failureId, |   if (NS_FAILED(gfxInfo->GetFeatureStatus( | ||||||
|                                           &status))) { |           nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, failureId, &status))) { | ||||||
|     feature.Disable(FeatureStatus::BlockedNoGfxInfo, "gfxInfo is broken", |     feature.Disable(FeatureStatus::BlockedNoGfxInfo, "gfxInfo is broken", | ||||||
|                     "FEATURE_FAILURE_NO_GFX_INFO"_ns); |                     "FEATURE_FAILURE_NO_GFX_INFO"_ns); | ||||||
|   } else if (status != nsIGfxInfo::FEATURE_STATUS_OK) { |   } else if (status != nsIGfxInfo::FEATURE_STATUS_OK) { | ||||||
|     feature.Disable(FeatureStatus::Blocklisted, "Blocklisted by gfxInfo", |     feature.Disable(FeatureStatus::Blocklisted, "Blocklisted by gfxInfo", | ||||||
|                     failureId); |                     failureId); | ||||||
|   } |   } | ||||||
| 
 |   if (status != nsIGfxInfo::FEATURE_STATUS_OK && aEnabledByPlatform) { | ||||||
|   if (StaticPrefs::media_ffmpeg_vaapi_enabled()) { |  | ||||||
|     feature.UserForceEnable("Force enabled by pref"); |     feature.UserForceEnable("Force enabled by pref"); | ||||||
|   } |   } | ||||||
| 
 |   if (!aEnabledByPlatform) { | ||||||
|  |     feature.Disable(FeatureStatus::Blocked, "Blocked by platform", failureId); | ||||||
|  |   } | ||||||
|   if (!gfxVars::UseEGL()) { |   if (!gfxVars::UseEGL()) { | ||||||
|     feature.ForceDisable(FeatureStatus::Unavailable, "Requires EGL", |     feature.ForceDisable(FeatureStatus::Unavailable, "Requires EGL", | ||||||
|                          "FEATURE_FAILURE_REQUIRES_EGL"_ns); |                          "FEATURE_FAILURE_REQUIRES_EGL"_ns); | ||||||
|  | @ -264,6 +257,7 @@ void gfxPlatformGtk::InitVAAPIConfig() { | ||||||
|                            "Wayland support missing", |                            "Wayland support missing", | ||||||
|                            "FEATURE_FAILURE_NO_WAYLAND"_ns); |                            "FEATURE_FAILURE_NO_WAYLAND"_ns); | ||||||
| #endif | #endif | ||||||
|  |   return feature.IsEnabled(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void gfxPlatformGtk::InitWebRenderConfig() { | void gfxPlatformGtk::InitWebRenderConfig() { | ||||||
|  |  | ||||||
|  | @ -17,6 +17,8 @@ typedef struct _XDisplay Display; | ||||||
| #endif  // MOZ_X11
 | #endif  // MOZ_X11
 | ||||||
| 
 | 
 | ||||||
| class gfxPlatformGtk final : public gfxPlatform { | class gfxPlatformGtk final : public gfxPlatform { | ||||||
|  |   friend class gfxPlatform; | ||||||
|  | 
 | ||||||
|  public: |  public: | ||||||
|   gfxPlatformGtk(); |   gfxPlatformGtk(); | ||||||
|   virtual ~gfxPlatformGtk(); |   virtual ~gfxPlatformGtk(); | ||||||
|  | @ -66,7 +68,7 @@ class gfxPlatformGtk final : public gfxPlatform { | ||||||
|  protected: |  protected: | ||||||
|   void InitX11EGLConfig(); |   void InitX11EGLConfig(); | ||||||
|   void InitDmabufConfig(); |   void InitDmabufConfig(); | ||||||
|   void InitVAAPIConfig(); |   bool InitVAAPIConfig(bool aEnabledByPlatform); | ||||||
|   void InitPlatformGPUProcessPrefs() override; |   void InitPlatformGPUProcessPrefs() override; | ||||||
|   void InitWebRenderConfig() override; |   void InitWebRenderConfig() override; | ||||||
|   bool CheckVariationFontSupport() override; |   bool CheckVariationFontSupport() override; | ||||||
|  |  | ||||||
|  | @ -236,9 +236,6 @@ static const char* GetPrefNameForFeature(int32_t aFeature) { | ||||||
|     case nsIGfxInfo::FEATURE_DMABUF: |     case nsIGfxInfo::FEATURE_DMABUF: | ||||||
|       name = BLOCKLIST_PREF_BRANCH "dmabuf"; |       name = BLOCKLIST_PREF_BRANCH "dmabuf"; | ||||||
|       break; |       break; | ||||||
|     case nsIGfxInfo::FEATURE_VAAPI: |  | ||||||
|       name = BLOCKLIST_PREF_BRANCH "vaapi"; |  | ||||||
|       break; |  | ||||||
|     case nsIGfxInfo::FEATURE_WEBGPU: |     case nsIGfxInfo::FEATURE_WEBGPU: | ||||||
|       name = BLOCKLIST_PREF_BRANCH "webgpu"; |       name = BLOCKLIST_PREF_BRANCH "webgpu"; | ||||||
|       break; |       break; | ||||||
|  | @ -510,9 +507,6 @@ static int32_t BlocklistFeatureToGfxFeature(const nsAString& aFeature) { | ||||||
|   if (aFeature.EqualsLiteral("DMABUF")) { |   if (aFeature.EqualsLiteral("DMABUF")) { | ||||||
|     return nsIGfxInfo::FEATURE_DMABUF; |     return nsIGfxInfo::FEATURE_DMABUF; | ||||||
|   } |   } | ||||||
|   if (aFeature.EqualsLiteral("VAAPI")) { |  | ||||||
|     return nsIGfxInfo::FEATURE_VAAPI; |  | ||||||
|   } |  | ||||||
|   if (aFeature.EqualsLiteral("WEBGPU")) { |   if (aFeature.EqualsLiteral("WEBGPU")) { | ||||||
|     return nsIGfxInfo::FEATURE_WEBGPU; |     return nsIGfxInfo::FEATURE_WEBGPU; | ||||||
|   } |   } | ||||||
|  | @ -1405,7 +1399,6 @@ void GfxInfoBase::EvaluateDownloadedBlocklist( | ||||||
|                         nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS, |                         nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS, | ||||||
|                         nsIGfxInfo::FEATURE_X11_EGL, |                         nsIGfxInfo::FEATURE_X11_EGL, | ||||||
|                         nsIGfxInfo::FEATURE_DMABUF, |                         nsIGfxInfo::FEATURE_DMABUF, | ||||||
|                         nsIGfxInfo::FEATURE_VAAPI, |  | ||||||
|                         nsIGfxInfo::FEATURE_WEBGPU, |                         nsIGfxInfo::FEATURE_WEBGPU, | ||||||
|                         nsIGfxInfo::FEATURE_VIDEO_OVERLAY, |                         nsIGfxInfo::FEATURE_VIDEO_OVERLAY, | ||||||
|                         nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY, |                         nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY, | ||||||
|  |  | ||||||
|  | @ -843,29 +843,29 @@ const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() { | ||||||
|         V(0, 0, 0, 0), "FEATURE_FAILURE_BROKEN_DRIVER", ""); |         V(0, 0, 0, 0), "FEATURE_FAILURE_BROKEN_DRIVER", ""); | ||||||
| 
 | 
 | ||||||
|     ////////////////////////////////////
 |     ////////////////////////////////////
 | ||||||
|     // FEATURE_VAAPI
 |     // FEATURE_HARDWARE_VIDEO_DECODING
 | ||||||
|     APPEND_TO_DRIVER_BLOCKLIST_EXT( |     APPEND_TO_DRIVER_BLOCKLIST_EXT( | ||||||
|         OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All, |         OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All, | ||||||
|         DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll, |         DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll, | ||||||
|         DeviceFamily::All, nsIGfxInfo::FEATURE_VAAPI, |         DeviceFamily::All, nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, | ||||||
|         nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN, |         nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN, | ||||||
|         V(21, 0, 0, 0), "FEATURE_ROLLOUT_VAAPI_MESA", "Mesa 21.0.0.0"); |         V(21, 0, 0, 0), "FEATURE_HARDWARE_VIDEO_DECODING_MESA", "Mesa 21.0.0.0"); | ||||||
| 
 | 
 | ||||||
|     // Disable on all NVIDIA hardware
 |     // Disable on all NVIDIA hardware
 | ||||||
|     APPEND_TO_DRIVER_BLOCKLIST_EXT( |     APPEND_TO_DRIVER_BLOCKLIST_EXT( | ||||||
|         OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All, |         OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All, | ||||||
|         DesktopEnvironment::All, WindowProtocol::All, DriverVendor::All, |         DesktopEnvironment::All, WindowProtocol::All, DriverVendor::All, | ||||||
|         DeviceFamily::NvidiaAll, nsIGfxInfo::FEATURE_VAAPI, |         DeviceFamily::NvidiaAll, nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, | ||||||
|         nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED, |         nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED, | ||||||
|         V(0, 0, 0, 0), "FEATURE_FAILURE_VAAPI_NO_LINUX_NVIDIA", ""); |         V(0, 0, 0, 0), "FEATURE_HARDWARE_VIDEO_DECODING_NO_LINUX_NVIDIA", ""); | ||||||
| 
 | 
 | ||||||
|     // Disable on all AMD devices not using Mesa.
 |     // Disable on all AMD devices not using Mesa.
 | ||||||
|     APPEND_TO_DRIVER_BLOCKLIST_EXT( |     APPEND_TO_DRIVER_BLOCKLIST_EXT( | ||||||
|         OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All, |         OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All, | ||||||
|         DesktopEnvironment::All, WindowProtocol::All, DriverVendor::NonMesaAll, |         DesktopEnvironment::All, WindowProtocol::All, DriverVendor::NonMesaAll, | ||||||
|         DeviceFamily::AtiAll, nsIGfxInfo::FEATURE_VAAPI, |         DeviceFamily::AtiAll, nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, | ||||||
|         nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED, |         nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED, | ||||||
|         V(0, 0, 0, 0), "FEATURE_FAILURE_VAAPI_NO_LINUX_AMD", ""); |         V(0, 0, 0, 0), "FEATURE_HARDWARE_VIDEO_DECODING_NO_LINUX_AMD", ""); | ||||||
| 
 | 
 | ||||||
|     ////////////////////////////////////
 |     ////////////////////////////////////
 | ||||||
|     // FEATURE_WEBRENDER_PARTIAL_PRESENT
 |     // FEATURE_WEBRENDER_PARTIAL_PRESENT
 | ||||||
|  |  | ||||||
|  | @ -168,18 +168,16 @@ interface nsIGfxInfo : nsISupports | ||||||
|   const long FEATURE_WEBRENDER_SHADER_CACHE = 35; |   const long FEATURE_WEBRENDER_SHADER_CACHE = 35; | ||||||
|   /* Whether partial present is allowed with WebRender, starting in 98. */ |   /* Whether partial present is allowed with WebRender, starting in 98. */ | ||||||
|   const long FEATURE_WEBRENDER_PARTIAL_PRESENT = 36; |   const long FEATURE_WEBRENDER_PARTIAL_PRESENT = 36; | ||||||
|   /* Whether VA-API is supported, starting in 96. */ |  | ||||||
|   const long FEATURE_VAAPI = 37; |  | ||||||
|   /* Whether WebGPU is supported, starting in 100. */ |   /* Whether WebGPU is supported, starting in 100. */ | ||||||
|   const long FEATURE_WEBGPU = 38; |   const long FEATURE_WEBGPU = 37; | ||||||
|   /* Whether video overlay is supported, starting in 100. */ |   /* Whether video overlay is supported, starting in 100. */ | ||||||
|   const long FEATURE_VIDEO_OVERLAY = 39; |   const long FEATURE_VIDEO_OVERLAY = 38; | ||||||
|   /* Whether hardware decoded video zero copy is supported, starting in 101. */ |   /* Whether hardware decoded video zero copy is supported, starting in 101. */ | ||||||
|   const long FEATURE_HW_DECODED_VIDEO_ZERO_COPY = 40; |   const long FEATURE_HW_DECODED_VIDEO_ZERO_COPY = 39; | ||||||
|   /* Whether DMABUF export is supported, starting in 103. */ |   /* Whether DMABUF export is supported, starting in 103. */ | ||||||
|   const long FEATURE_DMABUF_SURFACE_EXPORT = 41; |   const long FEATURE_DMABUF_SURFACE_EXPORT = 40; | ||||||
|   /* Whether reuse decoder device is supported, starting in 104. */ |   /* Whether reuse decoder device is supported, starting in 104. */ | ||||||
|   const long FEATURE_REUSE_DECODER_DEVICE = 42; |   const long FEATURE_REUSE_DECODER_DEVICE = 41; | ||||||
|   /* the maximum feature value. */ |   /* the maximum feature value. */ | ||||||
|   const long FEATURE_MAX_VALUE = FEATURE_REUSE_DECODER_DEVICE; |   const long FEATURE_MAX_VALUE = FEATURE_REUSE_DECODER_DEVICE; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 stransky
						stransky