diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-09-07 13:12:05 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-11-09 10:02:59 +0000 |
commit | 33fc33aa94d4add0878ec30dc818e34e1dd3cc2a (patch) | |
tree | f6af110909c79b2759136554f1143d8b0572af0a /chromium/content/gpu | |
parent | 7d2c5d177e9813077a621df8d18c0deda73099b3 (diff) | |
download | qtwebengine-chromium-33fc33aa94d4add0878ec30dc818e34e1dd3cc2a.tar.gz |
BASELINE: Update Chromium to 104.0.5112.120
Change-Id: I5d2726c2ab018d75d055739b6ba64317904f05bb
Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/438935
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/content/gpu')
-rw-r--r-- | chromium/content/gpu/BUILD.gn | 5 | ||||
-rw-r--r-- | chromium/content/gpu/OWNERS | 2 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_main.cc | 50 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_process.cc | 15 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_process.h | 24 | ||||
-rw-r--r-- | chromium/content/gpu/gpu_sandbox_hook_linux.cc | 11 | ||||
-rw-r--r-- | chromium/content/gpu/in_process_gpu_thread.cc | 13 | ||||
-rw-r--r-- | chromium/content/gpu/in_process_gpu_thread.h | 4 |
8 files changed, 41 insertions, 83 deletions
diff --git a/chromium/content/gpu/BUILD.gn b/chromium/content/gpu/BUILD.gn index f0cc370d192..250c7712adf 100644 --- a/chromium/content/gpu/BUILD.gn +++ b/chromium/content/gpu/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/chromecast_build.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/ui.gni") import("//gpu/vulkan/features.gni") @@ -36,8 +37,6 @@ target(link_target_type, "gpu_sources") { "gpu_child_thread.h", "gpu_child_thread_receiver_bindings.cc", "gpu_main.cc", - "gpu_process.cc", - "gpu_process.h", "gpu_service_factory.cc", "gpu_service_factory.h", "in_process_gpu_thread.cc", @@ -135,7 +134,7 @@ target(link_target_type, "gpu_sources") { # Use DRI on desktop Linux builds. if (current_cpu != "s390x" && current_cpu != "ppc64" && is_linux && - (!is_chromecast || is_cast_desktop_build)) { + !is_castos) { configs += [ "//build/config/linux/dri" ] } } diff --git a/chromium/content/gpu/OWNERS b/chromium/content/gpu/OWNERS index 559f95419da..81dfa3f27d0 100644 --- a/chromium/content/gpu/OWNERS +++ b/chromium/content/gpu/OWNERS @@ -6,3 +6,5 @@ per-file browser_exposed_gpu_interfaces.*=set noparent per-file browser_exposed_gpu_interfaces.*=file://ipc/SECURITY_OWNERS per-file gpu_child_thread_receiver_bindings.*=set noparent per-file gpu_child_thread_receiver_bindings.*=file://ipc/SECURITY_OWNERS +per-file gpu_sandbox_hook_linux.*=set noparent +per-file gpu_sandbox_hook_linux.*=file://sandbox/linux/OWNERS diff --git a/chromium/content/gpu/gpu_main.cc b/chromium/content/gpu/gpu_main.cc index 660c5f35c60..3cd3d274484 100644 --- a/chromium/content/gpu/gpu_main.cc +++ b/chromium/content/gpu/gpu_main.cc @@ -10,10 +10,11 @@ #include <utility> #include "base/bind.h" +#include "base/check.h" +#include "base/command_line.h" #include "base/feature_list.h" #include "base/memory/raw_ptr.h" #include "base/message_loop/message_pump_type.h" -#include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" #include "base/numerics/clamped_math.h" #include "base/process/process_metrics.h" @@ -22,7 +23,7 @@ #include "base/strings/string_number_conversions.h" #include "base/system/sys_info.h" #include "base/task/single_thread_task_executor.h" -#include "base/task/thread_pool.h" +#include "base/task/thread_pool/thread_pool_instance.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" #include "base/timer/hi_res_timer_manager.h" @@ -30,14 +31,13 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "components/viz/service/main/viz_main_impl.h" +#include "content/child/child_process.h" #include "content/common/content_constants_internal.h" #include "content/common/content_switches_internal.h" #include "content/common/partition_alloc_support.h" #include "content/common/skia_utils.h" #include "content/gpu/gpu_child_thread.h" -#include "content/gpu/gpu_process.h" #include "content/public/common/content_client.h" -#include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" #include "content/public/common/result_codes.h" @@ -75,7 +75,6 @@ #if BUILDFLAG(IS_ANDROID) #include "base/trace_event/memory_dump_manager.h" #include "components/tracing/common/graphics_memory_dump_provider_android.h" -#include "content/common/android/cpu_affinity_setter.h" #endif #if BUILDFLAG(IS_WIN) @@ -290,11 +289,13 @@ int GpuMain(MainFunctionParams parameters) { base::PlatformThread::SetName("CrGpuMain"); #if !BUILDFLAG(IS_MAC) - if (base::FeatureList::IsEnabled(features::kGpuUseDisplayThreadPriority)) { - // Set thread priority before sandbox initialization. - base::PlatformThread::SetCurrentThreadPriority( - base::ThreadPriority::DISPLAY); + // Set thread priority before sandbox initialization. + base::ThreadPriority thread_priority = base::ThreadPriority::NORMAL; + if (base::FeatureList::IsEnabled(features::kGpuUseDisplayThreadPriority) && + !features::IsGpuMainThreadForcedToNormalPriorityDrDc()) { + thread_priority = base::ThreadPriority::DISPLAY; } + base::PlatformThread::SetCurrentThreadPriority(thread_priority); #endif auto gpu_init = std::make_unique<gpu::GpuInit>(); @@ -309,10 +310,11 @@ int GpuMain(MainFunctionParams parameters) { // before it. InitializeSkia(); - // Create the ThreadPool before invoking |gpu_init| as it needs the ThreadPool - // (in angle::InitializePlatform()). Do not start it until after the sandbox - // is initialized however to avoid creating threads outside the sandbox. - base::ThreadPoolInstance::Create("GPU"); + // The ThreadPool must have been created before invoking |gpu_init| as it + // needs the ThreadPool (in angle::InitializePlatform()). Do not start it + // until after the sandbox is initialized however to avoid creating threads + // outside the sandbox. + DCHECK(base::ThreadPoolInstance::Get()); // Gpu initialization may fail for various reasons, in which case we will need // to tear down this process. However, we can not do so safely until the IPC @@ -328,23 +330,20 @@ int GpuMain(MainFunctionParams parameters) { GetContentClient()->SetGpuInfo(gpu_init->gpu_info()); - // Start the ThreadPoolInstance now that the sandbox is initialized. - base::ThreadPoolInstance::Get()->StartWithDefaultParams(); - - const base::ThreadPriority io_thread_priority = + base::ThreadPriority io_thread_priority = base::FeatureList::IsEnabled(features::kGpuUseDisplayThreadPriority) ? base::ThreadPriority::DISPLAY : base::ThreadPriority::NORMAL; #if BUILDFLAG(IS_MAC) // Increase the thread priority to get more reliable values in performance // test of mac_os. - GpuProcess gpu_process( - (command_line.HasSwitch(switches::kUseHighGPUThreadPriorityForPerfTests) - ? base::ThreadPriority::REALTIME_AUDIO - : io_thread_priority)); -#else - GpuProcess gpu_process(io_thread_priority); + if (command_line.HasSwitch(switches::kUseHighGPUThreadPriorityForPerfTests)) + io_thread_priority = base::ThreadPriority::REALTIME_AUDIO; #endif + // ChildProcess will start the ThreadPoolInstance now that the sandbox is + // initialized. + ChildProcess gpu_process(io_thread_priority); + DCHECK(base::ThreadPoolInstance::Get()->WasStarted()); auto* client = GetContentClient()->gpu(); if (client) @@ -388,11 +387,6 @@ int GpuMain(MainFunctionParams parameters) { base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", nullptr); - if (base::GetFieldTrialParamByFeatureAsBool( - features::kBigLittleScheduling, - features::kBigLittleSchedulingGpuMainBigParam, false)) { - SetCpuAffinityForCurrentThread(base::CpuAffinityMode::kBigCoresOnly); - } #endif internal::PartitionAllocSupport::Get()->ReconfigureAfterTaskRunnerInit( diff --git a/chromium/content/gpu/gpu_process.cc b/chromium/content/gpu/gpu_process.cc deleted file mode 100644 index 2523fd331ed..00000000000 --- a/chromium/content/gpu/gpu_process.cc +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/gpu/gpu_process.h" - -namespace content { - -GpuProcess::GpuProcess(base::ThreadPriority io_thread_priority) - : ChildProcess(io_thread_priority) {} - -GpuProcess::~GpuProcess() { -} - -} // namespace content diff --git a/chromium/content/gpu/gpu_process.h b/chromium/content/gpu/gpu_process.h deleted file mode 100644 index 5df79601161..00000000000 --- a/chromium/content/gpu/gpu_process.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_GPU_GPU_PROCESS_H_ -#define CONTENT_GPU_GPU_PROCESS_H_ - -#include "content/child/child_process.h" - -namespace content { - -class GpuProcess : public ChildProcess { - public: - explicit GpuProcess(base::ThreadPriority io_thread_priority); - - GpuProcess(const GpuProcess&) = delete; - GpuProcess& operator=(const GpuProcess&) = delete; - - ~GpuProcess() override; -}; - -} - -#endif // CONTENT_GPU_GPU_PROCESS_H_ diff --git a/chromium/content/gpu/gpu_sandbox_hook_linux.cc b/chromium/content/gpu/gpu_sandbox_hook_linux.cc index 4475f9a1fcb..a89406e4b6d 100644 --- a/chromium/content/gpu/gpu_sandbox_hook_linux.cc +++ b/chromium/content/gpu/gpu_sandbox_hook_linux.cc @@ -104,6 +104,16 @@ static const char kLibV4lEncPluginPath[] = constexpr int dlopen_flag = RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE; +void AddStandardChromeOsPermissions( + std::vector<BrokerFilePermission>* permissions) { + static const char kAngleEglPath[] = "/opt/google/chrome/libEGL.so"; + static const char kAngleGlesPath[] = "/opt/google/chrome/libGLESv2.so"; + + // For the ANGLE passthrough command decoder. + permissions->push_back(BrokerFilePermission::ReadOnly(kAngleEglPath)); + permissions->push_back(BrokerFilePermission::ReadOnly(kAngleGlesPath)); +} + void AddV4L2GpuPermissions( std::vector<BrokerFilePermission>* permissions, const sandbox::policy::SandboxSeccompBPF::Options& options) { @@ -388,6 +398,7 @@ std::vector<BrokerFilePermission> FilePermissionsForGpu( AddVulkanICDPermissions(&permissions); if (IsChromeOS()) { + AddStandardChromeOsPermissions(&permissions); if (UseV4L2Codec()) AddV4L2GpuPermissions(&permissions, options); if (IsArchitectureArm()) { diff --git a/chromium/content/gpu/in_process_gpu_thread.cc b/chromium/content/gpu/in_process_gpu_thread.cc index a49d5167247..fb22228c623 100644 --- a/chromium/content/gpu/in_process_gpu_thread.cc +++ b/chromium/content/gpu/in_process_gpu_thread.cc @@ -5,13 +5,11 @@ #include "content/gpu/in_process_gpu_thread.h" #include "base/command_line.h" -#include "base/metrics/field_trial_params.h" #include "base/time/time.h" #include "build/build_config.h" +#include "content/child/child_process.h" #include "content/gpu/gpu_child_thread.h" -#include "content/gpu/gpu_process.h" #include "content/public/common/content_client.h" -#include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "gpu/config/gpu_preferences.h" #include "gpu/ipc/service/gpu_init.h" @@ -23,7 +21,6 @@ #if BUILDFLAG(IS_ANDROID) #include "base/android/jni_android.h" -#include "content/common/android/cpu_affinity_setter.h" #endif namespace content { @@ -51,15 +48,9 @@ void InProcessGpuThread::Init() { base::android::AttachCurrentThreadWithName(thread_name()); // Up the priority of the |io_thread_| on Android. io_thread_priority = base::ThreadPriority::DISPLAY; - - if (base::GetFieldTrialParamByFeatureAsBool( - features::kBigLittleScheduling, - features::kBigLittleSchedulingGpuMainBigParam, false)) { - SetCpuAffinityForCurrentThread(base::CpuAffinityMode::kBigCoresOnly); - } #endif - gpu_process_ = new GpuProcess(io_thread_priority); + gpu_process_ = new ChildProcess(io_thread_priority); auto gpu_init = std::make_unique<gpu::GpuInit>(); gpu_init->InitializeInProcess(base::CommandLine::ForCurrentProcess(), diff --git a/chromium/content/gpu/in_process_gpu_thread.h b/chromium/content/gpu/in_process_gpu_thread.h index 395063d0676..8681b30d394 100644 --- a/chromium/content/gpu/in_process_gpu_thread.h +++ b/chromium/content/gpu/in_process_gpu_thread.h @@ -13,7 +13,7 @@ namespace content { -class GpuProcess; +class ChildProcess; // This class creates a GPU thread (instead of a GPU process), when running // with --in-process-gpu or --single-process. @@ -35,7 +35,7 @@ class InProcessGpuThread : public base::Thread { InProcessChildThreadParams params_; // Deleted in CleanUp() on the gpu thread, so don't use smart pointers. - raw_ptr<GpuProcess> gpu_process_; + raw_ptr<ChildProcess> gpu_process_; gpu::GpuPreferences gpu_preferences_; }; |