Commit 3d3e44d2 authored by Maggie Chen's avatar Maggie Chen Committed by Commit Bot

Separate GpuInfoService from GpuService

GpuInfoService is used for GPU info collection and is running on the
short-lived info-collection GPU process only.
This CL separates GpuInfoService from the regular GpuService because it
is not running on the same GPU process.

Bug:1048903

Change-Id: I6f11cbfec8b17d4e5c4ac9865b26542aa6dd619d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2154388Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762068}
parent 87325a77
......@@ -100,6 +100,16 @@ GpuHostImpl::GpuHostImpl(Delegate* delegate,
viz_main_(std::move(viz_main)),
params_(std::move(params)),
host_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
// Create a special GPU info collection service if the GPU process is used for
// info collection only.
#if defined(OS_WIN)
if (params.info_collection_gpu_process) {
viz_main_->CreateInfoCollectionGpuService(
info_collection_gpu_service_remote_.BindNewPipeAndPassReceiver());
return;
}
#endif
DCHECK(delegate_);
mojo::PendingRemote<discardable_memory::mojom::DiscardableSharedMemoryManager>
......@@ -273,6 +283,14 @@ mojom::GpuService* GpuHostImpl::gpu_service() {
return gpu_service_remote_.get();
}
#if defined(OS_WIN)
mojom::InfoCollectionGpuService* GpuHostImpl::info_collection_gpu_service() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(info_collection_gpu_service_remote_.is_bound());
return info_collection_gpu_service_remote_.get();
}
#endif
#if defined(USE_OZONE)
void GpuHostImpl::InitOzone() {
......
......@@ -40,6 +40,10 @@
#include "services/viz/privileged/mojom/viz_main.mojom.h"
#include "url/gurl.h"
#if defined(OS_WIN)
#include "services/viz/privileged/mojom/gl/info_collection_gpu_service.mojom.h"
#endif
namespace gfx {
struct FontRenderParams;
}
......@@ -120,6 +124,9 @@ class VIZ_HOST_EXPORT GpuHostImpl : public mojom::GpuHost {
// Task runner corresponding to the main thread.
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner;
// Whether this GPU process is used for GPU info collection only.
bool info_collection_gpu_process = false;
};
enum class EstablishChannelStatus {
......@@ -180,6 +187,10 @@ class VIZ_HOST_EXPORT GpuHostImpl : public mojom::GpuHost {
mojom::GpuService* gpu_service();
#if defined(OS_WIN)
mojom::InfoCollectionGpuService* info_collection_gpu_service();
#endif
bool wake_up_gpu_before_drawing() const {
return wake_up_gpu_before_drawing_;
}
......@@ -242,6 +253,10 @@ class VIZ_HOST_EXPORT GpuHostImpl : public mojom::GpuHost {
scoped_refptr<base::SingleThreadTaskRunner> host_thread_task_runner_;
mojo::Remote<mojom::GpuService> gpu_service_remote_;
#if defined(OS_WIN)
mojo::Remote<mojom::InfoCollectionGpuService>
info_collection_gpu_service_remote_;
#endif
mojo::Receiver<mojom::GpuHost> gpu_host_receiver_{this};
gpu::GpuProcessHostActivityFlags activity_flags_;
......
......@@ -144,15 +144,6 @@ class TestGpuService : public mojom::GpuService {
void GetPeakMemoryUsage(uint32_t sequence_num,
GetPeakMemoryUsageCallback callback) override {}
#if defined(OS_WIN)
void RequestCompleteGpuInfo(
RequestCompleteGpuInfoCallback callback) override {}
void GetGpuSupportedRuntimeVersionAndDevicePerfInfo(
GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback)
override {}
#endif
void RequestHDRStatus(RequestHDRStatusCallback callback) override {}
void LoadedShader(int32_t client_id,
......
......@@ -368,6 +368,13 @@ viz_source_set("gpu_service_dependencies") {
deps = [ "//gpu/config" ]
if (is_win) {
sources += [
"gl/info_collection_gpu_service_impl.cc",
"gl/info_collection_gpu_service_impl.h",
]
}
if (is_chromeos) {
deps += [
"//components/arc/video_accelerator",
......
......@@ -270,7 +270,6 @@ GpuServiceImpl::GpuServiceImpl(
const base::Optional<gpu::GpuFeatureInfo>&
gpu_feature_info_for_hardware_gpu,
const gpu::GpuExtraInfo& gpu_extra_info,
const base::Optional<gpu::DevicePerfInfo>& device_perf_info,
gpu::VulkanImplementation* vulkan_implementation,
base::OnceCallback<void(bool /*immediately*/)> exit_callback)
: main_runner_(base::ThreadTaskRunnerHandle::Get()),
......@@ -282,7 +281,6 @@ GpuServiceImpl::GpuServiceImpl(
gpu_info_for_hardware_gpu_(gpu_info_for_hardware_gpu),
gpu_feature_info_for_hardware_gpu_(gpu_feature_info_for_hardware_gpu),
gpu_extra_info_(gpu_extra_info),
device_perf_info_(device_perf_info),
#if BUILDFLAG(ENABLE_VULKAN)
vulkan_implementation_(vulkan_implementation),
#endif
......@@ -698,54 +696,6 @@ void GpuServiceImpl::GetPeakMemoryUsage(uint32_t sequence_num,
weak_ptr_, sequence_num, std::move(callback)));
}
#if defined(OS_WIN)
void GpuServiceImpl::GetGpuSupportedRuntimeVersionAndDevicePerfInfo(
GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback) {
if (io_runner_->BelongsToCurrentThread()) {
auto wrap_callback = WrapCallback(io_runner_, std::move(callback));
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&GpuServiceImpl::GetGpuSupportedRuntimeVersionAndDevicePerfInfo,
weak_ptr_, std::move(wrap_callback)));
return;
}
DCHECK(main_runner_->BelongsToCurrentThread());
// GPU full info collection should only happen on un-sandboxed GPU process
// or single process/in-process gpu mode on Windows.
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
DCHECK(command_line->HasSwitch("disable-gpu-sandbox") || in_host_process());
gpu::RecordGpuSupportedRuntimeVersionHistograms(
&gpu_info_.dx12_vulkan_version_info);
DCHECK(device_perf_info_.has_value());
std::move(callback).Run(gpu_info_.dx12_vulkan_version_info,
device_perf_info_.value());
}
void GpuServiceImpl::RequestCompleteGpuInfo(
RequestCompleteGpuInfoCallback callback) {
if (io_runner_->BelongsToCurrentThread()) {
auto wrap_callback = WrapCallback(io_runner_, std::move(callback));
main_runner_->PostTask(
FROM_HERE, base::BindOnce(&GpuServiceImpl::RequestCompleteGpuInfo,
weak_ptr_, std::move(wrap_callback)));
return;
}
DCHECK(main_runner_->BelongsToCurrentThread());
UpdateGpuInfoPlatform(base::BindOnce(
IgnoreResult(&base::TaskRunner::PostTask), main_runner_, FROM_HERE,
base::BindOnce(
[](GpuServiceImpl* gpu_service,
RequestCompleteGpuInfoCallback callback) {
std::move(callback).Run(gpu_service->gpu_info_.dx_diagnostics);
},
this, std::move(callback))));
}
#endif
void GpuServiceImpl::RequestHDRStatus(RequestHDRStatusCallback callback) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
......@@ -764,42 +714,6 @@ void GpuServiceImpl::RequestHDRStatusOnMainThread(
base::BindOnce(std::move(callback), hdr_enabled));
}
#if defined(OS_WIN)
void GpuServiceImpl::UpdateGpuInfoPlatform(
base::OnceClosure on_gpu_info_updated) {
DCHECK(main_runner_->BelongsToCurrentThread());
// GPU full info collection should only happen on un-sandboxed GPU process
// or single process/in-process gpu mode on Windows.
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
DCHECK(command_line->HasSwitch("disable-gpu-sandbox") || in_host_process());
// We can continue on shutdown here because we're not writing any critical
// state in this task.
base::PostTaskAndReplyWithResult(
base::ThreadPool::CreateCOMSTATaskRunner(
{base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})
.get(),
FROM_HERE, base::BindOnce([]() {
gpu::DxDiagNode dx_diag_node;
gpu::GetDxDiagnostics(&dx_diag_node);
return dx_diag_node;
}),
base::BindOnce(
[](GpuServiceImpl* gpu_service, base::OnceClosure on_gpu_info_updated,
const gpu::DxDiagNode& dx_diag_node) {
gpu_service->gpu_info_.dx_diagnostics = dx_diag_node;
std::move(on_gpu_info_updated).Run();
},
this, std::move(on_gpu_info_updated)));
}
#else
void GpuServiceImpl::UpdateGpuInfoPlatform(
base::OnceClosure on_gpu_info_updated) {
std::move(on_gpu_info_updated).Run();
}
#endif
void GpuServiceImpl::RegisterDisplayContext(
gpu::DisplayContext* display_context) {
DCHECK(main_runner_->BelongsToCurrentThread());
......
......@@ -22,7 +22,6 @@
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "gpu/command_buffer/common/activity_flags.h"
#include "gpu/command_buffer/service/sequence_id.h"
#include "gpu/config/device_perf_info.h"
#include "gpu/config/gpu_extra_info.h"
#include "gpu/config/gpu_info.h"
#include "gpu/config/gpu_preferences.h"
......@@ -88,7 +87,6 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
const base::Optional<gpu::GpuFeatureInfo>&
gpu_feature_info_for_hardware_gpu,
const gpu::GpuExtraInfo& gpu_extra_info,
const base::Optional<gpu::DevicePerfInfo>& device_perf_info,
gpu::VulkanImplementation* vulkan_implementation,
base::OnceCallback<void(bool /*immediately*/)> exit_callback);
......@@ -160,11 +158,6 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
void GetPeakMemoryUsage(uint32_t sequence_num,
GetPeakMemoryUsageCallback callback) override;
#if defined(OS_WIN)
void RequestCompleteGpuInfo(RequestCompleteGpuInfoCallback callback) override;
void GetGpuSupportedRuntimeVersionAndDevicePerfInfo(
GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback) override;
#endif
void RequestHDRStatus(RequestHDRStatusCallback callback) override;
void LoadedShader(int32_t client_id,
const std::string& key,
......@@ -309,8 +302,6 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
const std::string& header,
const std::string& message);
void UpdateGpuInfoPlatform(base::OnceClosure on_gpu_info_updated);
#if defined(OS_CHROMEOS)
void CreateArcVideoDecodeAcceleratorOnMainThread(
mojo::PendingReceiver<arc::mojom::VideoDecodeAccelerator> vda_receiver);
......@@ -367,10 +358,6 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
// Information about the GPU process populated on creation.
gpu::GpuExtraInfo gpu_extra_info_;
// Information related to device perf category, only collected on the second
// unsandboxed GPU process.
base::Optional<gpu::DevicePerfInfo> device_perf_info_;
mojo::SharedRemote<mojom::GpuHost> gpu_host_;
std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_;
std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_;
......
......@@ -73,7 +73,6 @@ class GpuServiceTest : public testing::Test {
gpu_info, /*watchdog_thread=*/nullptr, io_thread_.task_runner(),
gpu::GpuFeatureInfo(), gpu::GpuPreferences(), gpu::GPUInfo(),
gpu::GpuFeatureInfo(), gpu::GpuExtraInfo(),
/*device_perf_info=*/base::nullopt,
/*vulkan_implementation=*/nullptr,
/*exit_callback=*/base::DoNothing());
}
......
// Copyright 2020 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 "components/viz/service/gl/info_collection_gpu_service_impl.h"
#include "base/task/post_task.h"
#include "base/task_runner_util.h"
#include "gpu/config/dx_diag_node.h"
#include "gpu/config/gpu_info_collector.h"
namespace viz {
InfoCollectionGpuServiceImpl::InfoCollectionGpuServiceImpl(
scoped_refptr<base::SingleThreadTaskRunner> main_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
const gpu::DevicePerfInfo& device_perf_info,
mojo::PendingReceiver<mojom::InfoCollectionGpuService> pending_receiver)
: main_runner_(std::move(main_runner)),
io_runner_(std::move(io_runner)),
device_perf_info_(device_perf_info) {
DCHECK(!io_runner_->BelongsToCurrentThread());
DCHECK(main_runner_->BelongsToCurrentThread());
io_runner_->PostTask(
FROM_HERE,
base::BindOnce(&InfoCollectionGpuServiceImpl::BindOnIO,
base::Unretained(this), std::move(pending_receiver)));
}
InfoCollectionGpuServiceImpl::~InfoCollectionGpuServiceImpl() {
// Info Collection GPU process exits atomically.
NOTREACHED();
}
void InfoCollectionGpuServiceImpl::BindOnIO(
mojo::PendingReceiver<mojom::InfoCollectionGpuService> pending_receiver) {
DCHECK(io_runner_->BelongsToCurrentThread());
DCHECK(!receiver_.is_bound());
receiver_.Bind(std::move(pending_receiver));
}
void InfoCollectionGpuServiceImpl::
GetGpuSupportedRuntimeVersionAndDevicePerfInfo(
GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(&InfoCollectionGpuServiceImpl::
GetGpuSupportedRuntimeVersionAndDevicePerfInfoOnMain,
base::Unretained(this), std::move(callback)));
}
void InfoCollectionGpuServiceImpl::
GetGpuSupportedRuntimeVersionAndDevicePerfInfoOnMain(
GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback) {
DCHECK(main_runner_->BelongsToCurrentThread());
gpu::Dx12VulkanVersionInfo dx12_vulkan_version_info;
gpu::RecordGpuSupportedRuntimeVersionHistograms(&dx12_vulkan_version_info);
io_runner_->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), dx12_vulkan_version_info,
device_perf_info_));
}
void InfoCollectionGpuServiceImpl::RequestDxDiagNodeInfo(
RequestDxDiagNodeInfoCallback callback) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(&InfoCollectionGpuServiceImpl::RequestDxDiagNodeInfoOnMain,
base::Unretained(this), std::move(callback)));
}
void InfoCollectionGpuServiceImpl::RequestDxDiagNodeInfoOnMain(
RequestDxDiagNodeInfoCallback callback) {
DCHECK(main_runner_->BelongsToCurrentThread());
// We can continue on shutdown here because we're not writing any critical
// state in this task.
base::PostTaskAndReplyWithResult(
base::ThreadPool::CreateCOMSTATaskRunner(
{base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})
.get(),
FROM_HERE, base::BindOnce([]() {
gpu::DxDiagNode dx_diag_node;
gpu::GetDxDiagnostics(&dx_diag_node);
return dx_diag_node;
}),
base::BindOnce(
[](RequestDxDiagNodeInfoCallback callback,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
const gpu::DxDiagNode& dx_diag_node) {
io_runner->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), dx_diag_node));
},
std::move(callback), io_runner_));
}
} // namespace viz
// Copyright 2020 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 COMPONENTS_VIZ_SERVICE_GL_INFO_COLLECTION_GPU_SERVICE_IMPL_H_
#define COMPONENTS_VIZ_SERVICE_GL_INFO_COLLECTION_GPU_SERVICE_IMPL_H_
#include "base/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/single_thread_task_runner.h"
#include "build/build_config.h"
#include "components/viz/service/viz_service_export.h"
#include "gpu/config/device_perf_info.h"
#include "gpu/config/gpu_info.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/viz/privileged/mojom/gl/info_collection_gpu_service.mojom.h"
namespace viz {
// This runs in the info-collection GPU process, and communicates with the gpu
// host (which is the window server) over the mojom APIs. This is responsible
// for setting up the connection to clients
class VIZ_SERVICE_EXPORT InfoCollectionGpuServiceImpl
: public mojom::InfoCollectionGpuService {
public:
InfoCollectionGpuServiceImpl(
scoped_refptr<base::SingleThreadTaskRunner> main_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
const gpu::DevicePerfInfo& device_perf_info,
mojo::PendingReceiver<mojom::InfoCollectionGpuService> pending_receiver);
~InfoCollectionGpuServiceImpl() override;
void RequestDxDiagNodeInfo(RequestDxDiagNodeInfoCallback callback) override;
void GetGpuSupportedRuntimeVersionAndDevicePerfInfo(
GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback) override;
private:
void BindOnIO(
mojo::PendingReceiver<mojom::InfoCollectionGpuService> pending_receiver);
void RequestDxDiagNodeInfoOnMain(RequestDxDiagNodeInfoCallback callback);
void GetGpuSupportedRuntimeVersionAndDevicePerfInfoOnMain(
GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback);
scoped_refptr<base::SingleThreadTaskRunner> main_runner_;
scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
// Information related to device perf category, only collected on the second
// unsandboxed GPU process.
const gpu::DevicePerfInfo device_perf_info_;
// Should only be accessed on the IO thread after creation.
mojo::Receiver<mojom::InfoCollectionGpuService> receiver_{this};
DISALLOW_COPY_AND_ASSIGN(InfoCollectionGpuServiceImpl);
};
} // namespace viz
#endif // COMPONENTS_VIZ_SERVICE_GL_INFO_COLLECTION_GPU_SERVICE_IMPL_H_
......@@ -99,8 +99,7 @@ VizMainImpl::VizMainImpl(Delegate* delegate,
gpu_init_->gpu_feature_info(), gpu_init_->gpu_preferences(),
gpu_init_->gpu_info_for_hardware_gpu(),
gpu_init_->gpu_feature_info_for_hardware_gpu(),
gpu_init_->gpu_extra_info(), gpu_init_->device_perf_info(),
gpu_init_->vulkan_implementation(),
gpu_init_->gpu_extra_info(), gpu_init_->vulkan_implementation(),
base::BindOnce(&VizMainImpl::ExitProcess, base::Unretained(this)));
}
......@@ -192,6 +191,19 @@ void VizMainImpl::CreateGpuService(
delegate_->OnGpuServiceConnection(gpu_service_.get());
}
#if defined(OS_WIN)
void VizMainImpl::CreateInfoCollectionGpuService(
mojo::PendingReceiver<mojom::InfoCollectionGpuService> pending_receiver) {
DCHECK(gpu_thread_task_runner_->BelongsToCurrentThread());
DCHECK(!info_collection_gpu_service_);
DCHECK(gpu_init_->device_perf_info().has_value());
info_collection_gpu_service_ = std::make_unique<InfoCollectionGpuServiceImpl>(
gpu_thread_task_runner_, io_task_runner(),
gpu_init_->device_perf_info().value(), std::move(pending_receiver));
}
#endif
void VizMainImpl::CreateFrameSinkManager(
mojom::FrameSinkManagerParamsPtr params) {
DCHECK(viz_compositor_thread_runner_);
......
......@@ -13,6 +13,7 @@
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "components/discardable_memory/client/client_discardable_shared_memory_manager.h"
#include "components/viz/service/gl/gpu_service_impl.h"
#include "components/viz/service/main/viz_compositor_thread_runner_impl.h"
#include "gpu/ipc/gpu_in_process_thread_service.h"
#include "gpu/ipc/in_process_command_buffer.h"
......@@ -25,6 +26,11 @@
#include "services/viz/privileged/mojom/viz_main.mojom.h"
#include "ui/gfx/font_render_params.h"
#if defined(OS_WIN)
#include "components/viz/service/gl/info_collection_gpu_service_impl.h"
#include "services/viz/privileged/mojom/gl/info_collection_gpu_service.mojom.h"
#endif
namespace base {
class PowerMonitorSource;
}
......@@ -41,6 +47,9 @@ class MojoUkmRecorder;
namespace viz {
class GpuServiceImpl;
#if defined(OS_WIN)
class InfoCollectionGpuServiceImpl;
#endif
class VizMainImpl : public mojom::VizMain,
public gpu::GpuInProcessThreadServiceDelegate {
......@@ -110,6 +119,11 @@ class VizMainImpl : public mojom::VizMain,
discardable_memory_manager,
mojo::ScopedSharedBufferHandle activity_flags,
gfx::FontRenderParams::SubpixelRendering subpixel_rendering) override;
#if defined(OS_WIN)
void CreateInfoCollectionGpuService(
mojo::PendingReceiver<mojom::InfoCollectionGpuService> pending_receiver)
override;
#endif
void CreateFrameSinkManager(mojom::FrameSinkManagerParamsPtr params) override;
void CreateVizDevTools(mojom::VizDevToolsParamsPtr params) override;
......@@ -149,6 +163,9 @@ class VizMainImpl : public mojom::VizMain,
std::unique_ptr<gpu::GpuInit> gpu_init_;
std::unique_ptr<GpuServiceImpl> gpu_service_;
#if defined(OS_WIN)
std::unique_ptr<InfoCollectionGpuServiceImpl> info_collection_gpu_service_;
#endif
// Allows the display compositor to use InProcessCommandBuffer to send GPU
// commands to the GPU thread from the compositor thread. This must outlive
......
......@@ -225,7 +225,6 @@ void TestGpuServiceHolder::InitializeOnGpuThread(
/*gpu_info_for_hardware_gpu=*/gpu::GPUInfo(),
/*gpu_feature_info_for_hardware_gpu=*/gpu::GpuFeatureInfo(),
/*gpu_extra_info=*/gpu::GpuExtraInfo(),
/*device_perf_info=*/base::nullopt,
#if BUILDFLAG(ENABLE_VULKAN)
vulkan_implementation_.get(),
#else
......
......@@ -642,7 +642,7 @@ void GpuDataManagerImplPrivate::RequestDxDiagNodeData() {
}
manager->UpdateDxDiagNodeRequestStatus(true);
host->gpu_service()->RequestCompleteGpuInfo(
host->info_collection_gpu_service()->RequestDxDiagNodeInfo(
base::BindOnce([](const gpu::DxDiagNode& dx_diagnostics) {
GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
manager->UpdateDxDiagNode(dx_diagnostics);
......@@ -699,8 +699,8 @@ void GpuDataManagerImplPrivate::RequestGpuSupportedRuntimeVersion(
}
manager->UpdateDx12VulkanRequestStatus(true);
host->gpu_service()->GetGpuSupportedRuntimeVersionAndDevicePerfInfo(
base::BindOnce(
host->info_collection_gpu_service()
->GetGpuSupportedRuntimeVersionAndDevicePerfInfo(base::BindOnce(
[](const gpu::Dx12VulkanVersionInfo& dx12_vulkan_info,
const gpu::DevicePerfInfo& device_perf_info) {
GpuDataManagerImpl* manager =
......
......@@ -860,6 +860,8 @@ bool GpuProcessHost::Init() {
switches::GetDeadlineToSynchronizeSurfaces();
params.main_thread_task_runner =
base::CreateSingleThreadTaskRunner({BrowserThread::UI});
params.info_collection_gpu_process =
kind_ == GPU_PROCESS_KIND_INFO_COLLECTION;
gpu_host_ = std::make_unique<viz::GpuHostImpl>(
this, std::move(viz_main_pending_remote), std::move(params));
......@@ -1243,6 +1245,14 @@ viz::mojom::GpuService* GpuProcessHost::gpu_service() {
return gpu_host_->gpu_service();
}
#if defined(OS_WIN)
viz::mojom::InfoCollectionGpuService*
GpuProcessHost::info_collection_gpu_service() {
DCHECK(gpu_host_);
return gpu_host_->info_collection_gpu_service();
}
#endif
int GpuProcessHost::GetIDForTesting() const {
return process_->GetData().id;
}
......
......@@ -42,6 +42,10 @@
#include "services/viz/privileged/mojom/viz_main.mojom.h"
#include "url/gurl.h"
#if defined(OS_WIN)
#include "services/viz/privileged/mojom/gl/info_collection_gpu_service.mojom.h"
#endif
#if BUILDFLAG(USE_VIZ_DEVTOOLS)
#include "content/browser/gpu/viz_devtools_connector.h"
#endif
......@@ -106,6 +110,11 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate,
CONTENT_EXPORT viz::mojom::GpuService* gpu_service();
#if defined(OS_WIN)
CONTENT_EXPORT viz::mojom::InfoCollectionGpuService*
info_collection_gpu_service();
#endif
CONTENT_EXPORT int GetIDForTesting() const;
viz::GpuHostImpl* gpu_host() { return gpu_host_.get(); }
......
......@@ -99,13 +99,6 @@ class TestGpuService : public viz::mojom::GpuService {
const gpu::SyncToken& sync_token) override {}
void GetVideoMemoryUsageStats(
GetVideoMemoryUsageStatsCallback callback) override {}
#if defined(OS_WIN)
void RequestCompleteGpuInfo(
RequestCompleteGpuInfoCallback callback) override {}
void GetGpuSupportedRuntimeVersionAndDevicePerfInfo(
GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback)
override {}
#endif
void RequestHDRStatus(RequestHDRStatusCallback callback) override {}
void LoadedShader(int32_t client_id,
const std::string& key,
......
......@@ -26,6 +26,10 @@ mojom("gl") {
]
}
if (is_win) {
sources += [ "info_collection_gpu_service.mojom" ]
}
enabled_features = []
if (!is_android) {
enabled_features += [ "is_not_android" ]
......
......@@ -102,21 +102,6 @@ interface GpuService {
map<gpu.mojom.GpuPeakMemoryAllocationSource, uint64>
memory_per_allocation_source);
[EnableIf=is_win]
RequestCompleteGpuInfo() => (gpu.mojom.DxDiagNode dx_diagnostics);
// Requests Vulkan and DX12 supports and device performance info on Windows.
// Returning whether Vulkan and DX12 are supported, and if yes, the
// supported version/feature level, together with a few metrics related
// to the device's performance for about:gpu and histogram recording
// purpose.
// TODO(crbug.com/1028263): histograms need to be recorded at browser process
// for now.
[EnableIf=is_win]
GetGpuSupportedRuntimeVersionAndDevicePerfInfo()
=> (gpu.mojom.Dx12VulkanVersionInfo dx12_vulkan_version_info,
gpu.mojom.DevicePerfInfo device_perf_info);
// Requests that the GPU process query system availability of HDR output and
// return it.
RequestHDRStatus() => (bool hdr_enabled);
......
// Copyright 2020 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.
module viz.mojom;
import "gpu/ipc/common/device_perf_info.mojom";
import "gpu/ipc/common/dx_diag_node.mojom";
import "gpu/ipc/common/gpu_info.mojom";
// This InfoCollectionGpuService is provided by the info-collection GPU process.
interface InfoCollectionGpuService {
// Requests DX diagnostic data on Windows for about:gpu.
[EnableIf=is_win]
RequestDxDiagNodeInfo() => (gpu.mojom.DxDiagNode dx_diagnostics);
// Requests Vulkan and DX12 supports and device performance info on Windows.
// Returning whether Vulkan and DX12 are supported, and if yes, the
// supported version/feature level, together with a few metrics related
// to the device's performance for about:gpu and histogram recording
// purpose.
// TODO(crbug.com/1028263): histograms need to be recorded at browser process
// for now.
[EnableIf=is_win]
GetGpuSupportedRuntimeVersionAndDevicePerfInfo()
=> (gpu.mojom.Dx12VulkanVersionInfo dx12_vulkan_version_info,
gpu.mojom.DevicePerfInfo device_perf_info);
};
......@@ -9,6 +9,8 @@ import "services/network/public/mojom/tcp_socket.mojom";
import "services/viz/public/mojom/compositing/compositing_mode_watcher.mojom";
import "services/viz/privileged/mojom/compositing/frame_sink_manager.mojom";
import "services/viz/privileged/mojom/gl/gpu_host.mojom";
[EnableIf=is_win]
import "services/viz/privileged/mojom/gl/info_collection_gpu_service.mojom";
import "services/viz/privileged/mojom/gl/gpu_service.mojom";
import "ui/gfx/mojom/font_render_params.mojom";
......@@ -50,6 +52,12 @@ interface VizMain {
handle<shared_buffer>? activity_flags,
gfx.mojom.SubpixelRendering subpixel_rendering);
// Create a GPU info collection service provided by the info-collection GPU
// process.
[EnableIf=is_win]
CreateInfoCollectionGpuService(
pending_receiver<InfoCollectionGpuService> info_collection_gpu_service);
// The viz devtools server is for use by developers to observe the
// FrameSinkManager in the viz compositor. This is only called if the flag
// --enable-viz-devtools is used.
......
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