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

Side by Side Diff: trunk/src/gpu/config/gpu_info_collector_android.cc

Issue 149953003: Revert 247793 "Ensure GL initialization only happens once, and p..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
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 #include "gpu/config/gpu_info_collector.h" 5 #include "gpu/config/gpu_info_collector.h"
6 6
7 #include "base/android/build_info.h" 7 #include "base/android/build_info.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 ScopedRestoreNonOwnedEGLContext::ScopedRestoreNonOwnedEGLContext() 59 ScopedRestoreNonOwnedEGLContext::ScopedRestoreNonOwnedEGLContext()
60 : context_(EGL_NO_CONTEXT), 60 : context_(EGL_NO_CONTEXT),
61 display_(EGL_NO_DISPLAY), 61 display_(EGL_NO_DISPLAY),
62 draw_surface_(EGL_NO_SURFACE), 62 draw_surface_(EGL_NO_SURFACE),
63 read_surface_(EGL_NO_SURFACE) { 63 read_surface_(EGL_NO_SURFACE) {
64 // This should only used to restore a context that is not created or owned by 64 // This should only used to restore a context that is not created or owned by
65 // Chromium native code, but created by Android system itself. 65 // Chromium native code, but created by Android system itself.
66 DCHECK(!gfx::GLContext::GetCurrent()); 66 DCHECK(!gfx::GLContext::GetCurrent());
67 67
68 context_ = eglGetCurrentContext(); 68 if (gfx::GLSurface::InitializeOneOff()) {
69 display_ = eglGetCurrentDisplay(); 69 context_ = eglGetCurrentContext();
70 draw_surface_ = eglGetCurrentSurface(EGL_DRAW); 70 display_ = eglGetCurrentDisplay();
71 read_surface_ = eglGetCurrentSurface(EGL_READ); 71 draw_surface_ = eglGetCurrentSurface(EGL_DRAW);
72 read_surface_ = eglGetCurrentSurface(EGL_READ);
73 }
72 } 74 }
73 75
74 ScopedRestoreNonOwnedEGLContext::~ScopedRestoreNonOwnedEGLContext() { 76 ScopedRestoreNonOwnedEGLContext::~ScopedRestoreNonOwnedEGLContext() {
75 if (context_ == EGL_NO_CONTEXT || display_ == EGL_NO_DISPLAY || 77 if (context_ == EGL_NO_CONTEXT || display_ == EGL_NO_DISPLAY ||
76 draw_surface_ == EGL_NO_SURFACE || read_surface_ == EGL_NO_SURFACE) 78 draw_surface_ == EGL_NO_SURFACE || read_surface_ == EGL_NO_SURFACE) {
77 return; 79 return;
80 }
78 81
79 if (!eglMakeCurrent(display_, draw_surface_, read_surface_, context_)) 82 if (!eglMakeCurrent(display_, draw_surface_, read_surface_, context_)) {
80 LOG(WARNING) << "Failed to restore EGL context"; 83 LOG(WARNING) << "Failed to restore EGL context";
84 }
81 } 85 }
82 86
83 } 87 }
84 88
85 namespace gpu { 89 namespace gpu {
86 90
87 bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { 91 bool CollectContextGraphicsInfo(GPUInfo* gpu_info) {
88 return CollectBasicGraphicsInfo(gpu_info); 92 return CollectBasicGraphicsInfo(gpu_info);
89 } 93 }
90 94
(...skipping 23 matching lines...) Expand all
114 gpu_info->gpu.device_string = gpu_info->gl_renderer; 118 gpu_info->gpu.device_string = gpu_info->gl_renderer;
115 return true; 119 return true;
116 } 120 }
117 121
118 void MergeGPUInfo(GPUInfo* basic_gpu_info, 122 void MergeGPUInfo(GPUInfo* basic_gpu_info,
119 const GPUInfo& context_gpu_info) { 123 const GPUInfo& context_gpu_info) {
120 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); 124 MergeGPUInfoGL(basic_gpu_info, context_gpu_info);
121 } 125 }
122 126
123 } // namespace gpu 127 } // namespace gpu
OLDNEW
« no previous file with comments | « trunk/src/gpu/config/gpu_info_collector.cc ('k') | trunk/src/gpu/config/gpu_info_collector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698