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

Side by Side Diff: gpu/tools/compositor_model_bench/compositor_model_bench.cc

Issue 135213003: Ensure GL initialization only happens once, and provide common init path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initgl: compile3 Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « gpu/config/gpu_info_collector_unittest.cc ('k') | media/tools/player_x11/gl_video_renderer.cc » ('j') | 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) 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 // This tool is used to benchmark the render model used by the compositor 5 // This tool is used to benchmark the render model used by the compositor
6 6
7 // Most of this file is derived from the source of the tile_render_bench tool, 7 // Most of this file is derived from the source of the tile_render_bench tool,
8 // and has been changed to support running a sequence of independent 8 // and has been changed to support running a sequence of independent
9 // simulations for our different render models and test cases. 9 // simulations for our different render models and test cases.
10 10
(...skipping 13 matching lines...) Expand all
24 #include "base/at_exit.h" 24 #include "base/at_exit.h"
25 #include "base/basictypes.h" 25 #include "base/basictypes.h"
26 #include "base/bind.h" 26 #include "base/bind.h"
27 #include "base/command_line.h" 27 #include "base/command_line.h"
28 #include "base/file_util.h" 28 #include "base/file_util.h"
29 #include "base/files/file_enumerator.h" 29 #include "base/files/file_enumerator.h"
30 #include "base/files/file_path.h" 30 #include "base/files/file_path.h"
31 #include "base/memory/scoped_ptr.h" 31 #include "base/memory/scoped_ptr.h"
32 #include "base/message_loop/message_loop.h" 32 #include "base/message_loop/message_loop.h"
33 #include "base/time/time.h" 33 #include "base/time/time.h"
34
35 #include "gpu/tools/compositor_model_bench/render_model_utils.h" 34 #include "gpu/tools/compositor_model_bench/render_model_utils.h"
36 #include "gpu/tools/compositor_model_bench/render_models.h" 35 #include "gpu/tools/compositor_model_bench/render_models.h"
37 #include "gpu/tools/compositor_model_bench/render_tree.h" 36 #include "gpu/tools/compositor_model_bench/render_tree.h"
38 37 #include "ui/gl/gl_surface.h"
39 38
40 using base::TimeTicks; 39 using base::TimeTicks;
41 using base::DirectoryExists; 40 using base::DirectoryExists;
42 using base::PathExists; 41 using base::PathExists;
43 using std::queue; 42 using std::queue;
44 using std::string; 43 using std::string;
45 44
46 struct SimulationSpecification { 45 struct SimulationSpecification {
47 string simulation_name; 46 string simulation_name;
48 base::FilePath input_path; 47 base::FilePath input_path;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 ExposureMask | KeyPressMask | StructureNotifyMask); 178 ExposureMask | KeyPressMask | StructureNotifyMask);
180 XMapWindow(display_, window_); 179 XMapWindow(display_, window_);
181 180
182 XResizeWindow(display_, window_, WINDOW_WIDTH, WINDOW_HEIGHT); 181 XResizeWindow(display_, window_, WINDOW_WIDTH, WINDOW_HEIGHT);
183 182
184 return true; 183 return true;
185 } 184 }
186 185
187 // Initialize the OpenGL context. 186 // Initialize the OpenGL context.
188 bool InitGLContext() { 187 bool InitGLContext() {
189 if (!InitializeStaticGLBindings(gfx::kGLImplementationDesktopGL)) { 188 if (!gfx::GLSurface::InitializeOneOff()) {
190 LOG(FATAL) << "InitializeStaticGLBindings failed"; 189 LOG(FATAL) << "gfx::GLSurface::InitializeOneOff failed";
191 return false; 190 return false;
192 } 191 }
193 192
194 XWindowAttributes attributes; 193 XWindowAttributes attributes;
195 XGetWindowAttributes(display_, window_, &attributes); 194 XGetWindowAttributes(display_, window_, &attributes);
196 XVisualInfo visual_info_template; 195 XVisualInfo visual_info_template;
197 visual_info_template.visualid = XVisualIDFromVisual(attributes.visual); 196 visual_info_template.visualid = XVisualIDFromVisual(attributes.visual);
198 int visual_info_count = 0; 197 int visual_info_count = 0;
199 XVisualInfo* visual_info_list = XGetVisualInfo(display_, VisualIDMask, 198 XVisualInfo* visual_info_list = XGetVisualInfo(display_, VisualIDMask,
200 &visual_info_template, 199 &visual_info_template,
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 392 }
394 } else { 393 } else {
395 LOG(INFO) << "(input path is a file)"; 394 LOG(INFO) << "(input path is a file)";
396 sim.QueueTest(inPath); 395 sim.QueueTest(inPath);
397 } 396 }
398 397
399 sim.Run(); 398 sim.Run();
400 399
401 return 0; 400 return 0;
402 } 401 }
OLDNEW
« no previous file with comments | « gpu/config/gpu_info_collector_unittest.cc ('k') | media/tools/player_x11/gl_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698