Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/common/gpu/media/rendering_helper.h" | 5 #include "content/common/gpu/media/rendering_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/mac/scoped_nsautorelease_pool.h" | 8 #include "base/mac/scoped_nsautorelease_pool.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/stringize_macros.h" | 10 #include "base/strings/stringize_macros.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 #else | 150 #else |
| 151 x_display_ = gfx::GetXDisplay(); | 151 x_display_ = gfx::GetXDisplay(); |
| 152 CHECK(x_display_); | 152 CHECK(x_display_); |
| 153 native_display = x_display_; | 153 native_display = x_display_; |
| 154 | 154 |
| 155 Screen* screen = DefaultScreenOfDisplay(x_display_); | 155 Screen* screen = DefaultScreenOfDisplay(x_display_); |
| 156 window_size = gfx::Size(XWidthOfScreen(screen), XHeightOfScreen(screen)); | 156 window_size = gfx::Size(XWidthOfScreen(screen), XHeightOfScreen(screen)); |
| 157 #endif | 157 #endif |
| 158 gl_display_ = eglGetDisplay(native_display); | 158 gl_display_ = eglGetDisplay(native_display); |
| 159 CHECK(gl_display_); | 159 CHECK(gl_display_); |
| 160 CHECK(eglInitialize(gl_display_, NULL, NULL)) << glGetError(); | 160 CHECK(eglInitialize(gl_display_, NULL, NULL)) << eglGetError(); |
| 161 | 161 |
| 162 static EGLint rgba8888[] = { | 162 static EGLint rgba8888[] = { |
| 163 EGL_RED_SIZE, 8, | 163 EGL_RED_SIZE, 8, |
| 164 EGL_GREEN_SIZE, 8, | 164 EGL_GREEN_SIZE, 8, |
| 165 EGL_BLUE_SIZE, 8, | 165 EGL_BLUE_SIZE, 8, |
| 166 EGL_ALPHA_SIZE, 8, | 166 EGL_ALPHA_SIZE, 8, |
| 167 EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | 167 EGL_SURFACE_TYPE, EGL_WINDOW_BIT, |
| 168 EGL_NONE, | 168 EGL_NONE, |
| 169 }; | 169 }; |
| 170 EGLConfig egl_config; | 170 EGLConfig egl_config; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 CHECK_EQ(base::MessageLoop::current(), message_loop_); | 391 CHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 392 render_timer_.Stop(); | 392 render_timer_.Stop(); |
| 393 if (render_as_thumbnails_) { | 393 if (render_as_thumbnails_) { |
| 394 glDeleteTextures(1, &thumbnails_texture_id_); | 394 glDeleteTextures(1, &thumbnails_texture_id_); |
| 395 glDeleteFramebuffersEXT(1, &thumbnails_fbo_id_); | 395 glDeleteFramebuffersEXT(1, &thumbnails_fbo_id_); |
| 396 } | 396 } |
| 397 #if GL_VARIANT_GLX | 397 #if GL_VARIANT_GLX |
| 398 | 398 |
| 399 glXDestroyContext(x_display_, gl_context_); | 399 glXDestroyContext(x_display_, gl_context_); |
| 400 #else // EGL | 400 #else // EGL |
| 401 CHECK(eglMakeCurrent( | |
|
Pawel Osciak
2014/06/19 03:59:23
Don't we need to glxMakeCurrent for GLX above as w
Owen Lin
2014/06/19 05:21:33
No, it only needed for EGL.
https://chromiumcoder
| |
| 402 gl_display_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) | |
| 403 << eglGetError(); | |
| 401 CHECK(eglDestroyContext(gl_display_, gl_context_)); | 404 CHECK(eglDestroyContext(gl_display_, gl_context_)); |
| 402 CHECK(eglDestroySurface(gl_display_, gl_surface_)); | 405 CHECK(eglDestroySurface(gl_display_, gl_surface_)); |
| 403 CHECK(eglTerminate(gl_display_)); | 406 CHECK(eglTerminate(gl_display_)); |
| 404 #endif | 407 #endif |
| 405 gfx::ClearGLBindings(); | 408 gfx::ClearGLBindings(); |
| 406 Clear(); | 409 Clear(); |
| 407 done->Signal(); | 410 done->Signal(); |
| 408 } | 411 } |
| 409 | 412 |
| 410 void RenderingHelper::CreateTexture(int window_id, | 413 void RenderingHelper::CreateTexture(int window_id, |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 } | 591 } |
| 589 | 592 |
| 590 #if GL_VARIANT_GLX | 593 #if GL_VARIANT_GLX |
| 591 glXSwapBuffers(x_display_, x_window_); | 594 glXSwapBuffers(x_display_, x_window_); |
| 592 #else // EGL | 595 #else // EGL |
| 593 eglSwapBuffers(gl_display_, gl_surface_); | 596 eglSwapBuffers(gl_display_, gl_surface_); |
| 594 CHECK_EQ(static_cast<int>(eglGetError()), EGL_SUCCESS); | 597 CHECK_EQ(static_cast<int>(eglGetError()), EGL_SUCCESS); |
| 595 #endif | 598 #endif |
| 596 } | 599 } |
| 597 } // namespace content | 600 } // namespace content |
| OLD | NEW |