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

Side by Side Diff: ui/gl/gl_context_glx.cc

Issue 1420533009: Cleanup GpuMemoryManager and helpers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup. Created 5 years, 1 month 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
« no previous file with comments | « ui/gl/gl_context_glx.h ('k') | no next file » | 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 extern "C" { 5 extern "C" {
6 #include <X11/Xlib.h> 6 #include <X11/Xlib.h>
7 } 7 }
8 8
9 #include "ui/gl/gl_context_glx.h" 9 #include "ui/gl/gl_context_glx.h"
10 10
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 std::string GLContextGLX::GetExtensions() { 186 std::string GLContextGLX::GetExtensions() {
187 DCHECK(IsCurrent(nullptr)); 187 DCHECK(IsCurrent(nullptr));
188 const char* extensions = GLSurfaceGLX::GetGLXExtensions(); 188 const char* extensions = GLSurfaceGLX::GetGLXExtensions();
189 if (extensions) { 189 if (extensions) {
190 return GLContext::GetExtensions() + " " + extensions; 190 return GLContext::GetExtensions() + " " + extensions;
191 } 191 }
192 192
193 return GLContext::GetExtensions(); 193 return GLContext::GetExtensions();
194 } 194 }
195 195
196 bool GLContextGLX::GetTotalGpuMemory(size_t* bytes) {
197 DCHECK(bytes);
198 *bytes = 0;
199 if (HasExtension("GL_NVX_gpu_memory_info")) {
200 GLint kbytes = 0;
201 glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &kbytes);
202 *bytes =
203 base::saturated_cast<size_t>(1024u * static_cast<uint64_t>(kbytes));
204 return true;
205 }
206 return false;
207 }
208
209 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { 196 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() {
210 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); 197 return GLSurfaceGLX::IsCreateContextRobustnessSupported();
211 } 198 }
212 199
213 GLContextGLX::~GLContextGLX() { 200 GLContextGLX::~GLContextGLX() {
214 Destroy(); 201 Destroy();
215 } 202 }
216 203
217 } // namespace gfx 204 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_context_glx.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698