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

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

Issue 2902863002: Implement EGL context priority if supported, use in VrShell (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_surface_egl.h » ('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 #include "ui/gl/gl_context_egl.h" 5 #include "ui/gl/gl_context_egl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 24 matching lines...) Expand all
35 #ifndef EGL_ANGLE_display_texture_share_group 35 #ifndef EGL_ANGLE_display_texture_share_group
36 #define EGL_ANGLE_display_texture_share_group 1 36 #define EGL_ANGLE_display_texture_share_group 1
37 #define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x3AAF 37 #define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x3AAF
38 #endif /* EGL_ANGLE_display_texture_share_group */ 38 #endif /* EGL_ANGLE_display_texture_share_group */
39 39
40 #ifndef EGL_ANGLE_create_context_client_arrays 40 #ifndef EGL_ANGLE_create_context_client_arrays
41 #define EGL_ANGLE_create_context_client_arrays 1 41 #define EGL_ANGLE_create_context_client_arrays 1
42 #define EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE 0x3452 42 #define EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE 0x3452
43 #endif /* EGL_ANGLE_create_context_client_arrays */ 43 #endif /* EGL_ANGLE_create_context_client_arrays */
44 44
45 #ifndef EGL_CONTEXT_PRIORITY_LEVEL_IMG
46 #define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
47 #define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
48 #define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
49 #define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
50 #endif /* EGL_CONTEXT_PRIORITY_LEVEL */
51
45 using ui::GetLastEGLErrorString; 52 using ui::GetLastEGLErrorString;
46 53
47 namespace gl { 54 namespace gl {
48 55
49 GLContextEGL::GLContextEGL(GLShareGroup* share_group) 56 GLContextEGL::GLContextEGL(GLShareGroup* share_group)
50 : GLContextReal(share_group), 57 : GLContextReal(share_group),
51 context_(nullptr), 58 context_(nullptr),
52 display_(nullptr), 59 display_(nullptr),
53 config_(nullptr), 60 config_(nullptr),
54 unbind_fbo_on_makecurrent_(false) {} 61 unbind_fbo_on_makecurrent_(false) {}
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 133 }
127 134
128 if (GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported()) { 135 if (GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported()) {
129 context_attributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE); 136 context_attributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
130 context_attributes.push_back( 137 context_attributes.push_back(
131 attribs.webgl_compatibility_context ? EGL_TRUE : EGL_FALSE); 138 attribs.webgl_compatibility_context ? EGL_TRUE : EGL_FALSE);
132 } else { 139 } else {
133 DCHECK(!attribs.webgl_compatibility_context); 140 DCHECK(!attribs.webgl_compatibility_context);
134 } 141 }
135 142
143 if (GLSurfaceEGL::IsEGLContextPrioritySupported()) {
144 // Medium priority is the default, only set the attribute if
145 // a different priority is requested.
146 if (attribs.context_priority == ContextPriorityLow) {
147 DVLOG(1) << __FUNCTION__ << ": setting ContextPriorityLow";
148 context_attributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG);
149 context_attributes.push_back(EGL_CONTEXT_PRIORITY_LOW_IMG);
150 } else if (attribs.context_priority == ContextPriorityHigh) {
151 DVLOG(1) << __FUNCTION__ << ": setting ContextPriorityHigh";
152 context_attributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG);
153 context_attributes.push_back(EGL_CONTEXT_PRIORITY_HIGH_IMG);
154 }
155 }
156
136 if (GLSurfaceEGL::HasEGLExtension("EGL_ANGLE_display_texture_share_group")) { 157 if (GLSurfaceEGL::HasEGLExtension("EGL_ANGLE_display_texture_share_group")) {
137 context_attributes.push_back(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE); 158 context_attributes.push_back(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE);
138 context_attributes.push_back( 159 context_attributes.push_back(
139 attribs.global_texture_share_group ? EGL_TRUE : EGL_FALSE); 160 attribs.global_texture_share_group ? EGL_TRUE : EGL_FALSE);
140 } else { 161 } else {
141 DCHECK(!attribs.global_texture_share_group); 162 DCHECK(!attribs.global_texture_share_group);
142 } 163 }
143 164
144 if (GLSurfaceEGL::HasEGLExtension("EGL_ANGLE_create_context_client_arrays")) { 165 if (GLSurfaceEGL::HasEGLExtension("EGL_ANGLE_create_context_client_arrays")) {
145 // Disable client arrays if the context supports it 166 // Disable client arrays if the context supports it
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 302
282 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { 303 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() {
283 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); 304 return GLSurfaceEGL::IsCreateContextRobustnessSupported();
284 } 305 }
285 306
286 GLContextEGL::~GLContextEGL() { 307 GLContextEGL::~GLContextEGL() {
287 Destroy(); 308 Destroy();
288 } 309 }
289 310
290 } // namespace gl 311 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_surface_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698