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

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

Issue 23438002: Adding functionality to paint and signal buffer swap for ozone surface factory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed SwapBuffers to SchedulePageFlip Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/ozone/surface_factory_ozone.cc ('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 // This include must be here so that the includes provided transitively 5 // This include must be here so that the includes provided transitively
6 // by gl_surface_egl.h don't make it impossible to compile this code. 6 // by gl_surface_egl.h don't make it impossible to compile this code.
7 #include "third_party/mesa/src/include/GL/osmesa.h" 7 #include "third_party/mesa/src/include/GL/osmesa.h"
8 8
9 #include "ui/gl/gl_surface_egl.h" 9 #include "ui/gl/gl_surface_egl.h"
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 } // namespace 94 } // namespace
95 95
96 GLSurfaceEGL::GLSurfaceEGL() {} 96 GLSurfaceEGL::GLSurfaceEGL() {}
97 97
98 bool GLSurfaceEGL::InitializeOneOff() { 98 bool GLSurfaceEGL::InitializeOneOff() {
99 static bool initialized = false; 99 static bool initialized = false;
100 if (initialized) 100 if (initialized)
101 return true; 101 return true;
102 102
103 #if defined (USE_OZONE)
104 ui::SurfaceFactoryOzone::GetInstance()->InitializeHardware();
105 #endif
106
107 #if defined(USE_X11) 103 #if defined(USE_X11)
108 g_native_display = base::MessagePumpForUI::GetDefaultXDisplay(); 104 g_native_display = base::MessagePumpForUI::GetDefaultXDisplay();
109 #elif defined(OS_WIN) 105 #elif defined(OS_WIN)
110 g_native_display = EGL_DEFAULT_DISPLAY; 106 g_native_display = EGL_DEFAULT_DISPLAY;
111 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11)) { 107 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11)) {
112 g_native_display = EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; 108 g_native_display = EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE;
113 } 109 }
110 #elif defined(USE_OZONE)
111 ui::SurfaceFactoryOzone* surface_factory =
112 ui::SurfaceFactoryOzone::GetInstance();
113 if (surface_factory->InitializeHardware() !=
114 ui::SurfaceFactoryOzone::INITIALIZED) {
115 LOG(ERROR) << "OZONE failed to initialize hardware";
116 return false;
117 }
118 g_native_display = reinterpret_cast<EGLNativeDisplayType>(
119 surface_factory->GetNativeDisplay());
114 #else 120 #else
115 g_native_display = EGL_DEFAULT_DISPLAY; 121 g_native_display = EGL_DEFAULT_DISPLAY;
116 #endif 122 #endif
117 g_display = eglGetDisplay(g_native_display); 123 g_display = eglGetDisplay(g_native_display);
118 if (!g_display) { 124 if (!g_display) {
119 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString(); 125 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString();
120 return false; 126 return false;
121 } 127 }
122 128
123 if (!eglInitialize(g_display, NULL, NULL)) { 129 if (!eglInitialize(g_display, NULL, NULL)) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 return false; 361 return false;
356 } 362 }
357 363
358 bool NativeViewGLSurfaceEGL::SwapBuffers() { 364 bool NativeViewGLSurfaceEGL::SwapBuffers() {
359 if (!eglSwapBuffers(GetDisplay(), surface_)) { 365 if (!eglSwapBuffers(GetDisplay(), surface_)) {
360 DVLOG(1) << "eglSwapBuffers failed with error " 366 DVLOG(1) << "eglSwapBuffers failed with error "
361 << GetLastEGLErrorString(); 367 << GetLastEGLErrorString();
362 return false; 368 return false;
363 } 369 }
364 370
371 #if defined(USE_OZONE)
372 if (!ui::SurfaceFactoryOzone::GetInstance()->SchedulePageFlip(window_)) {
piman 2013/08/28 19:18:57 This is weird. Why isn't it done by eglSwapBuffers
dnicoara 2013/08/29 21:27:14 Removed.
373 DVLOG(1) << "Ozone failed to SchedulePageFlip";
374 return false;
375 }
376 #endif
377
365 return true; 378 return true;
366 } 379 }
367 380
368 gfx::Size NativeViewGLSurfaceEGL::GetSize() { 381 gfx::Size NativeViewGLSurfaceEGL::GetSize() {
369 EGLint width; 382 EGLint width;
370 EGLint height; 383 EGLint height;
371 if (!eglQuerySurface(GetDisplay(), surface_, EGL_WIDTH, &width) || 384 if (!eglQuerySurface(GetDisplay(), surface_, EGL_WIDTH, &width) ||
372 !eglQuerySurface(GetDisplay(), surface_, EGL_HEIGHT, &height)) { 385 !eglQuerySurface(GetDisplay(), surface_, EGL_HEIGHT, &height)) {
373 NOTREACHED() << "eglQuerySurface failed with error " 386 NOTREACHED() << "eglQuerySurface failed with error "
374 << GetLastEGLErrorString(); 387 << GetLastEGLErrorString();
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 } 687 }
675 default: 688 default:
676 NOTREACHED(); 689 NOTREACHED();
677 return NULL; 690 return NULL;
678 } 691 }
679 } 692 }
680 693
681 #endif 694 #endif
682 695
683 } // namespace gfx 696 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/base/ozone/surface_factory_ozone.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698