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

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

Issue 1538803004: Create child window in GPU process for DirectComposition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
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 #if defined(OS_ANDROID) 7 #if defined(OS_ANDROID)
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 #endif 9 #endif
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 EGLConfig g_config; 97 EGLConfig g_config;
98 EGLDisplay g_display; 98 EGLDisplay g_display;
99 EGLNativeDisplayType g_native_display; 99 EGLNativeDisplayType g_native_display;
100 100
101 const char* g_egl_extensions = NULL; 101 const char* g_egl_extensions = NULL;
102 bool g_egl_create_context_robustness_supported = false; 102 bool g_egl_create_context_robustness_supported = false;
103 bool g_egl_sync_control_supported = false; 103 bool g_egl_sync_control_supported = false;
104 bool g_egl_window_fixed_size_supported = false; 104 bool g_egl_window_fixed_size_supported = false;
105 bool g_egl_surfaceless_context_supported = false; 105 bool g_egl_surfaceless_context_supported = false;
106 bool g_use_direct_composition = false;
106 107
107 class EGLSyncControlVSyncProvider 108 class EGLSyncControlVSyncProvider
108 : public gfx::SyncControlVSyncProvider { 109 : public gfx::SyncControlVSyncProvider {
109 public: 110 public:
110 explicit EGLSyncControlVSyncProvider(EGLSurface surface) 111 explicit EGLSyncControlVSyncProvider(EGLSurface surface)
111 : SyncControlVSyncProvider(), 112 : SyncControlVSyncProvider(),
112 surface_(surface) { 113 surface_(surface) {
113 } 114 }
114 115
115 ~EGLSyncControlVSyncProvider() override {} 116 ~EGLSyncControlVSyncProvider() override {}
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 355 }
355 356
356 g_egl_extensions = eglQueryString(g_display, EGL_EXTENSIONS); 357 g_egl_extensions = eglQueryString(g_display, EGL_EXTENSIONS);
357 g_egl_create_context_robustness_supported = 358 g_egl_create_context_robustness_supported =
358 HasEGLExtension("EGL_EXT_create_context_robustness"); 359 HasEGLExtension("EGL_EXT_create_context_robustness");
359 g_egl_sync_control_supported = 360 g_egl_sync_control_supported =
360 HasEGLExtension("EGL_CHROMIUM_sync_control"); 361 HasEGLExtension("EGL_CHROMIUM_sync_control");
361 g_egl_window_fixed_size_supported = 362 g_egl_window_fixed_size_supported =
362 HasEGLExtension("EGL_ANGLE_window_fixed_size"); 363 HasEGLExtension("EGL_ANGLE_window_fixed_size");
363 364
365 g_use_direct_composition = base::CommandLine::ForCurrentProcess()->HasSwitch(
366 switches::kUseDirectComposition);
367
364 // TODO(oetuaho@nvidia.com): Surfaceless is disabled on Android as a temporary 368 // TODO(oetuaho@nvidia.com): Surfaceless is disabled on Android as a temporary
365 // workaround, since code written for Android WebView takes different paths 369 // workaround, since code written for Android WebView takes different paths
366 // based on whether GL surface objects have underlying EGL surface handles, 370 // based on whether GL surface objects have underlying EGL surface handles,
367 // conflicting with the use of surfaceless. See https://crbug.com/382349 371 // conflicting with the use of surfaceless. See https://crbug.com/382349
368 #if defined(OS_ANDROID) 372 #if defined(OS_ANDROID)
369 DCHECK(!g_egl_surfaceless_context_supported); 373 DCHECK(!g_egl_surfaceless_context_supported);
370 #else 374 #else
371 // Check if SurfacelessEGL is supported. 375 // Check if SurfacelessEGL is supported.
372 g_egl_surfaceless_context_supported = 376 g_egl_surfaceless_context_supported =
373 HasEGLExtension("EGL_KHR_surfaceless_context"); 377 HasEGLExtension("EGL_KHR_surfaceless_context");
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 420 }
417 421
418 bool GLSurfaceEGL::IsCreateContextRobustnessSupported() { 422 bool GLSurfaceEGL::IsCreateContextRobustnessSupported() {
419 return g_egl_create_context_robustness_supported; 423 return g_egl_create_context_robustness_supported;
420 } 424 }
421 425
422 bool GLSurfaceEGL::IsEGLSurfacelessContextSupported() { 426 bool GLSurfaceEGL::IsEGLSurfacelessContextSupported() {
423 return g_egl_surfaceless_context_supported; 427 return g_egl_surfaceless_context_supported;
424 } 428 }
425 429
430 bool GLSurfaceEGL::IsDirectCompositionSupported() {
431 return g_use_direct_composition;
432 }
433
426 GLSurfaceEGL::~GLSurfaceEGL() {} 434 GLSurfaceEGL::~GLSurfaceEGL() {}
427 435
428 // InitializeDisplay is necessary because the static binding code 436 // InitializeDisplay is necessary because the static binding code
429 // needs a full Display init before it can query the Display extensions. 437 // needs a full Display init before it can query the Display extensions.
430 // static 438 // static
431 EGLDisplay GLSurfaceEGL::InitializeDisplay() { 439 EGLDisplay GLSurfaceEGL::InitializeDisplay() {
432 if (g_display != EGL_NO_DISPLAY) { 440 if (g_display != EGL_NO_DISPLAY) {
433 return g_display; 441 return g_display;
434 } 442 }
435 443
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 486 }
479 } 487 }
480 488
481 return g_display; 489 return g_display;
482 } 490 }
483 491
484 NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL(EGLNativeWindowType window) 492 NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL(EGLNativeWindowType window)
485 : window_(window), 493 : window_(window),
486 config_(NULL), 494 config_(NULL),
487 size_(1, 1), 495 size_(1, 1),
496 alpha_(true),
497 enable_fixed_size_angle_(false),
488 surface_(NULL), 498 surface_(NULL),
489 supports_post_sub_buffer_(false), 499 supports_post_sub_buffer_(false),
490 alpha_(true),
491 swap_interval_(1) { 500 swap_interval_(1) {
492 #if defined(OS_ANDROID) 501 #if defined(OS_ANDROID)
493 if (window) 502 if (window)
494 ANativeWindow_acquire(window); 503 ANativeWindow_acquire(window);
495 #endif 504 #endif
496 505
497 #if defined(OS_WIN) 506 #if defined(OS_WIN)
498 vsync_override_ = false; 507 vsync_override_ = false;
499 swap_generation_ = 0; 508 swap_generation_ = 0;
500 RECT windowRect; 509 RECT windowRect;
(...skipping 17 matching lines...) Expand all
518 527
519 // We need to make sure that window_ is correctly initialized with all 528 // We need to make sure that window_ is correctly initialized with all
520 // the platform-dependant quirks, if any, before creating the surface. 529 // the platform-dependant quirks, if any, before creating the surface.
521 if (!InitializeNativeWindow()) { 530 if (!InitializeNativeWindow()) {
522 LOG(ERROR) << "Error trying to initialize the native window."; 531 LOG(ERROR) << "Error trying to initialize the native window.";
523 return false; 532 return false;
524 } 533 }
525 534
526 std::vector<EGLint> egl_window_attributes; 535 std::vector<EGLint> egl_window_attributes;
527 536
528 if (g_egl_window_fixed_size_supported) { 537 if (g_egl_window_fixed_size_supported && enable_fixed_size_angle_) {
529 egl_window_attributes.push_back(EGL_FIXED_SIZE_ANGLE); 538 egl_window_attributes.push_back(EGL_FIXED_SIZE_ANGLE);
530 egl_window_attributes.push_back(EGL_TRUE); 539 egl_window_attributes.push_back(EGL_TRUE);
531 egl_window_attributes.push_back(EGL_WIDTH); 540 egl_window_attributes.push_back(EGL_WIDTH);
532 egl_window_attributes.push_back(size_.width()); 541 egl_window_attributes.push_back(size_.width());
533 egl_window_attributes.push_back(EGL_HEIGHT); 542 egl_window_attributes.push_back(EGL_HEIGHT);
534 egl_window_attributes.push_back(size_.height()); 543 egl_window_attributes.push_back(size_.height());
535 } 544 }
536 545
537 if (gfx::g_driver_egl.ext.b_EGL_NV_post_sub_buffer) { 546 if (gfx::g_driver_egl.ext.b_EGL_NV_post_sub_buffer) {
538 egl_window_attributes.push_back(EGL_POST_SUB_BUFFER_SUPPORTED_NV); 547 egl_window_attributes.push_back(EGL_POST_SUB_BUFFER_SUPPORTED_NV);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 } 956 }
948 957
949 void* SurfacelessEGL::GetShareHandle() { 958 void* SurfacelessEGL::GetShareHandle() {
950 return NULL; 959 return NULL;
951 } 960 }
952 961
953 SurfacelessEGL::~SurfacelessEGL() { 962 SurfacelessEGL::~SurfacelessEGL() {
954 } 963 }
955 964
956 } // namespace gfx 965 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698