| OLD | NEW | 
|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/public/browser/gpu_utils.h" | 5 #include "content/public/browser/gpu_utils.h" | 
| 6 | 6 | 
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" | 
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" | 
| 9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" | 
| 10 #include "gpu/command_buffer/service/gpu_switches.h" | 10 #include "gpu/command_buffer/service/gpu_switches.h" | 
| 11 #include "gpu/config/gpu_switches.h" | 11 #include "gpu/config/gpu_switches.h" | 
|  | 12 #include "media/media_features.h" | 
| 12 #include "ui/gl/gl_switches.h" | 13 #include "ui/gl/gl_switches.h" | 
| 13 | 14 | 
| 14 namespace { | 15 namespace { | 
| 15 | 16 | 
| 16 bool GetUintFromSwitch(const base::CommandLine* command_line, | 17 bool GetUintFromSwitch(const base::CommandLine* command_line, | 
| 17                        const base::StringPiece& switch_string, | 18                        const base::StringPiece& switch_string, | 
| 18                        uint32_t* value) { | 19                        uint32_t* value) { | 
| 19   if (!command_line->HasSwitch(switch_string)) | 20   if (!command_line->HasSwitch(switch_string)) | 
| 20     return false; | 21     return false; | 
| 21   std::string switch_value(command_line->GetSwitchValueASCII(switch_string)); | 22   std::string switch_value(command_line->GetSwitchValueASCII(switch_string)); | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 36   gpu_preferences.in_process_gpu = | 37   gpu_preferences.in_process_gpu = | 
| 37       command_line->HasSwitch(switches::kInProcessGPU); | 38       command_line->HasSwitch(switches::kInProcessGPU); | 
| 38   gpu_preferences.ui_prioritize_in_gpu_process = | 39   gpu_preferences.ui_prioritize_in_gpu_process = | 
| 39       command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess); | 40       command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess); | 
| 40   gpu_preferences.disable_accelerated_video_decode = | 41   gpu_preferences.disable_accelerated_video_decode = | 
| 41       command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode); | 42       command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode); | 
| 42 #if defined(OS_CHROMEOS) | 43 #if defined(OS_CHROMEOS) | 
| 43   gpu_preferences.disable_vaapi_accelerated_video_encode = | 44   gpu_preferences.disable_vaapi_accelerated_video_encode = | 
| 44       command_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode); | 45       command_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode); | 
| 45 #endif | 46 #endif | 
| 46 #if defined(ENABLE_WEBRTC) | 47 #if BUILDFLAG(ENABLE_WEBRTC) | 
| 47   gpu_preferences.disable_web_rtc_hw_encoding = | 48   gpu_preferences.disable_web_rtc_hw_encoding = | 
| 48       command_line->HasSwitch(switches::kDisableWebRtcHWEncoding) && | 49       command_line->HasSwitch(switches::kDisableWebRtcHWEncoding) && | 
| 49       command_line->GetSwitchValueASCII(switches::kDisableWebRtcHWEncoding) | 50       command_line->GetSwitchValueASCII(switches::kDisableWebRtcHWEncoding) | 
| 50           .empty(); | 51           .empty(); | 
| 51 #endif | 52 #endif | 
| 52 #if defined(OS_WIN) | 53 #if defined(OS_WIN) | 
| 53   uint32_t enable_accelerated_vpx_decode_val = | 54   uint32_t enable_accelerated_vpx_decode_val = | 
| 54       gpu::GpuPreferences::VPX_VENDOR_MICROSOFT; | 55       gpu::GpuPreferences::VPX_VENDOR_MICROSOFT; | 
| 55   if (GetUintFromSwitch(command_line, switches::kEnableAcceleratedVpxDecode, | 56   if (GetUintFromSwitch(command_line, switches::kEnableAcceleratedVpxDecode, | 
| 56                         &enable_accelerated_vpx_decode_val)) { | 57                         &enable_accelerated_vpx_decode_val)) { | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 108   gpu_preferences.enable_gpu_service_tracing = | 109   gpu_preferences.enable_gpu_service_tracing = | 
| 109       command_line->HasSwitch(switches::kEnableGPUServiceTracing); | 110       command_line->HasSwitch(switches::kEnableGPUServiceTracing); | 
| 110   gpu_preferences.use_passthrough_cmd_decoder = | 111   gpu_preferences.use_passthrough_cmd_decoder = | 
| 111       command_line->HasSwitch(switches::kUsePassthroughCmdDecoder); | 112       command_line->HasSwitch(switches::kUsePassthroughCmdDecoder); | 
| 112   // Some of these preferences are set or adjusted in | 113   // Some of these preferences are set or adjusted in | 
| 113   // GpuDataManagerImplPrivate::AppendGpuCommandLine. | 114   // GpuDataManagerImplPrivate::AppendGpuCommandLine. | 
| 114   return gpu_preferences; | 115   return gpu_preferences; | 
| 115 } | 116 } | 
| 116 | 117 | 
| 117 }  // namespace content | 118 }  // namespace content | 
| OLD | NEW | 
|---|