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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_context_egl.cc
diff --git a/ui/gl/gl_context_egl.cc b/ui/gl/gl_context_egl.cc
index d9c15e7d6ab6dab2b9b3da7ea67d3f27a0743beb..2fbfe08205aa79c74c3a22324da147a1785c823d 100644
--- a/ui/gl/gl_context_egl.cc
+++ b/ui/gl/gl_context_egl.cc
@@ -42,6 +42,13 @@ extern "C" {
#define EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE 0x3452
#endif /* EGL_ANGLE_create_context_client_arrays */
+#ifndef EGL_CONTEXT_PRIORITY_LEVEL_IMG
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif /* EGL_CONTEXT_PRIORITY_LEVEL */
+
using ui::GetLastEGLErrorString;
namespace gl {
@@ -133,6 +140,20 @@ bool GLContextEGL::Initialize(GLSurface* compatible_surface,
DCHECK(!attribs.webgl_compatibility_context);
}
+ if (GLSurfaceEGL::IsEGLContextPrioritySupported()) {
+ // Medium priority is the default, only set the attribute if
+ // a different priority is requested.
+ if (attribs.context_priority == ContextPriorityLow) {
+ DVLOG(1) << __FUNCTION__ << ": setting ContextPriorityLow";
+ context_attributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG);
+ context_attributes.push_back(EGL_CONTEXT_PRIORITY_LOW_IMG);
+ } else if (attribs.context_priority == ContextPriorityHigh) {
+ DVLOG(1) << __FUNCTION__ << ": setting ContextPriorityHigh";
+ context_attributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG);
+ context_attributes.push_back(EGL_CONTEXT_PRIORITY_HIGH_IMG);
+ }
+ }
+
if (GLSurfaceEGL::HasEGLExtension("EGL_ANGLE_display_texture_share_group")) {
context_attributes.push_back(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE);
context_attributes.push_back(
« 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