#include "components/viz/service/gl/gpu_service_impl.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/allocator/partition_alloc_support.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/synchronization/waitable_event.h"
#include "base/system/sys_info.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/trace_event/trace_event.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/startup_metric_utils/gpu/startup_metric_utils.h"
#include "components/version_info/version_info.h"
#include "components/viz/common/features.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "gpu/command_buffer/service/dawn_caching_interface.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/scheduler.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image/shared_image_factory.h"
#include "gpu/command_buffer/service/shared_image/shared_image_manager.h"
#include "gpu/command_buffer/service/skia_utils.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "gpu/config/gpu_finch_features.h"
#include "gpu/config/gpu_info_collector.h"
#include "gpu/config/gpu_switches.h"
#include "gpu/config/gpu_util.h"
#include "gpu/ipc/common/gpu_client_ids.h"
#include "gpu/ipc/common/gpu_memory_buffer_impl_shared_memory.h"
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "gpu/ipc/common/gpu_peak_memory.h"
#include "gpu/ipc/common/memory_stats.h"
#include "gpu/ipc/service/gpu_channel.h"
#include "gpu/ipc/service/gpu_channel_manager.h"
#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "gpu/ipc/service/gpu_watchdog_thread.h"
#include "gpu/ipc/service/image_decode_accelerator_worker.h"
#include "gpu/vulkan/buildflags.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_sync_channel.h"
#include "ipc/ipc_sync_message_filter.h"
#include "media/base/media_log.h"
#include "media/base/media_switches.h"
#include "media/gpu/buildflags.h"
#include "media/gpu/gpu_video_accelerator_util.h"
#include "media/gpu/gpu_video_encode_accelerator_factory.h"
#include "media/gpu/ipc/service/media_gpu_channel_manager.h"
#include "media/mojo/services/gpu_mojo_media_client.h"
#include "media/mojo/services/mojo_video_encode_accelerator_provider.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "skia/buildflags.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/gpu/gl/GrGLAssembleInterface.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "ui/base/ozone_buildflags.h"
#include "ui/base/ui_base_features.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/gl_utils.h"
#include "ui/gl/gpu_switching_manager.h"
#include "ui/gl/init/create_gr_gl_interface.h"
#include "ui/gl/init/gl_factory.h"
#include "url/gurl.h"
#if BUILDFLAG(USE_VAAPI)
#include "media/gpu/vaapi/vaapi_image_decode_accelerator_worker.h"
#endif
#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#include "components/viz/service/gl/throw_uncaught_exception.h"
#include "media/base/android/media_codec_util.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/chromeos_camera/gpu_mjpeg_decode_accelerator_factory.h"
#include "components/chromeos_camera/mojo_jpeg_encode_accelerator_service.h"
#include "components/chromeos_camera/mojo_mjpeg_decode_accelerator_service.h"
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
#include "ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h"
#if BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC)
#include "ash/components/arc/video_accelerator/gpu_arc_video_decoder.h"
#endif
#include "ash/components/arc/video_accelerator/gpu_arc_video_encode_accelerator.h"
#include "ash/components/arc/video_accelerator/gpu_arc_video_protected_buffer_allocator.h"
#include "ash/components/arc/video_accelerator/protected_buffer_manager.h"
#include "ash/components/arc/video_accelerator/protected_buffer_manager_proxy.h"
#endif
#endif
#if !BUILDFLAG(IS_CHROMEOS)
#include "services/webnn/webnn_context_provider_impl.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "components/viz/common/overlay_state/win/overlay_state_service.h"
#include "gpu/command_buffer/service/shared_image/d3d_image_backing_factory.h"
#include "media/base/win/mf_feature_checks.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "ui/gl/dcomp_surface_registry.h"
#include "ui/gl/direct_composition_support.h"
#endif
#if BUILDFLAG(IS_APPLE)
#include "ui/base/cocoa/quartz_util.h"
#endif
#if BUILDFLAG(SKIA_USE_DAWN)
#include "gpu/command_buffer/service/dawn_context_provider.h"
#endif
#if BUILDFLAG(SKIA_USE_METAL)
#include "components/viz/common/gpu/metal_context_provider.h"
#endif
#if BUILDFLAG(CLANG_PROFILING_INSIDE_SANDBOX)
#include "base/test/clang_profiling.h"
#endif
#if BUILDFLAG(ENABLE_VULKAN)
#include "components/viz/common/gpu/vulkan_context_provider.h"
#include "components/viz/common/gpu/vulkan_in_process_context_provider.h"
#endif
#if BUILDFLAG(IS_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif
namespace viz {
namespace {
constexpr char kGpuInitializationEventCategory[] = …;
constexpr char kGpuInitializationEvent[] = …;
LogCallback;
struct LogMessage { … };
bool PreInitializeLogHandler(int severity,
const char* file,
int line,
size_t message_start,
const std::string& message);
bool PostInitializeLogHandler(int severity,
const char* file,
int line,
size_t message_start,
const std::string& message);
class LogMessageManager { … };
LogMessageManager* GetLogMessageManager() { … }
bool PreInitializeLogHandler(int severity,
const char* file,
int line,
size_t message_start,
const std::string& message) { … }
bool PostInitializeLogHandler(int severity,
const char* file,
int line,
size_t message_start,
const std::string& message) { … }
bool IsAcceleratedJpegDecodeSupported() { … }
bool WillGetGmbConfigFromGpu() { … }
}
GpuServiceImpl::GpuServiceImpl(
const gpu::GpuPreferences& gpu_preferences,
const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info,
const std::optional<gpu::GPUInfo>& gpu_info_for_hardware_gpu,
const std::optional<gpu::GpuFeatureInfo>& gpu_feature_info_for_hardware_gpu,
const gfx::GpuExtraInfo& gpu_extra_info,
InitParams init_params)
: … { … }
GpuServiceImpl::~GpuServiceImpl() { … }
void GpuServiceImpl::UpdateGPUInfo() { … }
void GpuServiceImpl::UpdateGPUInfoGL() { … }
void GpuServiceImpl::InitializeWithHost(
mojo::PendingRemote<mojom::GpuHost> pending_gpu_host,
gpu::GpuProcessShmCount use_shader_cache_shm_count,
scoped_refptr<gl::GLSurface> default_offscreen_surface,
gpu::SyncPointManager* sync_point_manager,
gpu::SharedImageManager* shared_image_manager,
gpu::Scheduler* scheduler,
base::WaitableEvent* shutdown_event) { … }
void GpuServiceImpl::Bind(
mojo::PendingReceiver<mojom::GpuService> pending_receiver) { … }
void GpuServiceImpl::DisableGpuCompositing() { … }
scoped_refptr<gpu::SharedContextState> GpuServiceImpl::GetContextState() { … }
void GpuServiceImpl::InstallPreInitializeLogHandler() { … }
void GpuServiceImpl::FlushPreInitializeLogMessages(mojom::GpuHost* gpu_host) { … }
void GpuServiceImpl::SetVisibilityChangedCallback(
VisibilityChangedCallback callback) { … }
void GpuServiceImpl::RecordLogMessage(int severity,
const std::string& header,
const std::string& message) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
void GpuServiceImpl::CreateArcVideoDecodeAccelerator(
mojo::PendingReceiver<arc::mojom::VideoDecodeAccelerator> vda_receiver) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcVideoDecodeAcceleratorOnMainThread,
weak_ptr_, std::move(vda_receiver)));
}
void GpuServiceImpl::CreateArcVideoDecoder(
mojo::PendingReceiver<arc::mojom::VideoDecoder> vd_receiver) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(&GpuServiceImpl::CreateArcVideoDecoderOnMainThread,
weak_ptr_, std::move(vd_receiver)));
}
void GpuServiceImpl::CreateArcVideoEncodeAccelerator(
mojo::PendingReceiver<arc::mojom::VideoEncodeAccelerator> vea_receiver) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcVideoEncodeAcceleratorOnMainThread,
weak_ptr_, std::move(vea_receiver)));
}
void GpuServiceImpl::CreateArcVideoProtectedBufferAllocator(
mojo::PendingReceiver<arc::mojom::VideoProtectedBufferAllocator>
pba_receiver) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcVideoProtectedBufferAllocatorOnMainThread,
weak_ptr_, std::move(pba_receiver)));
}
void GpuServiceImpl::CreateArcProtectedBufferManager(
mojo::PendingReceiver<arc::mojom::ProtectedBufferManager> pbm_receiver) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::CreateArcProtectedBufferManagerOnMainThread,
weak_ptr_, std::move(pbm_receiver)));
}
void GpuServiceImpl::CreateArcVideoDecodeAcceleratorOnMainThread(
mojo::PendingReceiver<arc::mojom::VideoDecodeAccelerator> vda_receiver) {
CHECK(main_runner_->BelongsToCurrentThread());
mojo::MakeSelfOwnedReceiver(
std::make_unique<arc::GpuArcVideoDecodeAccelerator>(
gpu_preferences_, gpu_channel_manager_->gpu_driver_bug_workarounds(),
protected_buffer_manager_),
std::move(vda_receiver));
}
void GpuServiceImpl::CreateArcVideoDecoderOnMainThread(
mojo::PendingReceiver<arc::mojom::VideoDecoder> vd_receiver) {
DCHECK(main_runner_->BelongsToCurrentThread());
#if BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC)
mojo::MakeSelfOwnedReceiver(
std::make_unique<arc::GpuArcVideoDecoder>(protected_buffer_manager_),
std::move(vd_receiver));
#endif
}
void GpuServiceImpl::CreateArcVideoEncodeAcceleratorOnMainThread(
mojo::PendingReceiver<arc::mojom::VideoEncodeAccelerator> vea_receiver) {
DCHECK(main_runner_->BelongsToCurrentThread());
mojo::MakeSelfOwnedReceiver(
std::make_unique<arc::GpuArcVideoEncodeAccelerator>(
gpu_preferences_, gpu_channel_manager_->gpu_driver_bug_workarounds()),
std::move(vea_receiver));
}
void GpuServiceImpl::CreateArcVideoProtectedBufferAllocatorOnMainThread(
mojo::PendingReceiver<arc::mojom::VideoProtectedBufferAllocator>
pba_receiver) {
DCHECK(main_runner_->BelongsToCurrentThread());
auto gpu_arc_video_protected_buffer_allocator =
arc::GpuArcVideoProtectedBufferAllocator::Create(
protected_buffer_manager_);
if (!gpu_arc_video_protected_buffer_allocator)
return;
mojo::MakeSelfOwnedReceiver(
std::move(gpu_arc_video_protected_buffer_allocator),
std::move(pba_receiver));
}
void GpuServiceImpl::CreateArcProtectedBufferManagerOnMainThread(
mojo::PendingReceiver<arc::mojom::ProtectedBufferManager> pbm_receiver) {
DCHECK(main_runner_->BelongsToCurrentThread());
mojo::MakeSelfOwnedReceiver(
std::make_unique<arc::GpuArcProtectedBufferManagerProxy>(
protected_buffer_manager_),
std::move(pbm_receiver));
}
#endif
void GpuServiceImpl::CreateJpegDecodeAccelerator(
mojo::PendingReceiver<chromeos_camera::mojom::MjpegDecodeAccelerator>
jda_receiver) {
DCHECK(io_runner_->BelongsToCurrentThread());
chromeos_camera::MojoMjpegDecodeAcceleratorService::Create(
std::move(jda_receiver),
base::BindRepeating(
&GpuServiceImpl::SetMjpegDecodeAcceleratorBeginFrameCB,
base::Unretained(this)));
}
void GpuServiceImpl::CreateJpegEncodeAccelerator(
mojo::PendingReceiver<chromeos_camera::mojom::JpegEncodeAccelerator>
jea_receiver) {
DCHECK(io_runner_->BelongsToCurrentThread());
chromeos_camera::MojoJpegEncodeAcceleratorService::Create(
std::move(jea_receiver));
}
#endif
#if BUILDFLAG(IS_WIN)
void GpuServiceImpl::RegisterDCOMPSurfaceHandle(
mojo::PlatformHandle surface_handle,
RegisterDCOMPSurfaceHandleCallback callback) {
base::UnguessableToken token =
gl::DCOMPSurfaceRegistry::GetInstance()->RegisterDCOMPSurfaceHandle(
surface_handle.TakeHandle());
std::move(callback).Run(token);
}
void GpuServiceImpl::UnregisterDCOMPSurfaceHandle(
const base::UnguessableToken& token) {
gl::DCOMPSurfaceRegistry::GetInstance()->UnregisterDCOMPSurfaceHandle(token);
}
#endif
void GpuServiceImpl::CreateVideoEncodeAcceleratorProvider(
mojo::PendingReceiver<media::mojom::VideoEncodeAcceleratorProvider>
vea_provider_receiver) { … }
void GpuServiceImpl::BindClientGmbInterface(
mojo::PendingReceiver<gpu::mojom::ClientGmbInterface> pending_receiver,
int client_id) { … }
#if !BUILDFLAG(IS_CHROMEOS)
void GpuServiceImpl::BindWebNNContextProvider(
mojo::PendingReceiver<webnn::mojom::WebNNContextProvider> pending_receiver,
int client_id) { … }
#endif
void GpuServiceImpl::CreateGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
int client_id,
gpu::SurfaceHandle surface_handle,
CreateGpuMemoryBufferCallback callback) { … }
void GpuServiceImpl::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
int client_id) { … }
void GpuServiceImpl::CopyGpuMemoryBuffer(
gfx::GpuMemoryBufferHandle buffer_handle,
base::UnsafeSharedMemoryRegion shared_memory,
CopyGpuMemoryBufferCallback callback) { … }
void GpuServiceImpl::GetVideoMemoryUsageStats(
GetVideoMemoryUsageStatsCallback callback) { … }
void GpuServiceImpl::StartPeakMemoryMonitor(uint32_t sequence_num) { … }
void GpuServiceImpl::GetPeakMemoryUsage(uint32_t sequence_num,
GetPeakMemoryUsageCallback callback) { … }
#if BUILDFLAG(IS_WIN)
void GpuServiceImpl::RequestDXGIInfo(RequestDXGIInfoCallback callback) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE, base::BindOnce(&GpuServiceImpl::RequestDXGIInfoOnMainThread,
weak_ptr_, std::move(callback)));
}
void GpuServiceImpl::RequestDXGIInfoOnMainThread(
RequestDXGIInfoCallback callback) {
DCHECK(main_runner_->BelongsToCurrentThread());
dxgi_info_ = gl::GetDirectCompositionHDRMonitorDXGIInfo();
io_runner_->PostTask(FROM_HERE,
base::BindOnce(std::move(callback), dxgi_info_.Clone()));
}
#endif
void GpuServiceImpl::LoseAllContexts() { … }
void GpuServiceImpl::DidCreateContextSuccessfully() { … }
void GpuServiceImpl::DidCreateOffscreenContext(const GURL& active_url) { … }
void GpuServiceImpl::DidDestroyChannel(int client_id) { … }
void GpuServiceImpl::DidDestroyAllChannels() { … }
void GpuServiceImpl::DidDestroyOffscreenContext(const GURL& active_url) { … }
void GpuServiceImpl::DidLoseContext(gpu::error::ContextLostReason reason,
const GURL& active_url) { … }
std::string GpuServiceImpl::GetShaderPrefixKey() { … }
void GpuServiceImpl::StoreBlobToDisk(const gpu::GpuDiskCacheHandle& handle,
const std::string& key,
const std::string& shader) { … }
void GpuServiceImpl::LoadedBlob(const gpu::GpuDiskCacheHandle& handle,
const std::string& key,
const std::string& data) { … }
void GpuServiceImpl::GetIsolationKey(
int client_id,
const blink::WebGPUExecutionContextToken& token,
GetIsolationKeyCallback cb) { … }
void GpuServiceImpl::MaybeExitOnContextLost(
bool synthetic_loss,
gpu::error::ContextLostReason context_lost_reason) { … }
bool GpuServiceImpl::IsExiting() const { … }
void GpuServiceImpl::EstablishGpuChannel(int32_t client_id,
uint64_t client_tracing_id,
bool is_gpu_host,
EstablishGpuChannelCallback callback) { … }
void GpuServiceImpl::SetChannelClientPid(int32_t client_id,
base::ProcessId client_pid) { … }
void GpuServiceImpl::SetChannelDiskCacheHandle(
int32_t client_id,
const gpu::GpuDiskCacheHandle& handle) { … }
void GpuServiceImpl::OnDiskCacheHandleDestoyed(
const gpu::GpuDiskCacheHandle& handle) { … }
void GpuServiceImpl::CloseChannel(int32_t client_id) { … }
void GpuServiceImpl::SetWakeUpGpuClosure(base::RepeatingClosure closure) { … }
void GpuServiceImpl::WakeUpGpu() { … }
void GpuServiceImpl::WakeUpGpuOnMainThread() { … }
void GpuServiceImpl::GpuSwitched(gl::GpuPreference active_gpu_heuristic) { … }
void GpuServiceImpl::DisplayAdded() { … }
void GpuServiceImpl::DisplayRemoved() { … }
void GpuServiceImpl::DisplayMetricsChanged() { … }
void GpuServiceImpl::DestroyAllChannels() { … }
void GpuServiceImpl::OnBackgroundCleanup() { … }
void GpuServiceImpl::OnBackgroundCleanupGpuMainThread() { … }
void GpuServiceImpl::OnBackgroundCleanupCompositorGpuThread() { … }
void GpuServiceImpl::OnBackgrounded() { … }
void GpuServiceImpl::OnBackgroundedOnMainThread() { … }
void GpuServiceImpl::OnForegrounded() { … }
void GpuServiceImpl::OnForegroundedOnMainThread() { … }
#if !BUILDFLAG(IS_ANDROID)
void GpuServiceImpl::OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel level) { … }
#endif
#if BUILDFLAG(IS_APPLE)
void GpuServiceImpl::BeginCATransaction() {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(FROM_HERE, base::BindOnce(&ui::BeginCATransaction));
}
void GpuServiceImpl::CommitCATransaction(CommitCATransactionCallback callback) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTaskAndReply(
FROM_HERE, base::BindOnce(&ui::CommitCATransaction),
base::BindPostTask(io_runner_, std::move(callback)));
}
#endif
#if BUILDFLAG(CLANG_PROFILING_INSIDE_SANDBOX)
void GpuServiceImpl::WriteClangProfilingProfile(
WriteClangProfilingProfileCallback callback) {
base::WriteClangProfilingProfile();
std::move(callback).Run();
}
#endif
void GpuServiceImpl::Crash() { … }
void GpuServiceImpl::Hang() { … }
void GpuServiceImpl::ThrowJavaException() { … }
void GpuServiceImpl::StartPeakMemoryMonitorOnMainThread(uint32_t sequence_num) { … }
void GpuServiceImpl::GetPeakMemoryUsageOnMainThread(
uint32_t sequence_num,
GetPeakMemoryUsageCallback callback) { … }
gpu::Scheduler* GpuServiceImpl::GetGpuScheduler() { … }
bool GpuServiceImpl::OnBeginFrameDerivedImpl(const BeginFrameArgs& args) { … }
void GpuServiceImpl::OnBeginFrameSourcePausedChanged(bool paused) { … }
void GpuServiceImpl::OnBeginFrameOnIO(const BeginFrameArgs& args) { … }
void GpuServiceImpl::SetRequestBeginFrameForGpuServiceCB(
RequestBeginFrameForGpuServiceCB cb) { … }
void GpuServiceImpl::SetMjpegDecodeAcceleratorBeginFrameCB(
std::optional<base::RepeatingClosure> cb) { … }
#if BUILDFLAG(IS_WIN)
void GpuServiceImpl::OnOverlayCapsChanged() {
gpu::OverlayInfo old_overlay_info = gpu_info_.overlay_info;
gpu::CollectHardwareOverlayInfo(&gpu_info_.overlay_info);
if (old_overlay_info != gpu_info_.overlay_info)
gpu_host_->DidUpdateOverlayInfo(gpu_info_.overlay_info);
auto old_dxgi_info = std::move(dxgi_info_);
dxgi_info_ = gl::GetDirectCompositionHDRMonitorDXGIInfo();
if (!mojo::Equals(dxgi_info_, old_dxgi_info)) {
gpu_host_->DidUpdateDXGIInfo(dxgi_info_.Clone());
}
}
#endif
bool GpuServiceImpl::IsNativeBufferSupported(gfx::BufferFormat format,
gfx::BufferUsage usage) { … }
GpuServiceImpl::ClientGmbInterfaceImpl::PendingBufferInfo::PendingBufferInfo() =
default;
GpuServiceImpl::ClientGmbInterfaceImpl::PendingBufferInfo::PendingBufferInfo(
PendingBufferInfo&&) = default;
GpuServiceImpl::ClientGmbInterfaceImpl::PendingBufferInfo::
~PendingBufferInfo() = default;
GpuServiceImpl::ClientGmbInterfaceImpl::ClientGmbInterfaceImpl(
int client_id,
mojo::PendingReceiver<gpu::mojom::ClientGmbInterface> pending_receiver,
raw_ptr<GpuServiceImpl> gpu_service,
scoped_refptr<base::SingleThreadTaskRunner> io_runner)
: … { … }
GpuServiceImpl::ClientGmbInterfaceImpl::~ClientGmbInterfaceImpl() { … }
void GpuServiceImpl::ClientGmbInterfaceImpl::CreateGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
gpu::SurfaceHandle surface_handle,
CreateGpuMemoryBufferCallback callback) { … }
void GpuServiceImpl::ClientGmbInterfaceImpl::DestroyGpuMemoryBuffer(
gfx::GpuMemoryBufferId id) { … }
void GpuServiceImpl::ClientGmbInterfaceImpl::CopyGpuMemoryBuffer(
gfx::GpuMemoryBufferHandle buffer_handle,
base::UnsafeSharedMemoryRegion shared_memory,
CopyGpuMemoryBufferCallback callback) { … }
bool GpuServiceImpl::ClientGmbInterfaceImpl::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) { … }
void GpuServiceImpl::ClientGmbInterfaceImpl::OnConnectionError() { … }
void GpuServiceImpl::ClientGmbInterfaceImpl::OnGpuMemoryBufferAllocated(
gfx::GpuMemoryBufferId id,
gfx::GpuMemoryBufferHandle handle) { … }
void GpuServiceImpl::ClientGmbInterfaceImpl::DestroyAllGpuMemoryBuffers() { … }
void GpuServiceImpl::GetDawnInfo(bool collect_metrics,
GetDawnInfoCallback callback) { … }
BASE_FEATURE(…);
BASE_FEATURE(…);
void GpuServiceImpl::GetDawnInfoOnMain(bool collect_metrics,
GetDawnInfoCallback callback) { … }
void GpuServiceImpl::RemoveGmbClient(int client_id) { … }
#if BUILDFLAG(IS_ANDROID)
void GpuServiceImpl::SetHostProcessId(base::ProcessId pid) {
host_process_id_ = pid;
}
#endif
GpuServiceImpl::InitParams::InitParams() = default;
GpuServiceImpl::InitParams::InitParams(InitParams&& other) = default;
GpuServiceImpl::InitParams& GpuServiceImpl::InitParams::operator=(
InitParams&& other) = default;
GpuServiceImpl::InitParams::~InitParams() = default;
}