Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: gpu/config/gpu_info_collector_win.cc

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/config/BUILD.gn ('k') | gpu/gles2_conform_support/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/config/gpu_info_collector_win.cc
diff --git a/gpu/config/gpu_info_collector_win.cc b/gpu/config/gpu_info_collector_win.cc
index 4deee7c497bcbb59c8882b31e9ea23ebd28c856b..e8c8f2f4ab335304b9ea87db77a38505c81cd858 100644
--- a/gpu/config/gpu_info_collector_win.cc
+++ b/gpu/config/gpu_info_collector_win.cc
@@ -210,161 +210,6 @@ bool IsLenovoDCuteInstalled() {
return true;
}
-// Determines whether D3D11 won't work, either because it is not supported on
-// the machine or because it is known it is likely to crash.
-bool D3D11ShouldWork(const GPUInfo& gpu_info) {
- // TODO(apatrick): This is a temporary change to see what impact disabling
- // D3D11 stats collection has on Canary.
-#if 1
- return false;
-#else
- // Windows XP never supports D3D11. It seems to be less stable that D3D9 on
- // Vista.
- if (base::win::GetVersion() <= base::win::VERSION_VISTA)
- return false;
-
- // http://crbug.com/175525.
- if (gpu_info.display_link_version.IsValid())
- return false;
-
- return true;
-#endif
-}
-
-// Collects information about the level of D3D11 support and records it in
-// the UMA stats. Records no stats when D3D11 in not supported at all.
-void CollectD3D11SupportOnWorkerThread() {
- TRACE_EVENT0("gpu", "CollectD3D11Support");
-
- typedef HRESULT (WINAPI *D3D11CreateDeviceFunc)(
- IDXGIAdapter* adapter,
- D3D_DRIVER_TYPE driver_type,
- HMODULE software,
- UINT flags,
- const D3D_FEATURE_LEVEL* feature_levels,
- UINT num_feature_levels,
- UINT sdk_version,
- ID3D11Device** device,
- D3D_FEATURE_LEVEL* feature_level,
- ID3D11DeviceContext** immediate_context);
-
- // This enumeration must be kept in sync with histograms.xml. Do not reorder
- // the members; always add to the end.
- enum FeatureLevel {
- FEATURE_LEVEL_UNKNOWN,
- FEATURE_LEVEL_NO_D3D11_DLL,
- FEATURE_LEVEL_NO_CREATE_DEVICE_ENTRY_POINT,
- FEATURE_LEVEL_DEVICE_CREATION_FAILED,
- FEATURE_LEVEL_9_1,
- FEATURE_LEVEL_9_2,
- FEATURE_LEVEL_9_3,
- FEATURE_LEVEL_10_0,
- FEATURE_LEVEL_10_1,
- FEATURE_LEVEL_11_0,
- NUM_FEATURE_LEVELS
- };
-
- FeatureLevel feature_level = FEATURE_LEVEL_UNKNOWN;
- UINT bgra_support = 0;
-
- // This module is leaked in case it is hooked by third party software.
- base::NativeLibrary d3d11_module = base::LoadNativeLibrary(
- base::FilePath(L"d3d11.dll"),
- NULL);
-
- if (!d3d11_module) {
- feature_level = FEATURE_LEVEL_NO_D3D11_DLL;
- } else {
- D3D11CreateDeviceFunc create_func =
- reinterpret_cast<D3D11CreateDeviceFunc>(
- base::GetFunctionPointerFromNativeLibrary(d3d11_module,
- "D3D11CreateDevice"));
- if (!create_func) {
- feature_level = FEATURE_LEVEL_NO_CREATE_DEVICE_ENTRY_POINT;
- } else {
- static const D3D_FEATURE_LEVEL d3d_feature_levels[] = {
- D3D_FEATURE_LEVEL_11_0,
- D3D_FEATURE_LEVEL_10_1,
- D3D_FEATURE_LEVEL_10_0,
- D3D_FEATURE_LEVEL_9_3,
- D3D_FEATURE_LEVEL_9_2,
- D3D_FEATURE_LEVEL_9_1
- };
-
- base::win::ScopedComPtr<ID3D11Device> device;
- D3D_FEATURE_LEVEL d3d_feature_level;
- base::win::ScopedComPtr<ID3D11DeviceContext> device_context;
- HRESULT hr = create_func(NULL,
- D3D_DRIVER_TYPE_HARDWARE,
- NULL,
- 0,
- d3d_feature_levels,
- arraysize(d3d_feature_levels),
- D3D11_SDK_VERSION,
- device.Receive(),
- &d3d_feature_level,
- device_context.Receive());
- if (FAILED(hr)) {
- feature_level = FEATURE_LEVEL_DEVICE_CREATION_FAILED;
- } else {
- switch (d3d_feature_level) {
- case D3D_FEATURE_LEVEL_11_0:
- feature_level = FEATURE_LEVEL_11_0;
- break;
- case D3D_FEATURE_LEVEL_10_1:
- feature_level = FEATURE_LEVEL_10_1;
- break;
- case D3D_FEATURE_LEVEL_10_0:
- feature_level = FEATURE_LEVEL_10_0;
- break;
- case D3D_FEATURE_LEVEL_9_3:
- feature_level = FEATURE_LEVEL_9_3;
- break;
- case D3D_FEATURE_LEVEL_9_2:
- feature_level = FEATURE_LEVEL_9_2;
- break;
- case D3D_FEATURE_LEVEL_9_1:
- feature_level = FEATURE_LEVEL_9_1;
- break;
- default:
- NOTREACHED();
- break;
- }
-
- hr = device->CheckFormatSupport(DXGI_FORMAT_B8G8R8A8_UNORM,
- &bgra_support);
- DCHECK(SUCCEEDED(hr));
- }
- }
- }
-
- UMA_HISTOGRAM_ENUMERATION("GPU.D3D11_FeatureLevel",
- feature_level,
- NUM_FEATURE_LEVELS);
-
- // ANGLE requires at least feature level 10.0. Do not record any further
- // stats if ANGLE would not work anyway.
- if (feature_level < FEATURE_LEVEL_10_0)
- return;
-
- UMA_HISTOGRAM_BOOLEAN(
- "GPU.D3D11_B8G8R8A8_Texture2DSupport",
- (bgra_support & D3D11_FORMAT_SUPPORT_TEXTURE2D) != 0);
- UMA_HISTOGRAM_BOOLEAN(
- "GPU.D3D11_B8G8R8A8_RenderTargetSupport",
- (bgra_support & D3D11_FORMAT_SUPPORT_RENDER_TARGET) != 0);
-}
-
-// Collects information about the level of D3D11 support and records it in
-// the UMA stats. Records no stats when D3D11 in not supported at all.
-void CollectD3D11Support() {
- // D3D11 takes about 50ms to initialize so do this on a worker thread.
- base::WorkerPool::PostTask(
- FROM_HERE,
- base::Bind(CollectD3D11SupportOnWorkerThread),
- false);
-}
-
void DeviceIDToVendorAndDevice(const std::wstring& id,
uint32* vendor_id,
uint32* device_id) {
@@ -708,26 +553,6 @@ CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) {
return kCollectInfoNonFatalFailure;
}
- // Collect basic information about supported D3D11 features. Delay for 45
- // seconds so as not to regress performance tests.
- if (D3D11ShouldWork(*gpu_info)) {
- // This is on a field trial so we can turn it off easily if it blows up
- // again in stable channel.
- scoped_refptr<base::FieldTrial> trial(
- base::FieldTrialList::FactoryGetFieldTrial(
- "D3D11Experiment", 100, "Disabled", 2015, 7, 8,
- base::FieldTrial::SESSION_RANDOMIZED, NULL));
- const int enabled_group =
- trial->AppendGroup("Enabled", 0);
-
- if (trial->group() == enabled_group) {
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&CollectD3D11Support),
- base::TimeDelta::FromSeconds(45));
- }
- }
-
gpu_info->basic_info_state = kCollectInfoSuccess;
return kCollectInfoSuccess;
}
« no previous file with comments | « gpu/config/BUILD.gn ('k') | gpu/gles2_conform_support/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698