Commit 403310d4 authored by Maggie Chen's avatar Maggie Chen Committed by Commit Bot

Adding a callback function to the DX12/Vulkan info collection path for the gpu info update

The callback function UpdateGpuInfoOnIO is added to the DX12/Vulkan info collection path. The data
is now saved in gpu_info of the browser process.

Both DX12 and Vulkan info collection functions are removed from the about:gpu path. The data can
be found in the gpu info. There is no need to call these two functions again.

BUG=775983
TEST=manual,Chrome://histograms
R=zmo@chromium.org

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I6716aed172c8c6821f60124fb9cedc0c2e2b5079
Reviewed-on: https://chromium-review.googlesource.com/1026946Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553910}
parent ae2469c0
......@@ -106,7 +106,8 @@ class TestGpuService : public mojom::GpuService {
void RequestCompleteGpuInfo(
RequestCompleteGpuInfoCallback callback) override {}
void GetGpuSupportedRuntimeVersion() override {}
void GetGpuSupportedRuntimeVersion(
GetGpuSupportedRuntimeVersionCallback callback) override {}
void RequestHDRStatus(RequestHDRStatusCallback callback) override {}
......
......@@ -442,13 +442,15 @@ void GpuServiceImpl::GetVideoMemoryUsageStats(
}
// Currently, this function only supports the Windows platform.
void GpuServiceImpl::GetGpuSupportedRuntimeVersion() {
void GpuServiceImpl::GetGpuSupportedRuntimeVersion(
GetGpuSupportedRuntimeVersionCallback callback) {
#if defined(OS_WIN)
if (io_runner_->BelongsToCurrentThread()) {
auto wrap_callback = WrapCallback(io_runner_, std::move(callback));
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(&GpuServiceImpl::GetGpuSupportedRuntimeVersion,
weak_ptr_));
weak_ptr_, std::move(wrap_callback)));
return;
}
DCHECK(main_runner_->BelongsToCurrentThread());
......@@ -459,6 +461,7 @@ void GpuServiceImpl::GetGpuSupportedRuntimeVersion() {
DCHECK(command_line->HasSwitch("disable-gpu-sandbox") || in_host_process());
gpu::RecordGpuSupportedRuntimeVersionHistograms(&gpu_info_);
std::move(callback).Run(gpu_info_);
if (!in_host_process()) {
// The unsandboxed GPU process fulfilled its duty. Rest
// in peace.
......@@ -541,9 +544,6 @@ void GpuServiceImpl::UpdateGpuInfoPlatform(
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
DCHECK(command_line->HasSwitch("disable-gpu-sandbox") || in_host_process());
gpu::GetGpuSupportedD3D12Version(&gpu_info_);
gpu::GetGpuSupportedVulkanVersion(&gpu_info_);
// We can continue on shutdown here because we're not writing any critical
// state in this task.
base::PostTaskAndReplyWithResult(
......
......@@ -187,7 +187,8 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
void GetVideoMemoryUsageStats(
GetVideoMemoryUsageStatsCallback callback) override;
void RequestCompleteGpuInfo(RequestCompleteGpuInfoCallback callback) override;
void GetGpuSupportedRuntimeVersion() override;
void GetGpuSupportedRuntimeVersion(
GetGpuSupportedRuntimeVersionCallback callback) override;
void RequestHDRStatus(RequestHDRStatusCallback callback) override;
void LoadedShader(const std::string& key, const std::string& data) override;
void DestroyingVideoSurface(int32_t surface_id,
......
......@@ -362,7 +362,8 @@ void GpuDataManagerImplPrivate::RequestGpuSupportedRuntimeVersion() {
GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, true /* force_create */);
if (!host)
return;
host->gpu_service()->GetGpuSupportedRuntimeVersion();
host->gpu_service()->GetGpuSupportedRuntimeVersion(
base::BindOnce(&UpdateGpuInfoOnIO));
});
BrowserThread::PostDelayedTask(BrowserThread::IO, FROM_HERE, std::move(task),
......
......@@ -40,8 +40,6 @@ GPU_EXPORT bool CollectContextGraphicsInfo(GPUInfo* gpu_info);
// Collect the DirectX Disagnostics information about the attached displays.
GPU_EXPORT bool GetDxDiagnostics(DxDiagNode* output);
GPU_EXPORT void RecordGpuSupportedRuntimeVersionHistograms(GPUInfo* gpu_info);
GPU_EXPORT void GetGpuSupportedD3D12Version(GPUInfo* gpu_info);
GPU_EXPORT void GetGpuSupportedVulkanVersion(GPUInfo* gpu_info);
#endif // OS_WIN
// Create a GL context and collect GL strings and versions.
......
......@@ -228,6 +228,8 @@ bool StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo>::Read(
#endif
#if defined(OS_WIN)
out->supports_dx12 = data.supports_dx12();
out->supports_vulkan = data.supports_vulkan();
out->d3d12_feature_level = data.d3d12_feature_level();
out->vulkan_version = data.vulkan_version();
#endif
......
......@@ -72,7 +72,7 @@ interface GpuService {
GetVideoMemoryUsageStats() => (gpu.mojom.VideoMemoryUsageStats stats);
RequestCompleteGpuInfo() => (gpu.mojom.GpuInfo gpu_info);
GetGpuSupportedRuntimeVersion();
GetGpuSupportedRuntimeVersion() => (gpu.mojom.GpuInfo gpu_info);
// Requests that the GPU process query system availability of HDR output and
// return it.
......
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