1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef GPU_CONFIG_GPU_INFO_COLLECTOR_H_ 6 #define GPU_CONFIG_GPU_INFO_COLLECTOR_H_ 7 8 #include <stdint.h> 9 10 #include "build/build_config.h" 11 #include "gpu/config/gpu_extra_info.h" 12 #include "gpu/config/gpu_info.h" 13 #include "gpu/config/gpu_preferences.h" 14 #include "gpu/gpu_export.h" 15 16 #if defined(OS_WIN) 17 #include <d3dcommon.h> 18 #endif // OS_WIN 19 20 namespace angle { 21 struct SystemInfo; 22 } 23 24 namespace base { 25 class CommandLine; 26 } 27 28 namespace gpu { 29 30 // Collects basic GPU info without creating a GL/DirectX context (and without 31 // the danger of crashing), including vendor_id and device_id. 32 // This is called at browser process startup time. 33 // The subset each platform collects may be different. 34 GPU_EXPORT bool CollectBasicGraphicsInfo(GPUInfo* gpu_info); 35 36 // Similar to above, except it handles the case where the software renderer of 37 // the platform is used. 38 GPU_EXPORT bool CollectBasicGraphicsInfo(const base::CommandLine* command_line, 39 GPUInfo* gpu_info); 40 41 // Create a GL/DirectX context and collect related info. 42 // This is called at GPU process startup time. 43 GPU_EXPORT bool CollectContextGraphicsInfo(GPUInfo* gpu_info); 44 45 #if defined(OS_WIN) 46 // Collect the DirectX Disagnostics information about the attached displays. 47 GPU_EXPORT bool GetDxDiagnostics(DxDiagNode* output); 48 GPU_EXPORT void RecordGpuSupportedRuntimeVersionHistograms( 49 Dx12VulkanVersionInfo* dx12_vulkan_version_info); 50 51 // Iterate through all adapters and create a hardware D3D11 device on each 52 // adapter. If succeeded, query the highest feature level it supports and 53 // weather it's a discrete GPU. 54 // Set |d3d11_feature_level| to the highest from all adapters. 55 // Set |is_discrete_gpu| to true if one of the adapters is discrete. 56 // Return false if info collection fails. 57 GPU_EXPORT bool CollectD3D11FeatureInfo(D3D_FEATURE_LEVEL* d3d11_feature_level, 58 bool* has_discrete_gpu); 59 60 // Collect the hardware overlay support flags. 61 GPU_EXPORT void CollectHardwareOverlayInfo(OverlayInfo* overlay_info); 62 #endif // OS_WIN 63 64 // Create a GL context and collect GL strings and versions. 65 GPU_EXPORT bool CollectGraphicsInfoGL(GPUInfo* gpu_info); 66 67 // If more than one GPUs are identified, and GL strings are available, 68 // identify the active GPU based on GL strings. 69 GPU_EXPORT void IdentifyActiveGPU(GPUInfo* gpu_info); 70 71 // Helper function to convert data from ANGLE's system info gathering library 72 // into a GPUInfo 73 void FillGPUInfoFromSystemInfo(GPUInfo* gpu_info, 74 angle::SystemInfo* system_info); 75 76 // On Android, this calls CollectContextGraphicsInfo(). 77 // On other platforms, this calls CollectBasicGraphicsInfo(). 78 GPU_EXPORT void CollectGraphicsInfoForTesting(GPUInfo* gpu_info); 79 80 // Collect Graphics info related to the current process 81 GPU_EXPORT bool CollectGpuExtraInfo(GpuExtraInfo* gpu_extra_info, 82 const GpuPreferences& prefs); 83 84 } // namespace gpu 85 86 #endif // GPU_CONFIG_GPU_INFO_COLLECTOR_H_ 87