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:
stransky 2022-06-28 12:10:37 +00:00
parent 8d5788c45c
commit a961fafee3
8 changed files with 36 additions and 41 deletions

View File

@ -39,7 +39,7 @@ namespace gfx {
_(X11_EGL, Feature, "X11 EGL") \
_(DMABUF, Feature, "DMABUF") \
_(WINDOW_OCCLUSION, Feature, "WINDOW_OCCLUSION") \
_(VAAPI, Feature, "VA-API video decoding") \
_(HARDWARE_VIDEO_DECODING, Feature, "Hardware video decoding") \
_(VIDEO_OVERLAY, Feature, "video overlay") \
_(HW_DECODED_VIDEO_ZERO_COPY, Feature, "Hardware decoded video zero copy") \
_(VP8_HW_DECODE, Feature, "VP8 hardware decoding") \

View File

@ -84,7 +84,6 @@ class gfxVarReceiver;
_(UseEGL, bool, false) \
_(DrmRenderDevice, nsCString, nsCString()) \
_(UseDMABuf, bool, false) \
_(UseVAAPI, bool, false) \
_(WebRenderRequiresHardwareDriver, bool, false) \
_(SupportsThreadsafeGL, bool, false) \
_(OffscreenCanvasDomainAllowlist, nsCString, nsCString()) \

View File

@ -2376,11 +2376,20 @@ void gfxPlatform::InitAcceleration() {
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()) {

View File

@ -113,10 +113,6 @@ gfxPlatformGtk::gfxPlatformGtk() {
if (gfxConfig::IsEnabled(Feature::DMABUF)) {
gfxVars::SetUseDMABuf(true);
}
InitVAAPIConfig();
if (gfxConfig::IsEnabled(Feature::VAAPI)) {
gfxVars::SetUseVAAPI(true);
}
}
InitBackendPrefs(GetBackendPrefs());
@ -229,32 +225,29 @@ void gfxPlatformGtk::InitDmabufConfig() {
#endif
}
void gfxPlatformGtk::InitVAAPIConfig() {
FeatureState& feature = gfxConfig::GetFeature(Feature::VAAPI);
bool gfxPlatformGtk::InitVAAPIConfig(bool aEnabledByPlatform) {
FeatureState& feature =
gfxConfig::GetFeature(Feature::HARDWARE_VIDEO_DECODING);
#ifdef MOZ_WAYLAND
# ifdef NIGHTLY_BUILD
feature.EnableByDefault();
# else
feature.DisableByDefault(FeatureStatus::Disabled,
"VAAPI is disabled by default",
"FEATURE_VAAPI_DISABLED"_ns);
# endif
nsCString failureId;
int32_t status;
int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
nsCOMPtr<nsIGfxInfo> gfxInfo = components::GfxInfo::Service();
if (NS_FAILED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_VAAPI, failureId,
&status))) {
if (NS_FAILED(gfxInfo->GetFeatureStatus(
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_STATUS_OK) {
feature.Disable(FeatureStatus::Blocklisted, "Blocklisted by gfxInfo",
failureId);
}
if (StaticPrefs::media_ffmpeg_vaapi_enabled()) {
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);
@ -264,6 +257,7 @@ void gfxPlatformGtk::InitVAAPIConfig() {
"Wayland support missing",
"FEATURE_FAILURE_NO_WAYLAND"_ns);
#endif
return feature.IsEnabled();
}
void gfxPlatformGtk::InitWebRenderConfig() {

View File

@ -17,6 +17,8 @@ typedef struct _XDisplay Display;
#endif // MOZ_X11
class gfxPlatformGtk final : public gfxPlatform {
friend class gfxPlatform;
public:
gfxPlatformGtk();
virtual ~gfxPlatformGtk();
@ -66,7 +68,7 @@ class gfxPlatformGtk final : public gfxPlatform {
protected:
void InitX11EGLConfig();
void InitDmabufConfig();
void InitVAAPIConfig();
bool InitVAAPIConfig(bool aEnabledByPlatform);
void InitPlatformGPUProcessPrefs() override;
void InitWebRenderConfig() override;
bool CheckVariationFontSupport() override;

View File

@ -236,9 +236,6 @@ static const char* GetPrefNameForFeature(int32_t aFeature) {
case nsIGfxInfo::FEATURE_DMABUF:
name = BLOCKLIST_PREF_BRANCH "dmabuf";
break;
case nsIGfxInfo::FEATURE_VAAPI:
name = BLOCKLIST_PREF_BRANCH "vaapi";
break;
case nsIGfxInfo::FEATURE_WEBGPU:
name = BLOCKLIST_PREF_BRANCH "webgpu";
break;
@ -507,9 +504,6 @@ static int32_t BlocklistFeatureToGfxFeature(const nsAString& aFeature) {
if (aFeature.EqualsLiteral("DMABUF")) {
return nsIGfxInfo::FEATURE_DMABUF;
}
if (aFeature.EqualsLiteral("VAAPI")) {
return nsIGfxInfo::FEATURE_VAAPI;
}
if (aFeature.EqualsLiteral("WEBGPU")) {
return nsIGfxInfo::FEATURE_WEBGPU;
}
@ -1398,7 +1392,6 @@ void GfxInfoBase::EvaluateDownloadedBlocklist(
nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS,
nsIGfxInfo::FEATURE_X11_EGL,
nsIGfxInfo::FEATURE_DMABUF,
nsIGfxInfo::FEATURE_VAAPI,
nsIGfxInfo::FEATURE_WEBGPU,
nsIGfxInfo::FEATURE_VIDEO_OVERLAY,
nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,

View File

@ -843,29 +843,29 @@ const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
V(0, 0, 0, 0), "FEATURE_FAILURE_BROKEN_DRIVER", "");
////////////////////////////////////
// FEATURE_VAAPI
// FEATURE_HARDWARE_VIDEO_DECODING
APPEND_TO_DRIVER_BLOCKLIST_EXT(
OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
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,
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
APPEND_TO_DRIVER_BLOCKLIST_EXT(
OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::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,
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.
APPEND_TO_DRIVER_BLOCKLIST_EXT(
OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
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,
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

View File

@ -168,16 +168,14 @@ interface nsIGfxInfo : nsISupports
const long FEATURE_WEBRENDER_SHADER_CACHE = 35;
/* Whether partial present is allowed with WebRender, starting in 98. */
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. */
const long FEATURE_WEBGPU = 38;
const long FEATURE_WEBGPU = 37;
/* 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. */
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. */
const long FEATURE_DMABUF_SURFACE_EXPORT = 41;
const long FEATURE_DMABUF_SURFACE_EXPORT = 40;
/* the maximum feature value. */
const long FEATURE_MAX_VALUE = FEATURE_HW_DECODED_VIDEO_ZERO_COPY;