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

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private.cc

Issue 1854383002: Remove DisplayCount from GpuDataManagerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 21 matching lines...) Expand all
32 #include "gpu/config/gpu_feature_type.h" 32 #include "gpu/config/gpu_feature_type.h"
33 #include "gpu/config/gpu_info_collector.h" 33 #include "gpu/config/gpu_info_collector.h"
34 #include "gpu/config/gpu_switches.h" 34 #include "gpu/config/gpu_switches.h"
35 #include "gpu/config/gpu_util.h" 35 #include "gpu/config/gpu_util.h"
36 #include "gpu/ipc/common/memory_stats.h" 36 #include "gpu/ipc/common/memory_stats.h"
37 #include "ui/base/ui_base_switches.h" 37 #include "ui/base/ui_base_switches.h"
38 #include "ui/gl/gl_implementation.h" 38 #include "ui/gl/gl_implementation.h"
39 #include "ui/gl/gl_switches.h" 39 #include "ui/gl/gl_switches.h"
40 #include "ui/gl/gpu_switching_manager.h" 40 #include "ui/gl/gpu_switching_manager.h"
41 41
42 #if defined(OS_MACOSX)
43 #include <ApplicationServices/ApplicationServices.h>
44 #endif // OS_MACOSX
45 #if defined(OS_WIN) 42 #if defined(OS_WIN)
46 #include "base/win/windows_version.h" 43 #include "base/win/windows_version.h"
47 #endif // OS_WIN 44 #endif // OS_WIN
48 #if defined(OS_ANDROID) 45 #if defined(OS_ANDROID)
49 #include "ui/gfx/android/device_display_info.h" 46 #include "ui/gfx/android/device_display_info.h"
50 #endif // OS_ANDROID 47 #endif // OS_ANDROID
51 48
52 namespace content { 49 namespace content {
53 50
54 namespace { 51 namespace {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 std::string rt; 204 std::string rt;
208 for (std::set<int>::const_iterator it = list.begin(); 205 for (std::set<int>::const_iterator it = list.begin();
209 it != list.end(); ++it) { 206 it != list.end(); ++it) {
210 if (!rt.empty()) 207 if (!rt.empty())
211 rt += ","; 208 rt += ",";
212 rt += base::IntToString(*it); 209 rt += base::IntToString(*it);
213 } 210 }
214 return rt; 211 return rt;
215 } 212 }
216 213
217 #if defined(OS_MACOSX)
218 void DisplayReconfigCallback(CGDirectDisplayID display,
219 CGDisplayChangeSummaryFlags flags,
220 void* gpu_data_manager) {
221 if (flags == kCGDisplayBeginConfigurationFlag)
222 return; // This call contains no information about the display change
223
224 GpuDataManagerImpl* manager =
225 reinterpret_cast<GpuDataManagerImpl*>(gpu_data_manager);
226 DCHECK(manager);
227
228 // Display change.
229 bool display_changed = false;
230 uint32_t displayCount;
231 CGGetActiveDisplayList(0, NULL, &displayCount);
232 if (displayCount != manager->GetDisplayCount()) {
233 manager->SetDisplayCount(displayCount);
234 display_changed = true;
235 }
236
237 // Gpu change.
238 bool gpu_changed = false;
239 if (flags & kCGDisplayAddFlag) {
240 uint32_t vendor_id, device_id;
241 if (gpu::CollectGpuID(&vendor_id, &device_id) == gpu::kCollectInfoSuccess) {
242 gpu_changed = manager->UpdateActiveGpu(vendor_id, device_id);
243 }
244 }
245
246 if (display_changed || gpu_changed)
247 manager->HandleGpuSwitch();
danakj 2016/04/05 00:51:57 Uhh, maybe this is still needed.. oops.
danakj 2016/04/05 00:57:52 HandleGpuSwitch() calls GpuSwitchingManager::Notif
danakj 2016/04/05 01:00:15 Ok ya on MacOSX there are some more.. - ImageTran
248 }
249 #endif // OS_MACOSX
250
251 // Block all domains' use of 3D APIs for this many milliseconds if 214 // Block all domains' use of 3D APIs for this many milliseconds if
252 // approaching a threshold where system stability might be compromised. 215 // approaching a threshold where system stability might be compromised.
253 const int64_t kBlockAllDomainsMs = 10000; 216 const int64_t kBlockAllDomainsMs = 10000;
254 const int kNumResetsWithinDuration = 1; 217 const int kNumResetsWithinDuration = 1;
255 218
256 // Enums for UMA histograms. 219 // Enums for UMA histograms.
257 enum BlockStatusHistogram { 220 enum BlockStatusHistogram {
258 BLOCK_STATUS_NOT_BLOCKED, 221 BLOCK_STATUS_NOT_BLOCKED,
259 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, 222 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED,
260 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, 223 BLOCK_STATUS_ALL_DOMAINS_BLOCKED,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const { 260 bool GpuDataManagerImplPrivate::IsDriverBugWorkaroundActive(int feature) const {
298 return (gpu_driver_bugs_.count(feature) == 1); 261 return (gpu_driver_bugs_.count(feature) == 1);
299 } 262 }
300 263
301 size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const { 264 size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const {
302 if (use_swiftshader_) 265 if (use_swiftshader_)
303 return 1; 266 return 1;
304 return blacklisted_features_.size(); 267 return blacklisted_features_.size();
305 } 268 }
306 269
307 void GpuDataManagerImplPrivate::SetDisplayCount(unsigned int display_count) {
308 display_count_ = display_count;
309 }
310
311 unsigned int GpuDataManagerImplPrivate::GetDisplayCount() const {
312 return display_count_;
313 }
314
315 gpu::GPUInfo GpuDataManagerImplPrivate::GetGPUInfo() const { 270 gpu::GPUInfo GpuDataManagerImplPrivate::GetGPUInfo() const {
316 return gpu_info_; 271 return gpu_info_;
317 } 272 }
318 273
319 void GpuDataManagerImplPrivate::GetGpuProcessHandles( 274 void GpuDataManagerImplPrivate::GetGpuProcessHandles(
320 const GpuDataManager::GetGpuProcessHandlesCallback& callback) const { 275 const GpuDataManager::GetGpuProcessHandlesCallback& callback) const {
321 GpuProcessHost::GetProcessHandles(callback); 276 GpuProcessHost::GetProcessHandles(callback);
322 } 277 }
323 278
324 bool GpuDataManagerImplPrivate::GpuAccessAllowed( 279 bool GpuDataManagerImplPrivate::GpuAccessAllowed(
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 948
994 GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(GpuDataManagerImpl* owner) 949 GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(GpuDataManagerImpl* owner)
995 : complete_gpu_info_already_requested_(false), 950 : complete_gpu_info_already_requested_(false),
996 observer_list_(new GpuDataManagerObserverList), 951 observer_list_(new GpuDataManagerObserverList),
997 use_swiftshader_(false), 952 use_swiftshader_(false),
998 card_blacklisted_(false), 953 card_blacklisted_(false),
999 update_histograms_(true), 954 update_histograms_(true),
1000 window_count_(0), 955 window_count_(0),
1001 domain_blocking_enabled_(true), 956 domain_blocking_enabled_(true),
1002 owner_(owner), 957 owner_(owner),
1003 display_count_(0),
1004 gpu_process_accessible_(true), 958 gpu_process_accessible_(true),
1005 is_initialized_(false), 959 is_initialized_(false),
1006 finalized_(false) { 960 finalized_(false) {
1007 DCHECK(owner_); 961 DCHECK(owner_);
1008 const base::CommandLine* command_line = 962 const base::CommandLine* command_line =
1009 base::CommandLine::ForCurrentProcess(); 963 base::CommandLine::ForCurrentProcess();
1010 swiftshader_path_ = 964 swiftshader_path_ =
1011 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( 965 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
1012 switches::kSwiftShaderPath); 966 switches::kSwiftShaderPath);
1013 if (command_line->HasSwitch(switches::kDisableGpu)) 967 if (command_line->HasSwitch(switches::kDisableGpu))
1014 DisableHardwareAcceleration(); 968 DisableHardwareAcceleration();
1015 969
1016 #if defined(OS_MACOSX)
1017 CGGetActiveDisplayList (0, NULL, &display_count_);
1018 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_);
1019 #endif // OS_MACOSX
1020
1021 // For testing only. 970 // For testing only.
1022 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { 971 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) {
1023 domain_blocking_enabled_ = false; 972 domain_blocking_enabled_ = false;
1024 } 973 }
1025 } 974 }
1026 975
1027 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() { 976 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() {
1028 #if defined(OS_MACOSX)
1029 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_);
1030 #endif
1031 } 977 }
1032 978
1033 void GpuDataManagerImplPrivate::InitializeImpl( 979 void GpuDataManagerImplPrivate::InitializeImpl(
1034 const std::string& gpu_blacklist_json, 980 const std::string& gpu_blacklist_json,
1035 const std::string& gpu_driver_bug_list_json, 981 const std::string& gpu_driver_bug_list_json,
1036 const gpu::GPUInfo& gpu_info) { 982 const gpu::GPUInfo& gpu_info) {
1037 const bool log_gpu_control_list_decisions = 983 const bool log_gpu_control_list_decisions =
1038 base::CommandLine::ForCurrentProcess()->HasSwitch( 984 base::CommandLine::ForCurrentProcess()->HasSwitch(
1039 switches::kLogGpuControlListDecisions); 985 switches::kLogGpuControlListDecisions);
1040 986
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; 1180 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1235 #if defined(OS_WIN) 1181 #if defined(OS_WIN)
1236 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; 1182 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1237 #endif 1183 #endif
1238 complete_gpu_info_already_requested_ = true; 1184 complete_gpu_info_already_requested_ = true;
1239 // Some observers might be waiting. 1185 // Some observers might be waiting.
1240 NotifyGpuInfoUpdate(); 1186 NotifyGpuInfoUpdate();
1241 } 1187 }
1242 1188
1243 } // namespace content 1189 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698