qt6.qtwebengine: add aarch64-darwin support

This commit is contained in:
Weijia Wang 2023-04-18 18:48:33 +03:00
parent d9c199dbc6
commit 8c1e819599
4 changed files with 87 additions and 1 deletions

@ -137,6 +137,9 @@ let
GameController ImageCaptureCore LocalAuthentication
MediaAccessibility MediaPlayer MetalKit Network OpenDirectory Quartz
ReplayKit SecurityInterface Vision;
xcbuild = buildPackages.xcbuild.override {
productBuildVer = "20A2408";
};
};
qtwebsockets = callPackage ./modules/qtwebsockets.nix { };
qtwebview = callPackage ./modules/qtwebview.nix {

@ -127,6 +127,12 @@ qtModule {
# which cannot be set at the same time as -Wformat-security
hardeningDisable = [ "format" ];
# removes macOS 12+ dependencies
patches = [
../patches/qtwebengine-darwin-no-low-latency-flag.patch
../patches/qtwebengine-darwin-no-copy-certificate-chain.patch
];
postPatch = ''
# Patch Chromium build tools
(
@ -301,7 +307,8 @@ qtModule {
meta = with lib; {
description = "A web engine based on the Chromium web browser";
platforms = platforms.linux;
platforms = platforms.unix;
broken = stdenv.isDarwin && stdenv.isx86_64;
# This build takes a long time; particularly on slow architectures
# 1 hour on 32x3.6GHz -> maybe 12 hours on 4x2.4GHz
timeout = 24 * 3600;

@ -0,0 +1,16 @@
diff --git a/src/3rdparty/chromium/net/cert/x509_util_apple.cc b/src/3rdparty/chromium/net/cert/x509_util_apple.cc
index ae69948dfca..7062a9a9b97 100644
--- a/src/3rdparty/chromium/net/cert/x509_util_apple.cc
+++ b/src/3rdparty/chromium/net/cert/x509_util_apple.cc
@@ -139,11 +139,6 @@ SHA256HashValue CalculateFingerprint256(SecCertificateRef cert) {
base::ScopedCFTypeRef<CFArrayRef> CertificateChainFromSecTrust(
SecTrustRef trust) {
- if (__builtin_available(macOS 12.0, iOS 15.0, *)) {
- return base::ScopedCFTypeRef<CFArrayRef>(
- SecTrustCopyCertificateChain(trust));
- }
-
base::ScopedCFTypeRef<CFMutableArrayRef> chain(
CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
const CFIndex chain_length = SecTrustGetCertificateCount(trust);

@ -0,0 +1,60 @@
diff --git a/src/3rdparty/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.cc b/src/3rdparty/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.cc
index 6a3a777..249d4cc 100644
--- a/src/3rdparty/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.cc
+++ b/src/3rdparty/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.cc
@@ -20,12 +20,6 @@
#include "media/base/media_log.h"
#include "media/base/video_frame.h"
-// This is a min version of macOS where we want to support SVC encoding via
-// EnableLowLatencyRateControl flag. The flag is actually supported since 11.3,
-// but there we see frame drops even with ample bitrate budget. Excessive frame
-// drops were fixed in 12.0.1.
-#define LOW_LATENCY_FLAG_AVAILABLE_VER 12.0.1
-
namespace media {
namespace {
@@ -150,8 +144,6 @@ VTVideoEncodeAccelerator::GetSupportedProfiles() {
profile.max_framerate_numerator = kMaxFrameRateNumerator;
profile.max_framerate_denominator = kMaxFrameRateDenominator;
profile.max_resolution = gfx::Size(kMaxResolutionWidth, kMaxResolutionHeight);
- if (__builtin_available(macOS LOW_LATENCY_FLAG_AVAILABLE_VER, *))
- profile.scalability_modes.push_back(SVCScalabilityMode::kL1T2);
for (const auto& supported_profile : kSupportedProfiles) {
profile.profile = supported_profile;
profiles.push_back(profile);
@@ -595,13 +587,6 @@ bool VTVideoEncodeAccelerator::CreateCompressionSession(
kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder};
std::vector<CFTypeRef> encoder_values{kCFBooleanTrue};
- if (__builtin_available(macOS LOW_LATENCY_FLAG_AVAILABLE_VER, *)) {
- if (require_low_delay_) {
- encoder_keys.push_back(
- kVTVideoEncoderSpecification_EnableLowLatencyRateControl);
- encoder_values.push_back(kCFBooleanTrue);
- }
- }
base::ScopedCFTypeRef<CFDictionaryRef> encoder_spec =
video_toolbox::DictionaryWithKeysAndValues(
encoder_keys.data(), encoder_values.data(), encoder_keys.size());
@@ -669,19 +654,8 @@ bool VTVideoEncodeAccelerator::ConfigureCompressionSession() {
}
if (num_temporal_layers_ == 2) {
- if (__builtin_available(macOS LOW_LATENCY_FLAG_AVAILABLE_VER, *)) {
- if (!session_property_setter.IsSupported(
- kVTCompressionPropertyKey_BaseLayerFrameRateFraction)) {
- DLOG(ERROR) << "BaseLayerFrameRateFraction is not supported";
- return false;
- }
- rv &= session_property_setter.Set(
- kVTCompressionPropertyKey_BaseLayerFrameRateFraction, 0.5);
- DLOG_IF(ERROR, !rv) << " Setting BaseLayerFrameRate property failed.";
- } else {
DLOG(ERROR) << "SVC encoding is not supported on this OS version.";
rv = false;
- }
}
return rv;