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 "gpu/config/gpu_info_collector.h" | 5 #include "gpu/config/gpu_info_collector.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/metrics/sparse_histogram.h" | 15 #include "base/metrics/sparse_histogram.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
20 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
21 #include "gpu/config/gpu_switches.h" | 21 #include "gpu/config/gpu_switches.h" |
22 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
23 #include "ui/gl/gl_context.h" | 23 #include "ui/gl/gl_context.h" |
24 #include "ui/gl/gl_implementation.h" | 24 #include "ui/gl/gl_implementation.h" |
25 #include "ui/gl/gl_surface.h" | 25 #include "ui/gl/gl_surface.h" |
26 #include "ui/gl/gl_version_info.h" | 26 #include "ui/gl/gl_version_info.h" |
| 27 #include "ui/gl/init/gl_factory.h" |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { | 31 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { |
31 scoped_refptr<gfx::GLSurface> surface( | 32 scoped_refptr<gfx::GLSurface> surface( |
32 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size())); | 33 gl::init::CreateOffscreenGLSurface(gfx::Size())); |
33 if (!surface.get()) { | 34 if (!surface.get()) { |
34 LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; | 35 LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; |
35 return NULL; | 36 return NULL; |
36 } | 37 } |
37 | 38 |
38 return surface; | 39 return surface; |
39 } | 40 } |
40 | 41 |
41 scoped_refptr<gfx::GLContext> InitializeGLContext(gfx::GLSurface* surface) { | 42 scoped_refptr<gfx::GLContext> InitializeGLContext(gfx::GLSurface* surface) { |
42 | |
43 scoped_refptr<gfx::GLContext> context( | 43 scoped_refptr<gfx::GLContext> context( |
44 gfx::GLContext::CreateGLContext(NULL, | 44 gl::init::CreateGLContext(nullptr, surface, gfx::PreferIntegratedGpu)); |
45 surface, | |
46 gfx::PreferIntegratedGpu)); | |
47 if (!context.get()) { | 45 if (!context.get()) { |
48 LOG(ERROR) << "gfx::GLContext::CreateGLContext failed"; | 46 LOG(ERROR) << "gl::init::CreateGLContext failed"; |
49 return NULL; | 47 return NULL; |
50 } | 48 } |
51 | 49 |
52 if (!context->MakeCurrent(surface)) { | 50 if (!context->MakeCurrent(surface)) { |
53 LOG(ERROR) << "gfx::GLContext::MakeCurrent() failed"; | 51 LOG(ERROR) << "gfx::GLContext::MakeCurrent() failed"; |
54 return NULL; | 52 return NULL; |
55 } | 53 } |
56 | 54 |
57 return context; | 55 return context; |
58 } | 56 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { | 281 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { |
284 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { | 282 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { |
285 gpu_info->secondary_gpus[ii].active = true; | 283 gpu_info->secondary_gpus[ii].active = true; |
286 return; | 284 return; |
287 } | 285 } |
288 } | 286 } |
289 } | 287 } |
290 | 288 |
291 } // namespace gpu | 289 } // namespace gpu |
292 | 290 |
OLD | NEW |