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

Side by Side Diff: content/common/gpu/media/rendering_helper_gl.cc

Issue 10736006: Fix OMX VDA unittest for ARM. (Closed) Base URL: https://git.chromium.org/git/chromium/src@master
Patch Set: Created 8 years, 5 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 | « no previous file | content/content_tests.gypi » ('j') | 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 "content/common/gpu/media/rendering_helper.h" 5 #include "content/common/gpu/media/rendering_helper.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #if defined(OS_WIN) || defined(ARCH_CPU_ARMEL) 9 #if defined(OS_WIN) || defined(ARCH_CPU_ARMEL)
10 #include "third_party/angle/include/EGL/egl.h" // Must precede ui/gl headers! 10 #include "third_party/angle/include/EGL/egl.h" // Must precede ui/gl headers!
11 #endif 11 #endif
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/mac/scoped_nsautorelease_pool.h" 14 #include "base/mac/scoped_nsautorelease_pool.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/stringize_macros.h" 16 #include "base/stringize_macros.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #if !defined(ARCH_CPU_ARMEL)
18 #include "ui/gl/gl_bindings.h" 19 #include "ui/gl/gl_bindings.h"
19 #include "ui/gl/gl_context.h" 20 #include "ui/gl/gl_context.h"
20 #include "ui/gl/gl_implementation.h" 21 #include "ui/gl/gl_implementation.h"
21 #include "ui/gl/gl_surface.h" 22 #include "ui/gl/gl_surface.h"
23 #else
24 #include "third_party/angle/include/GLES2/gl2.h"
25 #endif
22 26
23 #if !defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY) 27 #if !defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY)
24 #define GL_VARIANT_GLX 1 28 #define GL_VARIANT_GLX 1
25 typedef GLXWindow NativeWindowType; 29 typedef GLXWindow NativeWindowType;
26 typedef GLXContext NativeContextType; 30 typedef GLXContext NativeContextType;
27 struct ScopedPtrXFree { 31 struct ScopedPtrXFree {
28 void operator()(void* x) const { ::XFree(x); } 32 void operator()(void* x) const { ::XFree(x); }
29 }; 33 };
30 #else 34 #else
31 #define GL_VARIANT_EGL 1 35 #define GL_VARIANT_EGL 1
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 suppress_swap_to_display_ = suppress_swap_to_display; 178 suppress_swap_to_display_ = suppress_swap_to_display;
175 CHECK_GT(width, 0); 179 CHECK_GT(width, 0);
176 CHECK_GT(height, 0); 180 CHECK_GT(height, 0);
177 width_ = width; 181 width_ = width;
178 height_ = height; 182 height_ = height;
179 message_loop_ = MessageLoop::current(); 183 message_loop_ = MessageLoop::current();
180 CHECK_GT(num_windows, 0); 184 CHECK_GT(num_windows, 0);
181 185
182 #if GL_VARIANT_GLX 186 #if GL_VARIANT_GLX
183 x_display_ = base::MessagePumpForUI::GetDefaultXDisplay(); 187 x_display_ = base::MessagePumpForUI::GetDefaultXDisplay();
188 CHECK(x_display_);
184 gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); 189 gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL);
185 CHECK(glXQueryVersion(x_display_, NULL, NULL)); 190 CHECK(glXQueryVersion(x_display_, NULL, NULL));
186 const int fbconfig_attr[] = { 191 const int fbconfig_attr[] = {
187 GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, 192 GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
188 GLX_RENDER_TYPE, GLX_RGBA_BIT, 193 GLX_RENDER_TYPE, GLX_RGBA_BIT,
189 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, 194 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT,
190 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE, 195 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE,
191 GLX_Y_INVERTED_EXT, GL_FALSE, 196 GLX_Y_INVERTED_EXT, GL_FALSE,
192 GLX_RED_SIZE, 1, 197 GLX_RED_SIZE, 1,
193 GLX_GREEN_SIZE, 1, 198 GLX_GREEN_SIZE, 1,
194 GLX_BLUE_SIZE, 1, 199 GLX_BLUE_SIZE, 1,
195 GLX_ALPHA_SIZE, 1, 200 GLX_ALPHA_SIZE, 1,
196 GLX_DOUBLEBUFFER, True, 201 GLX_DOUBLEBUFFER, True,
197 GL_NONE, 202 GL_NONE,
198 }; 203 };
199 int num_fbconfigs; 204 int num_fbconfigs;
200 scoped_ptr_malloc<GLXFBConfig, ScopedPtrXFree> glx_fb_configs( 205 scoped_ptr_malloc<GLXFBConfig, ScopedPtrXFree> glx_fb_configs(
201 glXChooseFBConfig(x_display_, DefaultScreen(x_display_), fbconfig_attr, 206 glXChooseFBConfig(x_display_, DefaultScreen(x_display_), fbconfig_attr,
202 &num_fbconfigs)); 207 &num_fbconfigs));
203 CHECK(glx_fb_configs.get()); 208 CHECK(glx_fb_configs.get());
204 CHECK_GT(num_fbconfigs, 0); 209 CHECK_GT(num_fbconfigs, 0);
205 x_visual_ = glXGetVisualFromFBConfig(x_display_, glx_fb_configs.get()[0]); 210 x_visual_ = glXGetVisualFromFBConfig(x_display_, glx_fb_configs.get()[0]);
206 CHECK(x_visual_); 211 CHECK(x_visual_);
207 gl_context_ = glXCreateContext(x_display_, x_visual_, 0, true); 212 gl_context_ = glXCreateContext(x_display_, x_visual_, 0, true);
208 CHECK(gl_context_); 213 CHECK(gl_context_);
209 214
210 #else // EGL 215 #else // EGL
211 #if defined(OS_WIN) 216 #if defined(OS_WIN)
212 gl_display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY); 217 gl_display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
218 CHECK(gl_display_);
213 CHECK(eglInitialize(gl_display_, NULL, NULL)) << glGetError(); 219 CHECK(eglInitialize(gl_display_, NULL, NULL)) << glGetError();
214 #else 220 #else
215 x_display_ = base::MessagePumpForUI::GetDefaultXDisplay(); 221 x_display_ = base::MessagePumpForUI::GetDefaultXDisplay();
222 CHECK(x_display_);
216 gl_display_ = eglGetDisplay(x_display_); 223 gl_display_ = eglGetDisplay(x_display_);
224 CHECK(gl_display_);
217 CHECK(eglInitialize(gl_display_, NULL, NULL)) << glGetError(); 225 CHECK(eglInitialize(gl_display_, NULL, NULL)) << glGetError();
218 #endif 226 #endif
219 static EGLint rgba8888[] = { 227 static EGLint rgba8888[] = {
220 EGL_RED_SIZE, 8, 228 EGL_RED_SIZE, 8,
221 EGL_GREEN_SIZE, 8, 229 EGL_GREEN_SIZE, 8,
222 EGL_BLUE_SIZE, 8, 230 EGL_BLUE_SIZE, 8,
223 EGL_ALPHA_SIZE, 8, 231 EGL_ALPHA_SIZE, 8,
224 EGL_SURFACE_TYPE, EGL_WINDOW_BIT, 232 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
225 EGL_NONE, 233 EGL_NONE,
226 }; 234 };
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 CHECK(XUnmapWindow(x_display_, x_windows_[i])); 443 CHECK(XUnmapWindow(x_display_, x_windows_[i]));
436 CHECK(XDestroyWindow(x_display_, x_windows_[i])); 444 CHECK(XDestroyWindow(x_display_, x_windows_[i]));
437 } 445 }
438 // Mimic newly created object. 446 // Mimic newly created object.
439 x_display_ = NULL; 447 x_display_ = NULL;
440 x_windows_.clear(); 448 x_windows_.clear();
441 #endif 449 #endif
442 } 450 }
443 451
444 } // namespace video_test_util 452 } // namespace video_test_util
OLDNEW
« no previous file with comments | « no previous file | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698