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 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 Loading... |
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 |
OLD | NEW |