commit 87fca7f1759e800bd72b5ab6511eea17d6400a76 Author: Pilar Molina Lopez Date: Tue Oct 24 19:57:55 2023 +0000 video: hide UseChromeOSDirectVideoDecoder flag on VA-API devices We are seeing crashes causes by this CHECK statement: https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/gpu_utils.cc;l=151;drc=0e777ba9b6c34611705d5b145c92bcd09539011c It's triggered when the user manually disables the UseChromeOSDirectVideoDecoder flag on VA-API devices (Intel and AMD). This flag is supported only on non-Intel and non-AMD devices. This CL adds this information to the flag description and hides the flag in case VA-API is used. Bug: 1469285 Test: manual test on volteer Change-Id: I153b9ccb3815498c91ce5eee966834060749e247 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4960919 Reviewed-by: Dale Curtis Reviewed-by: Andres Calderon Jaramillo Reviewed-by: Avi Drissman Commit-Queue: Pilar Molina Lopez Cr-Commit-Position: refs/heads/main@{#1214411} diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index ee9fb206cde36..0fe18013ab044 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -418,6 +418,7 @@ include_rules = [ "+media/base", # For media switches "+media/capabilities", # For InMemoryVideoDecodeStatsDB "+media/cdm", + "+media/gpu/buildflags.h", "+media/remoting/device_capability_checker.h", "+media/capture", "+media/midi", # For midi switches diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 84709afaa34d0..777bebeb33d9e 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -7578,11 +7578,13 @@ const FeatureEntry kFeatureEntries[] = { #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) +#if !BUILDFLAG(USE_VAAPI) {"chromeos-direct-video-decoder", flag_descriptions::kChromeOSDirectVideoDecoderName, flag_descriptions::kChromeOSDirectVideoDecoderDescription, kOsCrOS | kOsLacros, FEATURE_VALUE_TYPE(media::kUseChromeOSDirectVideoDecoder)}, +#endif // !BUILDFLAG(USE_VAAPI) {"enable-vbr-encode-acceleration", flag_descriptions::kChromeOSHWVBREncodingName, diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 318a8be9ab1a6..d2497d0c403f3 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc @@ -7,6 +7,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "components/supervised_user/core/common/buildflags.h" +#include "media/gpu/buildflags.h" #include "pdf/buildflags.h" // Keep in identical order as the header file, see the comment at the top @@ -7338,6 +7339,7 @@ const char kQuickOfficeForceFileDownloadDescription[] = #endif // BUILDFLAG(IS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) +#if !BUILDFLAG(USE_VAAPI) const char kChromeOSDirectVideoDecoderName[] = "ChromeOS Direct Video Decoder"; const char kChromeOSDirectVideoDecoderDescription[] = "Enables the hardware-accelerated ChromeOS direct media::VideoDecoder " @@ -7345,7 +7347,8 @@ const char kChromeOSDirectVideoDecoderDescription[] = "--platform-disallows-chromeos-direct-video-decoder command line switch " "which is added for platforms where said direct VideoDecoder does not work " "or is not well tested (see the disable_cros_video_decoder USE flag in " - "ChromeOS)"; + "ChromeOS). This flag is supported only on non-Intel and non-AMD devices."; +#endif // !BUILDFLAG(USE_VAAPI) const char kChromeOSHWVBREncodingName[] = "ChromeOS Hardware Variable Bitrate Encoding"; const char kChromeOSHWVBREncodingDescription[] = diff --git a/content/public/browser/gpu_utils.cc b/content/public/browser/gpu_utils.cc index dceeca9659a85..3d091359777cc 100644 --- a/content/public/browser/gpu_utils.cc +++ b/content/public/browser/gpu_utils.cc @@ -133,20 +133,26 @@ const gpu::GpuPreferences GetGpuPreferencesFromCommandLine() { #if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) // The direct VideoDecoder is disallowed on some particular SoC/platforms. const bool should_use_direct_video_decoder = +#if BUILDFLAG(USE_VAAPI) + true; +#else !command_line->HasSwitch( switches::kPlatformDisallowsChromeOSDirectVideoDecoder) && base::FeatureList::IsEnabled(media::kUseChromeOSDirectVideoDecoder); +#endif // BUILDFLAG(USE_VAAPI) + + gpu_preferences.enable_chromeos_direct_video_decoder = +#if BUILDFLAG(USE_VAAPI) + should_use_direct_video_decoder; +#else + // For testing purposes, the following flag allows using the "other" video + // decoder implementation. + base::FeatureList::IsEnabled( + media::kUseAlternateVideoDecoderImplementation) + ? !should_use_direct_video_decoder + : should_use_direct_video_decoder; +#endif // BUILDFLAG(USE_VAAPI) - // For testing purposes, the following flag allows using the "other" video - // decoder implementation. - if (base::FeatureList::IsEnabled( - media::kUseAlternateVideoDecoderImplementation)) { - gpu_preferences.enable_chromeos_direct_video_decoder = - !should_use_direct_video_decoder; - } else { - gpu_preferences.enable_chromeos_direct_video_decoder = - should_use_direct_video_decoder; - } #if BUILDFLAG(USE_VAAPI) CHECK(gpu_preferences.enable_chromeos_direct_video_decoder); #endif // BUILDFLAG(USE_VAAPI) diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index 1af4de46e2a02..3086b1bec2134 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc @@ -1192,6 +1192,7 @@ BASE_FEATURE(kChromeOSHWVBREncoding, "ChromeOSHWVBREncoding", base::FEATURE_DISABLED_BY_DEFAULT); +#if !BUILDFLAG(USE_VAAPI) // Enable the hardware-accelerated direct video decoder instead of the one // needing the VdaVideoDecoder adapter. This flag is used mainly as a // chrome:flag for developers debugging issues as well as to be able to @@ -1200,6 +1201,7 @@ BASE_FEATURE(kChromeOSHWVBREncoding, BASE_FEATURE(kUseChromeOSDirectVideoDecoder, "UseChromeOSDirectVideoDecoder", base::FEATURE_ENABLED_BY_DEFAULT); +#endif // !BUILDFLAG(USE_VAAPI) // Limit the number of concurrent hardware decoder instances on ChromeOS. BASE_FEATURE(kLimitConcurrentDecoderInstances, @@ -1228,7 +1230,7 @@ BASE_FEATURE(kPreferSoftwareMT21, "PreferSoftwareMT21", base::FEATURE_DISABLED_BY_DEFAULT); #endif // defined(ARCH_CPU_ARM_FAMILY) -#if BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(USE_VAAPI) // ChromeOS has one of two VideoDecoder implementations active based on // SoC/board specific configurations that are sent via command line flags. This // switch allows using the non default implementation for testing. @@ -1236,7 +1238,7 @@ BASE_FEATURE(kPreferSoftwareMT21, BASE_FEATURE(kUseAlternateVideoDecoderImplementation, "UseAlternateVideoDecoderImplementation", base::FEATURE_DISABLED_BY_DEFAULT); -#endif // BUILDFLAG(IS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(USE_VAAPI) #endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) #if BUILDFLAG(IS_WIN) diff --git a/media/base/media_switches.h b/media/base/media_switches.h index 1d9c2c2d9df73..96d9595be110e 100644 --- a/media/base/media_switches.h +++ b/media/base/media_switches.h @@ -14,6 +14,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "media/base/media_export.h" +#include "media/gpu/buildflags.h" #include "media/media_buildflags.h" namespace base { @@ -381,16 +382,18 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kBuiltInHlsPlayer); #if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) MEDIA_EXPORT BASE_DECLARE_FEATURE(kChromeOSHWAV1Decoder); MEDIA_EXPORT BASE_DECLARE_FEATURE(kChromeOSHWVBREncoding); +#if !BUILDFLAG(USE_VAAPI) MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseChromeOSDirectVideoDecoder); +#endif // !BUILDFLAG(USE_VAAPI) MEDIA_EXPORT BASE_DECLARE_FEATURE(kLimitConcurrentDecoderInstances); MEDIA_EXPORT BASE_DECLARE_FEATURE(kUSeSequencedTaskRunnerForVEA); #if defined(ARCH_CPU_ARM_FAMILY) MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreferGLImageProcessor); MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreferSoftwareMT21); #endif // defined(ARCH_CPU_ARM_FAMILY) -#if BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(USE_VAAPI) MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAlternateVideoDecoderImplementation); -#endif // BUILDFLAG(IS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(USE_VAAPI) #endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) #if BUILDFLAG(IS_WIN)