From 6d01c0b28a38849d41182a59e08ff77a986e9302 Mon Sep 17 00:00:00 2001 From: Sandor Molnar Date: Thu, 25 Apr 2024 21:30:10 +0300 Subject: [PATCH] Backed out 3 changesets (bug 1892516) for causing multiple failures @ toolkit/components/glean/api/src/private/boolean.rs CLOSED TREE Backed out changeset 842a809422f9 (bug 1892516) Backed out changeset 5155a959fe13 (bug 1892516) Backed out changeset d1cebb819ab9 (bug 1892516) --- dom/media/VideoUtils.cpp | 44 -------------------- dom/media/VideoUtils.h | 4 -- dom/media/ipc/RDDParent.cpp | 12 ------ dom/media/metrics.yaml | 24 ----------- dom/media/platforms/wmf/WMFDecoderModule.cpp | 3 -- dom/media/platforms/wmf/WMFDecoderModule.h | 5 +-- gfx/ipc/GPUParent.cpp | 62 ++++++++++++++++++++++++++-- toolkit/components/telemetry/Scalars.yaml | 1 - 8 files changed, 60 insertions(+), 95 deletions(-) diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp index 672e04df1955..24b1f0dd593d 100644 --- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -10,14 +10,10 @@ #include "ImageContainer.h" #include "MediaContainerType.h" #include "MediaResource.h" -#include "PDMFactory.h" #include "TimeUnits.h" #include "mozilla/Base64.h" #include "mozilla/dom/ContentChild.h" -#include "mozilla/gfx/gfxVars.h" -#include "mozilla/glean/GleanMetrics.h" #include "mozilla/SchedulerGroup.h" -#include "mozilla/ScopeExit.h" #include "mozilla/SharedThreadPool.h" #include "mozilla/StaticPrefs_accessibility.h" #include "mozilla/StaticPrefs_media.h" @@ -32,10 +28,6 @@ #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" -#ifdef XP_WIN -# include "WMFDecoderModule.h" -#endif - namespace mozilla { using gfx::ColorRange; @@ -1255,40 +1247,4 @@ void DetermineResolutionForTelemetry(const MediaInfo& aInfo, aResolutionOut.AppendASCII(resolution); } -void ReportHardwareMediaCodecSupportProbe() { - // We only need to report the result once. - static bool sReported = false; - if (sReported) { - return; - } - // Only report telemetry when hardware decoding is available. - if (!gfx::gfxVars::IsInitialized() || - !gfx::gfxVars::CanUseHardwareVideoDecoding()) { - return; - } - sReported = true; - -#if defined(XP_WIN) - // We will disable HVEC later after reporting Telemetry if the pref is off. - auto scopeExit = MakeScopeExit([]() { - if (StaticPrefs::media_wmf_hevc_enabled() != 1) { - WMFDecoderModule::DisableForceEnableHEVC(); - } - }); - WMFDecoderModule::Init(WMFDecoderModule::Config::ForceEnableHEVC); -#endif - - const auto support = PDMFactory::Supported(true /* force refresh */); - glean::media_playback::device_hardware_decoder_support.Get("h264"_ns).Set( - support.contains(mozilla::media::MediaCodecsSupport::H264HardwareDecode)); - glean::media_playback::device_hardware_decoder_support.Get("vp8"_ns).Set( - support.contains(mozilla::media::MediaCodecsSupport::VP8HardwareDecode)); - glean::media_playback::device_hardware_decoder_support.Get("vp9"_ns).Set( - support.contains(mozilla::media::MediaCodecsSupport::VP9HardwareDecode)); - glean::media_playback::device_hardware_decoder_support.Get("av1"_ns).Set( - support.contains(mozilla::media::MediaCodecsSupport::AV1HardwareDecode)); - glean::media_playback::device_hardware_decoder_support.Get("hevc"_ns).Set( - support.contains(mozilla::media::MediaCodecsSupport::HEVCHardwareDecode)); -} - } // end namespace mozilla diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h index f13d595623fd..b1dbb0cf2be7 100644 --- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -553,10 +553,6 @@ bool IsWaveMimetype(const nsACString& aMimeType); void DetermineResolutionForTelemetry(const MediaInfo& aInfo, nsCString& aResolutionOut); -// Used in the GPU and RDD process for reporting Glean result on different -// platforms. -void ReportHardwareMediaCodecSupportProbe(); - } // end namespace mozilla #endif diff --git a/dom/media/ipc/RDDParent.cpp b/dom/media/ipc/RDDParent.cpp index 3b17e5ea82ba..8892e8fbbe89 100644 --- a/dom/media/ipc/RDDParent.cpp +++ b/dom/media/ipc/RDDParent.cpp @@ -52,10 +52,6 @@ # include "mozilla/SandboxTestingChild.h" #endif -#if defined(XP_MACOSX) || defined(XP_LINUX) -# include "VideoUtils.h" -#endif - namespace mozilla { using namespace ipc; @@ -136,10 +132,6 @@ mozilla::ipc::IPCResult RDDParent::RecvInit( auto supported = PDMFactory::Supported(); Unused << SendUpdateMediaCodecsSupported(supported); -#if defined(XP_MACOSX) || defined(XP_LINUX) - // We report probe on GPU process on Windows and Android. - ReportHardwareMediaCodecSupportProbe(); -#endif #if defined(MOZ_SANDBOX) # if defined(XP_MACOSX) @@ -176,10 +168,6 @@ IPCResult RDDParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) { WMFDecoderModule::Init(); Unused << RDDParent::GetSingleton()->SendUpdateMediaCodecsSupported( PDMFactory::Supported(true /* force refresh */)); -# if defined(XP_MACOSX) || defined(XP_LINUX) - // We report probe on GPU process on Windows and Android. - ReportHardwareMediaCodecSupportProbe(); -# endif } }); #endif diff --git a/dom/media/metrics.yaml b/dom/media/metrics.yaml index 3f735b027300..58e525174b0d 100644 --- a/dom/media/metrics.yaml +++ b/dom/media/metrics.yaml @@ -166,27 +166,3 @@ media.playback: description: True if the first frame is decoded by a hardware decoder. type: boolean expires: never - device_hardware_decoder_support: - type: labeled_boolean - description: - The results of hardware decoder support for different video codecs. True - means that codec can be decoded by hardware on user's device. - metadata: - tags: - - 'Core :: Audio/Video: Playback' - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1892516 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1892516#c4 - data_sensitivity: - - technical - notification_emails: - - media-alerts@mozilla.com - expires: never - labels: - - h264 - - vp8 - - vp9 - - av1 - - hevc - telemetry_mirror: MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT diff --git a/dom/media/platforms/wmf/WMFDecoderModule.cpp b/dom/media/platforms/wmf/WMFDecoderModule.cpp index 79556b061b60..dcba14bac22c 100644 --- a/dom/media/platforms/wmf/WMFDecoderModule.cpp +++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp @@ -485,9 +485,6 @@ bool WMFDecoderModule::IsHEVCSupported() { return sForceEnableHEVC || StaticPrefs::media_wmf_hevc_enabled() == 1; } -/* static */ -void WMFDecoderModule::DisableForceEnableHEVC() { sForceEnableHEVC = false; } - } // namespace mozilla #undef WFM_DECODER_MODULE_STATUS_MARKER diff --git a/dom/media/platforms/wmf/WMFDecoderModule.h b/dom/media/platforms/wmf/WMFDecoderModule.h index 6debdc58365c..514221730e37 100644 --- a/dom/media/platforms/wmf/WMFDecoderModule.h +++ b/dom/media/platforms/wmf/WMFDecoderModule.h @@ -10,7 +10,6 @@ # include "PlatformDecoderModule.h" # include "WMF.h" # include "WMFUtils.h" -# include "mozilla/Atomics.h" namespace mozilla { @@ -56,13 +55,11 @@ class WMFDecoderModule : public PlatformDecoderModule { RefPtr& aDecoder); static bool CanCreateMFTDecoder(const WMFStreamType& aType); - static void DisableForceEnableHEVC(); - private: // This is used for GPU process only, where we can't set the preference // directly (it can only set in the parent process) So we need a way to force // enable the HEVC in order to report the support information via telemetry. - static inline Atomic sForceEnableHEVC{false}; + static inline bool sForceEnableHEVC = false; static bool IsHEVCSupported(); diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp index 054eda4ae253..f23b21c27ece 100644 --- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -14,7 +14,6 @@ #include "GPUProcessManager.h" #include "gfxGradientCache.h" #include "GfxInfoBase.h" -#include "VideoUtils.h" #include "VRGPUChild.h" #include "VRManager.h" #include "VRManagerParent.h" @@ -107,6 +106,63 @@ using namespace layers; static GPUParent* sGPUParent; +static void ReportHardwareMediaCodecSupportIfNeeded() { + // We only need to report the result once. + static bool sReported = false; + if (sReported) { + return; + } +#if defined(XP_WIN) + // Only report telemetry when hardware decoding is available. + if (!gfx::gfxVars::IsInitialized() || + !gfx::gfxVars::CanUseHardwareVideoDecoding()) { + return; + } + sReported = true; + + // TODO : we can remove this after HEVC is enabled by default. + // HEVC is not enabled. We need to force to enable it in order to know + // its support as well, and it would be turn off later. + if (StaticPrefs::media_wmf_hevc_enabled() != 1) { + WMFDecoderModule::Init(WMFDecoderModule::Config::ForceEnableHEVC); + } + const auto support = PDMFactory::Supported(true /* force refresh */); + if (support.contains( + mozilla::media::MediaCodecsSupport::H264HardwareDecode)) { + Telemetry::ScalarSet( + Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"h264"_ns, + true); + } + if (support.contains(mozilla::media::MediaCodecsSupport::VP8HardwareDecode)) { + Telemetry::ScalarSet( + Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"vp8"_ns, + true); + } + if (support.contains(mozilla::media::MediaCodecsSupport::VP9HardwareDecode)) { + Telemetry::ScalarSet( + Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"vp9"_ns, + true); + } + if (support.contains(mozilla::media::MediaCodecsSupport::AV1HardwareDecode)) { + Telemetry::ScalarSet( + Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"av1"_ns, + true); + } + if (support.contains( + mozilla::media::MediaCodecsSupport::HEVCHardwareDecode)) { + Telemetry::ScalarSet( + Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"hevc"_ns, + true); + } + if (StaticPrefs::media_wmf_hevc_enabled() != 1) { + WMFDecoderModule::Init(); + } + +#endif + // TODO : in the future, when we have GPU procss on MacOS, then we can report + // HEVC usage as well. +} + GPUParent::GPUParent() : mLaunchTime(TimeStamp::Now()) { sGPUParent = this; } GPUParent::~GPUParent() { sGPUParent = nullptr; } @@ -411,7 +467,7 @@ mozilla::ipc::IPCResult GPUParent::RecvInit( Unused << GPUParent::GetSingleton() ->SendUpdateMediaCodecsSupported(supported); })); - ReportHardwareMediaCodecSupportProbe(); + ReportHardwareMediaCodecSupportIfNeeded(); }); MOZ_ALWAYS_SUCCEEDS( NS_DispatchBackgroundTask(task, nsIEventTarget::DISPATCH_NORMAL)); @@ -511,7 +567,7 @@ mozilla::ipc::IPCResult GPUParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) { Unused << GPUParent::GetSingleton() ->SendUpdateMediaCodecsSupported(supported); })); - ReportHardwareMediaCodecSupportProbe(); + ReportHardwareMediaCodecSupportIfNeeded(); }); MOZ_ALWAYS_SUCCEEDS( NS_DispatchBackgroundTask(task, nsIEventTarget::DISPATCH_NORMAL)); diff --git a/toolkit/components/telemetry/Scalars.yaml b/toolkit/components/telemetry/Scalars.yaml index 4e0d70d1853e..9dc630b08809 100644 --- a/toolkit/components/telemetry/Scalars.yaml +++ b/toolkit/components/telemetry/Scalars.yaml @@ -2959,7 +2959,6 @@ media: - 'firefox' record_in_processes: - 'gpu' - - 'rdd' # The following section contains content process base counters. dom.contentprocess: -- 2.11.4.GIT