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 -up chromium-119.0.6045.105/chrome/browser/about_flags.cc.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices chromium-119.0.6045.105/chrome/browser/about_flags.cc --- chromium-119.0.6045.105/chrome/browser/about_flags.cc.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices 2023-11-01 19:10:09.000000000 +0100 +++ chromium-119.0.6045.105/chrome/browser/about_flags.cc 2023-11-06 17:12:08.057984291 +0100 @@ -7771,11 +7771,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 -up chromium-119.0.6045.105/chrome/browser/DEPS.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices chromium-119.0.6045.105/chrome/browser/DEPS --- chromium-119.0.6045.105/chrome/browser/DEPS.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices 2023-11-01 19:10:09.000000000 +0100 +++ chromium-119.0.6045.105/chrome/browser/DEPS 2023-11-06 17:12:08.055984248 +0100 @@ -415,6 +415,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 -up chromium-119.0.6045.105/chrome/browser/flag_descriptions.cc.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices chromium-119.0.6045.105/chrome/browser/flag_descriptions.cc --- chromium-119.0.6045.105/chrome/browser/flag_descriptions.cc.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices 2023-11-01 19:10:12.000000000 +0100 +++ chromium-119.0.6045.105/chrome/browser/flag_descriptions.cc 2023-11-06 17:12:08.059984335 +0100 @@ -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 @@ -7424,6 +7425,7 @@ const char kVaapiVP9kSVCEncoderDescripti #endif // defined(ARCH_CPU_X86_FAMILY) && 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 " @@ -7431,7 +7433,8 @@ const char kChromeOSDirectVideoDecoderDe "--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 -up chromium-119.0.6045.105/content/public/browser/gpu_utils.cc.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices chromium-119.0.6045.105/content/public/browser/gpu_utils.cc --- chromium-119.0.6045.105/content/public/browser/gpu_utils.cc.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices 2023-11-01 19:10:26.000000000 +0100 +++ chromium-119.0.6045.105/content/public/browser/gpu_utils.cc 2023-11-06 17:12:08.059984335 +0100 @@ -133,20 +133,26 @@ const gpu::GpuPreferences GetGpuPreferen #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 -up chromium-119.0.6045.105/media/base/media_switches.cc.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices chromium-119.0.6045.105/media/base/media_switches.cc --- chromium-119.0.6045.105/media/base/media_switches.cc.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices 2023-11-01 19:10:31.000000000 +0100 +++ chromium-119.0.6045.105/media/base/media_switches.cc 2023-11-06 17:12:08.060984356 +0100 @@ -1202,6 +1202,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 @@ -1210,6 +1211,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, @@ -1238,7 +1240,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. @@ -1246,7 +1248,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 -up chromium-119.0.6045.105/media/base/media_switches.h.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices chromium-119.0.6045.105/media/base/media_switches.h --- chromium-119.0.6045.105/media/base/media_switches.h.hide-UseChromeOSDirectVideoDecoder-flag-on-VA-API-devices 2023-11-01 19:10:31.000000000 +0100 +++ chromium-119.0.6045.105/media/base/media_switches.h 2023-11-06 17:12:08.060984356 +0100 @@ -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 { @@ -382,16 +383,18 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kBuilt #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)