summaryrefslogtreecommitdiff
path: root/chromium/components/viz/service/gl
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/viz/service/gl')
-rw-r--r--chromium/components/viz/service/gl/gpu_service_impl.cc39
-rw-r--r--chromium/components/viz/service/gl/gpu_service_impl.h9
-rw-r--r--chromium/components/viz/service/gl/info_collection_gpu_service_impl.cc46
-rw-r--r--chromium/components/viz/service/gl/info_collection_gpu_service_impl.h19
4 files changed, 78 insertions, 35 deletions
diff --git a/chromium/components/viz/service/gl/gpu_service_impl.cc b/chromium/components/viz/service/gl/gpu_service_impl.cc
index df961f12be1..98cdbff9bf0 100644
--- a/chromium/components/viz/service/gl/gpu_service_impl.cc
+++ b/chromium/components/viz/service/gl/gpu_service_impl.cc
@@ -405,6 +405,13 @@ GpuServiceImpl::GpuServiceImpl(
}
#endif
+#if defined(OS_WIN)
+ auto info_callback = base::BindRepeating(
+ &GpuServiceImpl::UpdateOverlayAndHDRInfo, weak_ptr_factory_.GetWeakPtr());
+ gl::DirectCompositionSurfaceWin::SetOverlayHDRGpuInfoUpdateCallback(
+ info_callback);
+#endif
+
gpu_memory_buffer_factory_ =
gpu::GpuMemoryBufferFactory::CreateNativeType(vulkan_context_provider());
@@ -768,12 +775,12 @@ void GpuServiceImpl::RequestHDRStatus(RequestHDRStatusCallback callback) {
void GpuServiceImpl::RequestHDRStatusOnMainThread(
RequestHDRStatusCallback callback) {
DCHECK(main_runner_->BelongsToCurrentThread());
- bool hdr_enabled = false;
+
#if defined(OS_WIN)
- hdr_enabled = gl::DirectCompositionSurfaceWin::IsHDRSupported();
+ hdr_enabled_ = gl::DirectCompositionSurfaceWin::IsHDRSupported();
#endif
io_runner_->PostTask(FROM_HERE,
- base::BindOnce(std::move(callback), hdr_enabled));
+ base::BindOnce(std::move(callback), hdr_enabled_));
}
void GpuServiceImpl::RegisterDisplayContext(
@@ -837,6 +844,10 @@ void GpuServiceImpl::DidUpdateOverlayInfo(
const gpu::OverlayInfo& overlay_info) {
gpu_host_->DidUpdateOverlayInfo(gpu_info_.overlay_info);
}
+
+void GpuServiceImpl::DidUpdateHDRStatus(bool hdr_enabled) {
+ gpu_host_->DidUpdateHDRStatus(hdr_enabled);
+}
#endif
void GpuServiceImpl::StoreShaderToDisk(int client_id,
@@ -968,12 +979,6 @@ void GpuServiceImpl::DisplayAdded() {
if (!in_host_process())
ui::GpuSwitchingManager::GetInstance()->NotifyDisplayAdded();
-
-#if defined(OS_WIN)
- // Update overlay info in the GPU process and send the updated data back to
- // the GPU host in the Browser process through mojom if the info has changed.
- UpdateOverlayInfo();
-#endif
}
void GpuServiceImpl::DisplayRemoved() {
@@ -986,12 +991,6 @@ void GpuServiceImpl::DisplayRemoved() {
if (!in_host_process())
ui::GpuSwitchingManager::GetInstance()->NotifyDisplayRemoved();
-
-#if defined(OS_WIN)
- // Update overlay info in the GPU process and send the updated data back to
- // the GPU host in the Browser process through mojom if the info has changed.
- UpdateOverlayInfo();
-#endif
}
void GpuServiceImpl::DestroyAllChannels() {
@@ -1141,12 +1140,20 @@ gpu::Scheduler* GpuServiceImpl::GetGpuScheduler() {
}
#if defined(OS_WIN)
-void GpuServiceImpl::UpdateOverlayInfo() {
+void GpuServiceImpl::UpdateOverlayAndHDRInfo() {
gpu::OverlayInfo old_overlay_info = gpu_info_.overlay_info;
gpu::CollectHardwareOverlayInfo(&gpu_info_.overlay_info);
+ // Update overlay info in the GPU process and send the updated data back to
+ // the GPU host in the Browser process through mojom if the info has changed.
if (old_overlay_info != gpu_info_.overlay_info)
DidUpdateOverlayInfo(gpu_info_.overlay_info);
+
+ // Update HDR status in the GPU process through the GPU host mojom.
+ bool old_hdr_enabled_status = hdr_enabled_;
+ hdr_enabled_ = gl::DirectCompositionSurfaceWin::IsHDRSupported();
+ if (old_hdr_enabled_status != hdr_enabled_)
+ DidUpdateHDRStatus(hdr_enabled_);
}
#endif
diff --git a/chromium/components/viz/service/gl/gpu_service_impl.h b/chromium/components/viz/service/gl/gpu_service_impl.h
index 018be6ac2cb..90d68b30ce3 100644
--- a/chromium/components/viz/service/gl/gpu_service_impl.h
+++ b/chromium/components/viz/service/gl/gpu_service_impl.h
@@ -210,6 +210,7 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
const GURL& active_url) override;
#if defined(OS_WIN)
void DidUpdateOverlayInfo(const gpu::OverlayInfo& overlay_info) override;
+ void DidUpdateHDRStatus(bool hdr_enabled) override;
#endif
void StoreShaderToDisk(int client_id,
const std::string& key,
@@ -342,10 +343,10 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
// process. If |for_context_loss| is true an error message will be logged.
void MaybeExit(bool for_context_loss);
- // Update overlay info on the GPU process and send the updated info back
- // to the browser process if there is a change.
+ // Update overlay info and HDR status on the GPU process and send the updated
+ // info back to the browser process if there is a change.
#if defined(OS_WIN)
- void UpdateOverlayInfo();
+ void UpdateOverlayAndHDRInfo();
#endif
scoped_refptr<base::SingleThreadTaskRunner> main_runner_;
@@ -363,6 +364,8 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
// Information about general chrome feature support for the GPU.
gpu::GpuFeatureInfo gpu_feature_info_;
+ bool hdr_enabled_ = false;
+
// What we would have gotten if we haven't fallen back to SwiftShader or
// pure software (in the viz case).
base::Optional<gpu::GPUInfo> gpu_info_for_hardware_gpu_;
diff --git a/chromium/components/viz/service/gl/info_collection_gpu_service_impl.cc b/chromium/components/viz/service/gl/info_collection_gpu_service_impl.cc
index ef5bf16f6bd..f72d981d39c 100644
--- a/chromium/components/viz/service/gl/info_collection_gpu_service_impl.cc
+++ b/chromium/components/viz/service/gl/info_collection_gpu_service_impl.cc
@@ -4,6 +4,7 @@
#include "components/viz/service/gl/info_collection_gpu_service_impl.h"
+#include <utility>
#include "base/task/post_task.h"
#include "base/task_runner_util.h"
#include "gpu/config/dx_diag_node.h"
@@ -15,10 +16,12 @@ InfoCollectionGpuServiceImpl::InfoCollectionGpuServiceImpl(
scoped_refptr<base::SingleThreadTaskRunner> main_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
const gpu::DevicePerfInfo& device_perf_info,
+ const gpu::GPUInfo::GPUDevice& gpu_device,
mojo::PendingReceiver<mojom::InfoCollectionGpuService> pending_receiver)
: main_runner_(std::move(main_runner)),
io_runner_(std::move(io_runner)),
- device_perf_info_(device_perf_info) {
+ device_perf_info_(device_perf_info),
+ gpu_device_(gpu_device) {
DCHECK(!io_runner_->BelongsToCurrentThread());
DCHECK(main_runner_->BelongsToCurrentThread());
@@ -41,29 +44,48 @@ void InfoCollectionGpuServiceImpl::BindOnIO(
receiver_.Bind(std::move(pending_receiver));
}
-void InfoCollectionGpuServiceImpl::
- GetGpuSupportedRuntimeVersionAndDevicePerfInfo(
- GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback) {
+void InfoCollectionGpuServiceImpl::GetGpuSupportedDx12VersionAndDevicePerfInfo(
+ GetGpuSupportedDx12VersionAndDevicePerfInfoCallback callback) {
DCHECK(io_runner_->BelongsToCurrentThread());
main_runner_->PostTask(
FROM_HERE,
base::BindOnce(&InfoCollectionGpuServiceImpl::
- GetGpuSupportedRuntimeVersionAndDevicePerfInfoOnMain,
+ GetGpuSupportedDx12VersionAndDevicePerfInfoOnMain,
base::Unretained(this), std::move(callback)));
}
void InfoCollectionGpuServiceImpl::
- GetGpuSupportedRuntimeVersionAndDevicePerfInfoOnMain(
- GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback) {
+ GetGpuSupportedDx12VersionAndDevicePerfInfoOnMain(
+ GetGpuSupportedDx12VersionAndDevicePerfInfoCallback callback) {
DCHECK(main_runner_->BelongsToCurrentThread());
- gpu::Dx12VulkanVersionInfo dx12_vulkan_version_info;
- gpu::RecordGpuSupportedRuntimeVersionHistograms(&dx12_vulkan_version_info);
+ uint32_t d3d12_feature_level = gpu::GetGpuSupportedD3D12Version();
+ gpu::RecordGpuSupportedDx12VersionHistograms(d3d12_feature_level);
- io_runner_->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), dx12_vulkan_version_info,
- device_perf_info_));
+ io_runner_->PostTask(FROM_HERE,
+ base::BindOnce(std::move(callback), d3d12_feature_level,
+ device_perf_info_));
+}
+
+void InfoCollectionGpuServiceImpl::GetGpuSupportedVulkanVersionInfo(
+ GetGpuSupportedVulkanVersionInfoCallback callback) {
+ DCHECK(io_runner_->BelongsToCurrentThread());
+
+ main_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(
+ &InfoCollectionGpuServiceImpl::GetGpuSupportedVulkanVersionInfoOnMain,
+ base::Unretained(this), std::move(callback)));
+}
+
+void InfoCollectionGpuServiceImpl::GetGpuSupportedVulkanVersionInfoOnMain(
+ GetGpuSupportedVulkanVersionInfoCallback callback) {
+ DCHECK(main_runner_->BelongsToCurrentThread());
+
+ uint32_t vulkan_version = gpu::GetGpuSupportedVulkanVersion(gpu_device_);
+ io_runner_->PostTask(FROM_HERE,
+ base::BindOnce(std::move(callback), vulkan_version));
}
void InfoCollectionGpuServiceImpl::RequestDxDiagNodeInfo(
diff --git a/chromium/components/viz/service/gl/info_collection_gpu_service_impl.h b/chromium/components/viz/service/gl/info_collection_gpu_service_impl.h
index 82fbd8a190c..52800cabd5a 100644
--- a/chromium/components/viz/service/gl/info_collection_gpu_service_impl.h
+++ b/chromium/components/viz/service/gl/info_collection_gpu_service_impl.h
@@ -28,14 +28,18 @@ class VIZ_SERVICE_EXPORT InfoCollectionGpuServiceImpl
scoped_refptr<base::SingleThreadTaskRunner> main_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
const gpu::DevicePerfInfo& device_perf_info,
+ const gpu::GPUInfo::GPUDevice& gpu_device,
mojo::PendingReceiver<mojom::InfoCollectionGpuService> pending_receiver);
~InfoCollectionGpuServiceImpl() override;
void RequestDxDiagNodeInfo(RequestDxDiagNodeInfoCallback callback) override;
- void GetGpuSupportedRuntimeVersionAndDevicePerfInfo(
- GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback) override;
+ void GetGpuSupportedDx12VersionAndDevicePerfInfo(
+ GetGpuSupportedDx12VersionAndDevicePerfInfoCallback callback) override;
+
+ void GetGpuSupportedVulkanVersionInfo(
+ GetGpuSupportedVulkanVersionInfoCallback callback) override;
private:
void BindOnIO(
@@ -43,8 +47,11 @@ class VIZ_SERVICE_EXPORT InfoCollectionGpuServiceImpl
void RequestDxDiagNodeInfoOnMain(RequestDxDiagNodeInfoCallback callback);
- void GetGpuSupportedRuntimeVersionAndDevicePerfInfoOnMain(
- GetGpuSupportedRuntimeVersionAndDevicePerfInfoCallback callback);
+ void GetGpuSupportedDx12VersionAndDevicePerfInfoOnMain(
+ GetGpuSupportedDx12VersionAndDevicePerfInfoCallback callback);
+
+ void GetGpuSupportedVulkanVersionInfoOnMain(
+ GetGpuSupportedVulkanVersionInfoCallback callback);
scoped_refptr<base::SingleThreadTaskRunner> main_runner_;
scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
@@ -53,6 +60,10 @@ class VIZ_SERVICE_EXPORT InfoCollectionGpuServiceImpl
// unsandboxed GPU process.
const gpu::DevicePerfInfo device_perf_info_;
+ // The GPU ids and the driver version that was passed down from the browser
+ // process
+ const gpu::GPUInfo::GPUDevice gpu_device_;
+
// Should only be accessed on the IO thread after creation.
mojo::Receiver<mojom::InfoCollectionGpuService> receiver_{this};