Austin Eng | eb68125 | 2023-03-13 23:18:53 | [diff] [blame] | 1 | // Copyright 2023 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "gpu/config/webgpu_blocklist.h" |
| 6 | |
| 7 | #include "base/metrics/field_trial_params.h" |
Scott Violet | e9edfaa | 2023-11-16 02:08:58 | [diff] [blame] | 8 | #include "build/build_config.h" |
Austin Eng | eb68125 | 2023-03-13 23:18:53 | [diff] [blame] | 9 | #include "gpu/config/gpu_finch_features.h" |
| 10 | #include "ui/gl/buildflags.h" |
| 11 | |
| 12 | #if BUILDFLAG(USE_DAWN) |
Scott Violet | e9edfaa | 2023-11-16 02:08:58 | [diff] [blame] | 13 | #include "gpu/config/webgpu_blocklist_impl.h" // nogncheck |
Austin Eng | eb68125 | 2023-03-13 23:18:53 | [diff] [blame] | 14 | #endif |
| 15 | |
| 16 | namespace gpu { |
| 17 | |
| 18 | namespace { |
| 19 | |
Scott Violet | e9edfaa | 2023-11-16 02:08:58 | [diff] [blame] | 20 | #if BUILDFLAG(USE_DAWN) |
Austin Eng | eb68125 | 2023-03-13 23:18:53 | [diff] [blame] | 21 | // List of patterns, delimited by |. Each pattern is of the form: |
| 22 | // `vendorId(:deviceIdOrArchitecture(:driverDescription)?)?` |
| 23 | // Vendor and device ids should be in hexadecimal representation, without a |
| 24 | // leading `0x`. |
| 25 | // The FeatureParam may be overriden via Finch config, or via the command line |
| 26 | // with |
Austin Eng | 79f5c0e | 2023-10-05 18:23:45 | [diff] [blame] | 27 | // --force-fieldtrial-params=WebGPU.Enabled:AdapterBlockList/params |
Austin Eng | eb68125 | 2023-03-13 23:18:53 | [diff] [blame] | 28 | // where `params` is URL-encoded. |
| 29 | const base::FeatureParam<std::string> kAdapterBlockList{ |
| 30 | &features::kWebGPUService, "AdapterBlockList", ""}; |
Scott Violet | e9edfaa | 2023-11-16 02:08:58 | [diff] [blame] | 31 | #endif |
Austin Eng | eb68125 | 2023-03-13 23:18:53 | [diff] [blame] | 32 | |
| 33 | } // namespace |
| 34 | |
| 35 | bool IsWebGPUAdapterBlocklisted(const WGPUAdapterProperties& properties) { |
Austin Eng | eb68125 | 2023-03-13 23:18:53 | [diff] [blame] | 36 | #if BUILDFLAG(USE_DAWN) |
Scott Violet | e9edfaa | 2023-11-16 02:08:58 | [diff] [blame] | 37 | return IsWebGPUAdapterBlocklisted(properties, kAdapterBlockList.Get()); |
Austin Eng | eb68125 | 2023-03-13 23:18:53 | [diff] [blame] | 38 | #else |
| 39 | return true; |
| 40 | #endif |
| 41 | } |
| 42 | |
| 43 | } // namespace gpu |