OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gl/gpu_switching_manager.h" | 5 #include "ui/gl/gpu_switching_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "ui/gl/gl_switches.h" | 10 #include "ui/gl/gl_switches.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } else { | 90 } else { |
91 // Browser process. | 91 // Browser process. |
92 // We only compute this flag in the browser process. | 92 // We only compute this flag in the browser process. |
93 #if defined(OS_MACOSX) | 93 #if defined(OS_MACOSX) |
94 flag = (vendor_ids_.size() == 2); | 94 flag = (vendor_ids_.size() == 2); |
95 if (flag && command_line.HasSwitch(switches::kUseGL) && | 95 if (flag && command_line.HasSwitch(switches::kUseGL) && |
96 command_line.GetSwitchValueASCII(switches::kUseGL) != | 96 command_line.GetSwitchValueASCII(switches::kUseGL) != |
97 gfx::kGLImplementationDesktopName) | 97 gfx::kGLImplementationDesktopName) |
98 flag = false; | 98 flag = false; |
99 | 99 |
100 if (flag && !base::mac::IsOSLionOrLater()) | |
101 flag = false; | |
102 | |
103 if (flag) { | 100 if (flag) { |
104 // Only advertise that we have two GPUs to the rest of | 101 // Only advertise that we have two GPUs to the rest of |
105 // Chrome's code if we find an Intel GPU and some other | 102 // Chrome's code if we find an Intel GPU and some other |
106 // vendor's GPU. Otherwise we don't understand the | 103 // vendor's GPU. Otherwise we don't understand the |
107 // configuration and don't deal well with it (an example being | 104 // configuration and don't deal well with it (an example being |
108 // the dual AMD GPUs in recent Mac Pros). | 105 // the dual AMD GPUs in recent Mac Pros). |
109 const uint32_t intel = 0x8086; | 106 const uint32_t intel = 0x8086; |
110 flag = ((vendor_ids_[0] == intel && vendor_ids_[1] != intel) || | 107 flag = ((vendor_ids_[0] == intel && vendor_ids_[1] != intel) || |
111 (vendor_ids_[0] != intel && vendor_ids_[1] == intel)); | 108 (vendor_ids_[0] != intel && vendor_ids_[1] == intel)); |
112 } | 109 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return; | 145 return; |
149 CGLPixelFormatAttribute attribs[1]; | 146 CGLPixelFormatAttribute attribs[1]; |
150 attribs[0] = static_cast<CGLPixelFormatAttribute>(0); | 147 attribs[0] = static_cast<CGLPixelFormatAttribute>(0); |
151 GLint num_pixel_formats = 0; | 148 GLint num_pixel_formats = 0; |
152 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format, | 149 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format, |
153 &num_pixel_formats); | 150 &num_pixel_formats); |
154 } | 151 } |
155 #endif // OS_MACOSX | 152 #endif // OS_MACOSX |
156 | 153 |
157 } // namespace ui | 154 } // namespace ui |
OLD | NEW |