Commit 72459deb authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Don't use protected memory on x64.

Protected memory and HW decoders are not supported on x64 devices,
so WebEngine wasn't working properly when WIDEVINE_CDM feature was
enabled. This CL adds IsFuchsiaCdmSupported() that indicates that
that FuchsiaCdm is supported on the device. For now it's just a stub
that returns true only in arm64 builds.

With this change WebEngine will not try to use protected memory on
x64 devices where it's not supported.

Bug: 1013412
Change-Id: Ib9c323c725886ea7397bc7f2633a44fad56ee13a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1854547
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705189}
parent 501a020c
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "base/strings/strcat.h" #include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "build/build_config.h"
#include "components/viz/common/features.h" #include "components/viz/common/features.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "fuchsia/engine/common/web_engine_content_client.h" #include "fuchsia/engine/common/web_engine_content_client.h"
...@@ -103,6 +104,20 @@ bool SetContentDirectoriesInCommandLine( ...@@ -103,6 +104,20 @@ bool SetContentDirectoriesInCommandLine(
return true; return true;
} }
// Returns true if DRM is supported in current configuration. Currently we
// assume that it is supported on ARM64, but not on x64.
//
// TODO(crbug.com/1013412): Detect support for all features required for
// FuchsiaCdm. Specifically we need to verify that protected memory is supported
// and that mediacodec API provides hardware video decoders.
bool IsFuchsiaCdmSupported() {
#if defined(ARCH_CPU_ARM64)
return true;
#else
return false;
#endif
}
} // namespace } // namespace
const uint32_t ContextProviderImpl::kContextRequestHandleId = const uint32_t ContextProviderImpl::kContextRequestHandleId =
...@@ -212,7 +227,17 @@ void ContextProviderImpl::Create( ...@@ -212,7 +227,17 @@ void ContextProviderImpl::Create(
bool enable_widevine = bool enable_widevine =
(features & fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM) == (features & fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM) ==
fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM; fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM;
if (enable_widevine && !IsFuchsiaCdmSupported()) {
LOG(WARNING) << "Widevine is not supported on this device.";
enable_widevine = false;
}
bool enable_playready = params.has_playready_key_system(); bool enable_playready = params.has_playready_key_system();
if (enable_playready && !IsFuchsiaCdmSupported()) {
LOG(WARNING) << "PlayReady is not supported on this device.";
enable_playready = false;
}
bool enable_protected_graphics = enable_widevine || enable_playready; bool enable_protected_graphics = enable_widevine || enable_playready;
if (enable_protected_graphics && !enable_vulkan) { if (enable_protected_graphics && !enable_vulkan) {
......
...@@ -22,8 +22,8 @@ namespace { ...@@ -22,8 +22,8 @@ namespace {
// Returns true if the specified video format can be decoded on hardware. // Returns true if the specified video format can be decoded on hardware.
bool IsSupportedHardwareVideoCodec(const media::VideoType& type) { bool IsSupportedHardwareVideoCodec(const media::VideoType& type) {
// TODO(fxb/36000): Replace these hardcoded checks with a query to the // TODO(crbug.com/1013412): Replace these hardcoded checks with a query to the
// fuchsia.mediacodec FIDL service. // fuchsia.mediacodec FIDL service when fxb/36000 is resolved.
if (type.codec == media::kCodecH264 && type.level <= 41) if (type.codec == media::kCodecH264 && type.level <= 41)
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment