mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1892516 - part3 : use Glean API and report the probe on more platforms. r=padenot
`device_hardware_decoding_support` was previously only recorded on Windows and we want to extend this probe to other platforms as well. Differential Revision: https://phabricator.services.mozilla.com/D208245
This commit is contained in:
parent
cb1209a5df
commit
2b1351d2b2
@ -10,10 +10,14 @@
|
||||
#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"
|
||||
@ -28,6 +32,10 @@
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
# include "WMFDecoderModule.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using gfx::ColorRange;
|
||||
@ -1247,4 +1255,40 @@ 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
|
||||
|
@ -553,6 +553,10 @@ 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
|
||||
|
@ -52,6 +52,10 @@
|
||||
# include "mozilla/SandboxTestingChild.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) || defined(XP_LINUX)
|
||||
# include "VideoUtils.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace ipc;
|
||||
@ -132,6 +136,10 @@ 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)
|
||||
|
@ -166,3 +166,27 @@ 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
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "GPUProcessManager.h"
|
||||
#include "gfxGradientCache.h"
|
||||
#include "GfxInfoBase.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "VRGPUChild.h"
|
||||
#include "VRManager.h"
|
||||
#include "VRManagerParent.h"
|
||||
@ -106,48 +107,6 @@ 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;
|
||||
|
||||
// We will disable HVEC later after reporting Telemetry if the pref is off.
|
||||
WMFDecoderModule::Init(WMFDecoderModule::Config::ForceEnableHEVC);
|
||||
|
||||
const auto support = PDMFactory::Supported(true /* force refresh */);
|
||||
Telemetry::ScalarSet(
|
||||
Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"h264"_ns,
|
||||
support.contains(mozilla::media::MediaCodecsSupport::H264HardwareDecode));
|
||||
Telemetry::ScalarSet(
|
||||
Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"vp8"_ns,
|
||||
support.contains(mozilla::media::MediaCodecsSupport::VP8HardwareDecode));
|
||||
Telemetry::ScalarSet(
|
||||
Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"vp9"_ns,
|
||||
support.contains(mozilla::media::MediaCodecsSupport::VP9HardwareDecode));
|
||||
Telemetry::ScalarSet(
|
||||
Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"av1"_ns,
|
||||
support.contains(mozilla::media::MediaCodecsSupport::AV1HardwareDecode));
|
||||
Telemetry::ScalarSet(
|
||||
Telemetry::ScalarID::MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT, u"hevc"_ns,
|
||||
support.contains(mozilla::media::MediaCodecsSupport::HEVCHardwareDecode));
|
||||
if (StaticPrefs::media_wmf_hevc_enabled() != 1) {
|
||||
WMFDecoderModule::DisableForceEnableHEVC();
|
||||
}
|
||||
|
||||
#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; }
|
||||
@ -452,7 +411,7 @@ mozilla::ipc::IPCResult GPUParent::RecvInit(
|
||||
Unused << GPUParent::GetSingleton()
|
||||
->SendUpdateMediaCodecsSupported(supported);
|
||||
}));
|
||||
ReportHardwareMediaCodecSupportIfNeeded();
|
||||
ReportHardwareMediaCodecSupportProbe();
|
||||
});
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
NS_DispatchBackgroundTask(task, nsIEventTarget::DISPATCH_NORMAL));
|
||||
@ -552,7 +511,7 @@ mozilla::ipc::IPCResult GPUParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) {
|
||||
Unused << GPUParent::GetSingleton()
|
||||
->SendUpdateMediaCodecsSupported(supported);
|
||||
}));
|
||||
ReportHardwareMediaCodecSupportIfNeeded();
|
||||
ReportHardwareMediaCodecSupportProbe();
|
||||
});
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
NS_DispatchBackgroundTask(task, nsIEventTarget::DISPATCH_NORMAL));
|
||||
|
@ -2959,6 +2959,7 @@ media:
|
||||
- 'firefox'
|
||||
record_in_processes:
|
||||
- 'gpu'
|
||||
- 'rdd'
|
||||
|
||||
# The following section contains content process base counters.
|
||||
dom.contentprocess:
|
||||
|
Loading…
Reference in New Issue
Block a user