| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/browser/gpu/gpu_data_manager.h" |
| 6 | 6 |
| 7 #if defined(OS_MACOSX) | 7 #if defined(OS_MACOSX) |
| 8 #include <CoreGraphics/CGDisplayConfiguration.h> | 8 #include <CoreGraphics/CGDisplayConfiguration.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 GpuFeatureFlags::kGpuFeatureAcceleratedCompositing | | 478 GpuFeatureFlags::kGpuFeatureAcceleratedCompositing | |
| 479 GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas)) && | 479 GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas)) && |
| 480 (user_flags_.use_gl() == "any")) { | 480 (user_flags_.use_gl() == "any")) { |
| 481 command_line->AppendSwitchASCII( | 481 command_line->AppendSwitchASCII( |
| 482 switches::kUseGL, gfx::kGLImplementationOSMesaName); | 482 switches::kUseGL, gfx::kGLImplementationOSMesaName); |
| 483 } else if (!user_flags_.use_gl().empty()) { | 483 } else if (!user_flags_.use_gl().empty()) { |
| 484 command_line->AppendSwitchASCII(switches::kUseGL, user_flags_.use_gl()); | 484 command_line->AppendSwitchASCII(switches::kUseGL, user_flags_.use_gl()); |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 | 487 |
| 488 void GpuDataManager::SetBuiltInGpuBlacklist(GpuBlacklist* built_in_list) { | 488 void GpuDataManager::SetGpuBlacklist(GpuBlacklist* gpu_blacklist) { |
| 489 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 489 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 490 DCHECK(built_in_list); | 490 DCHECK(gpu_blacklist); |
| 491 uint16 version_major, version_minor; | 491 gpu_blacklist_.reset(gpu_blacklist); |
| 492 bool succeed = built_in_list->GetVersion( | |
| 493 &version_major, &version_minor); | |
| 494 DCHECK(succeed); | |
| 495 gpu_blacklist_.reset(built_in_list); | |
| 496 UpdateGpuFeatureFlags(); | 492 UpdateGpuFeatureFlags(); |
| 497 preliminary_gpu_feature_flags_ = gpu_feature_flags_; | 493 preliminary_gpu_feature_flags_ = gpu_feature_flags_; |
| 498 VLOG(1) << "Using software rendering list version " | |
| 499 << version_major << "." << version_minor; | |
| 500 } | |
| 501 | |
| 502 void GpuDataManager::UpdateGpuBlacklist( | |
| 503 GpuBlacklist* gpu_blacklist, bool preliminary) { | |
| 504 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 505 DCHECK(gpu_blacklist); | |
| 506 | |
| 507 scoped_ptr<GpuBlacklist> updated_list(gpu_blacklist); | |
| 508 | |
| 509 uint16 updated_version_major, updated_version_minor; | |
| 510 if (!updated_list->GetVersion( | |
| 511 &updated_version_major, &updated_version_minor)) | |
| 512 return; | |
| 513 | |
| 514 uint16 current_version_major, current_version_minor; | |
| 515 bool succeed = gpu_blacklist_->GetVersion( | |
| 516 ¤t_version_major, ¤t_version_minor); | |
| 517 DCHECK(succeed); | |
| 518 if (updated_version_major < current_version_major || | |
| 519 (updated_version_major == current_version_major && | |
| 520 updated_version_minor <= current_version_minor)) | |
| 521 return; | |
| 522 | |
| 523 gpu_blacklist_.reset(updated_list.release()); | |
| 524 UpdateGpuFeatureFlags(); | |
| 525 if (preliminary) | |
| 526 preliminary_gpu_feature_flags_ = gpu_feature_flags_; | |
| 527 VLOG(1) << "Using software rendering list version " | |
| 528 << updated_version_major << "." << updated_version_minor; | |
| 529 } | 494 } |
| 530 | 495 |
| 531 void GpuDataManager::HandleGpuSwitch() { | 496 void GpuDataManager::HandleGpuSwitch() { |
| 532 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 497 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 533 content::GPUInfo gpu_info; | 498 content::GPUInfo gpu_info; |
| 534 gpu_info_collector::CollectVideoCardInfo(&gpu_info); | 499 gpu_info_collector::CollectVideoCardInfo(&gpu_info); |
| 535 LOG(INFO) << "Switching to use GPU: vendor_id = 0x" | 500 LOG(INFO) << "Switching to use GPU: vendor_id = 0x" |
| 536 << base::StringPrintf("%04x", gpu_info.vendor_id) | 501 << base::StringPrintf("%04x", gpu_info.vendor_id) |
| 537 << ", device_id = 0x" | 502 << ", device_id = 0x" |
| 538 << base::StringPrintf("%04x", gpu_info.device_id); | 503 << base::StringPrintf("%04x", gpu_info.device_id); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 bool GpuDataManager::supportsAccelerated2dCanvas() const { | 755 bool GpuDataManager::supportsAccelerated2dCanvas() const { |
| 791 if (gpu_info_.can_lose_context) | 756 if (gpu_info_.can_lose_context) |
| 792 return false; | 757 return false; |
| 793 #if defined(USE_SKIA) | 758 #if defined(USE_SKIA) |
| 794 return true; | 759 return true; |
| 795 #else | 760 #else |
| 796 return false; | 761 return false; |
| 797 #endif | 762 #endif |
| 798 } | 763 } |
| 799 | 764 |
| OLD | NEW |