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

Side by Side Diff: ui/gl/gl_surface_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_surface_egl.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 #include "ui/gl/gl_surface_egl.h" 5 #include "ui/gl/gl_surface_egl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 EGLNativeDisplayType g_native_display = EGL_DEFAULT_DISPLAY; 121 EGLNativeDisplayType g_native_display = EGL_DEFAULT_DISPLAY;
122 122
123 const char* g_egl_extensions = nullptr; 123 const char* g_egl_extensions = nullptr;
124 bool g_egl_create_context_robustness_supported = false; 124 bool g_egl_create_context_robustness_supported = false;
125 bool g_egl_create_context_bind_generates_resource_supported = false; 125 bool g_egl_create_context_bind_generates_resource_supported = false;
126 bool g_egl_create_context_webgl_compatability_supported = false; 126 bool g_egl_create_context_webgl_compatability_supported = false;
127 bool g_egl_sync_control_supported = false; 127 bool g_egl_sync_control_supported = false;
128 bool g_egl_window_fixed_size_supported = false; 128 bool g_egl_window_fixed_size_supported = false;
129 bool g_egl_surfaceless_context_supported = false; 129 bool g_egl_surfaceless_context_supported = false;
130 bool g_egl_surface_orientation_supported = false; 130 bool g_egl_surface_orientation_supported = false;
131 bool g_egl_context_priority_supported = false;
131 bool g_use_direct_composition = false; 132 bool g_use_direct_composition = false;
132 133
133 class EGLSyncControlVSyncProvider : public SyncControlVSyncProvider { 134 class EGLSyncControlVSyncProvider : public SyncControlVSyncProvider {
134 public: 135 public:
135 explicit EGLSyncControlVSyncProvider(EGLSurface surface) 136 explicit EGLSyncControlVSyncProvider(EGLSurface surface)
136 : SyncControlVSyncProvider(), 137 : SyncControlVSyncProvider(),
137 surface_(surface) { 138 surface_(surface) {
138 } 139 }
139 140
140 ~EGLSyncControlVSyncProvider() override {} 141 ~EGLSyncControlVSyncProvider() override {}
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 g_egl_create_context_bind_generates_resource_supported = 519 g_egl_create_context_bind_generates_resource_supported =
519 HasEGLExtension("EGL_CHROMIUM_create_context_bind_generates_resource"); 520 HasEGLExtension("EGL_CHROMIUM_create_context_bind_generates_resource");
520 g_egl_create_context_webgl_compatability_supported = 521 g_egl_create_context_webgl_compatability_supported =
521 HasEGLExtension("EGL_ANGLE_create_context_webgl_compatibility"); 522 HasEGLExtension("EGL_ANGLE_create_context_webgl_compatibility");
522 g_egl_sync_control_supported = 523 g_egl_sync_control_supported =
523 HasEGLExtension("EGL_CHROMIUM_sync_control"); 524 HasEGLExtension("EGL_CHROMIUM_sync_control");
524 g_egl_window_fixed_size_supported = 525 g_egl_window_fixed_size_supported =
525 HasEGLExtension("EGL_ANGLE_window_fixed_size"); 526 HasEGLExtension("EGL_ANGLE_window_fixed_size");
526 g_egl_surface_orientation_supported = 527 g_egl_surface_orientation_supported =
527 HasEGLExtension("EGL_ANGLE_surface_orientation"); 528 HasEGLExtension("EGL_ANGLE_surface_orientation");
529 // According to https://source.android.com/compatibility/android-cdd.html the
530 // EGL_IMG_context_priority extension is mandatory for Virtual Reality High
531 // Performance support, but due to a bug in Android Nougat the extension
532 // isn't being reported even when it's present. As a fallback, check if other
533 // related extensions that were added for VR support are present, and assume
534 // that this implies context priority is also supported. See also:
535 // https://github.com/googlevr/gvr-android-sdk/issues/330
536 g_egl_context_priority_supported =
537 HasEGLExtension("EGL_IMG_context_priority") ||
538 (HasEGLExtension("EGL_ANDROID_front_buffer_auto_refresh") &&
539 HasEGLExtension("EGL_ANDROID_create_native_client_buffer"));
528 540
529 // Need EGL_ANGLE_flexible_surface_compatibility to allow surfaces with and 541 // Need EGL_ANGLE_flexible_surface_compatibility to allow surfaces with and
530 // without alpha to be bound to the same context. 542 // without alpha to be bound to the same context.
531 g_use_direct_composition = 543 g_use_direct_composition =
532 HasEGLExtension("EGL_ANGLE_direct_composition") && 544 HasEGLExtension("EGL_ANGLE_direct_composition") &&
533 HasEGLExtension("EGL_ANGLE_flexible_surface_compatibility") && 545 HasEGLExtension("EGL_ANGLE_flexible_surface_compatibility") &&
534 !base::CommandLine::ForCurrentProcess()->HasSwitch( 546 !base::CommandLine::ForCurrentProcess()->HasSwitch(
535 switches::kDisableDirectComposition); 547 switches::kDisableDirectComposition);
536 548
537 // TODO(oetuaho@nvidia.com): Surfaceless is disabled on Android as a temporary 549 // TODO(oetuaho@nvidia.com): Surfaceless is disabled on Android as a temporary
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 bool GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported() { 632 bool GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported() {
621 return g_egl_create_context_webgl_compatability_supported; 633 return g_egl_create_context_webgl_compatability_supported;
622 } 634 }
623 635
624 // static 636 // static
625 bool GLSurfaceEGL::IsEGLSurfacelessContextSupported() { 637 bool GLSurfaceEGL::IsEGLSurfacelessContextSupported() {
626 return g_egl_surfaceless_context_supported; 638 return g_egl_surfaceless_context_supported;
627 } 639 }
628 640
629 // static 641 // static
642 bool GLSurfaceEGL::IsEGLContextPrioritySupported() {
643 return g_egl_context_priority_supported;
644 }
645
646 // static
630 bool GLSurfaceEGL::IsDirectCompositionSupported() { 647 bool GLSurfaceEGL::IsDirectCompositionSupported() {
631 return g_use_direct_composition; 648 return g_use_direct_composition;
632 } 649 }
633 650
634 GLSurfaceEGL::~GLSurfaceEGL() {} 651 GLSurfaceEGL::~GLSurfaceEGL() {}
635 652
636 // InitializeDisplay is necessary because the static binding code 653 // InitializeDisplay is necessary because the static binding code
637 // needs a full Display init before it can query the Display extensions. 654 // needs a full Display init before it can query the Display extensions.
638 // static 655 // static
639 EGLDisplay GLSurfaceEGL::InitializeDisplay( 656 EGLDisplay GLSurfaceEGL::InitializeDisplay(
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 } 1205 }
1189 1206
1190 void* SurfacelessEGL::GetShareHandle() { 1207 void* SurfacelessEGL::GetShareHandle() {
1191 return NULL; 1208 return NULL;
1192 } 1209 }
1193 1210
1194 SurfacelessEGL::~SurfacelessEGL() { 1211 SurfacelessEGL::~SurfacelessEGL() {
1195 } 1212 }
1196 1213
1197 } // namespace gl 1214 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698