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

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

Issue 10392141: Plumb texture target to VideoDecodeAccelerator::Client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win build Created 8 years, 6 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
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 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/mac/scoped_nsautorelease_pool.h" 10 #include "base/mac/scoped_nsautorelease_pool.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 virtual ~RenderingHelperEGL(); 50 virtual ~RenderingHelperEGL();
51 51
52 // Implement RenderingHelper. 52 // Implement RenderingHelper.
53 virtual void Initialize(bool suppress_swap_to_display, 53 virtual void Initialize(bool suppress_swap_to_display,
54 int num_windows, 54 int num_windows,
55 int width, 55 int width,
56 int height, 56 int height,
57 base::WaitableEvent* done) OVERRIDE; 57 base::WaitableEvent* done) OVERRIDE;
58 virtual void UnInitialize(base::WaitableEvent* done) OVERRIDE; 58 virtual void UnInitialize(base::WaitableEvent* done) OVERRIDE;
59 virtual void CreateTexture(int window_id, 59 virtual void CreateTexture(int window_id,
60 uint32 texture_target,
60 uint32* texture_id, 61 uint32* texture_id,
61 base::WaitableEvent* done) OVERRIDE; 62 base::WaitableEvent* done) OVERRIDE;
62 virtual void RenderTexture(uint32 texture_id) OVERRIDE; 63 virtual void RenderTexture(uint32 texture_id) OVERRIDE;
63 virtual void DeleteTexture(uint32 texture_id) OVERRIDE; 64 virtual void DeleteTexture(uint32 texture_id) OVERRIDE;
64 virtual void* GetGLContext() OVERRIDE; 65 virtual void* GetGLContext() OVERRIDE;
65 virtual void* GetGLDisplay() OVERRIDE; 66 virtual void* GetGLDisplay() OVERRIDE;
66 67
67 private: 68 private:
68 void Clear(); 69 void Clear();
69 70
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 EGL_NO_CONTEXT)) << eglGetError(); 239 EGL_NO_CONTEXT)) << eglGetError();
239 CHECK(eglDestroyContext(egl_display_, egl_context_)); 240 CHECK(eglDestroyContext(egl_display_, egl_context_));
240 for (size_t i = 0; i < egl_surfaces_.size(); ++i) 241 for (size_t i = 0; i < egl_surfaces_.size(); ++i)
241 CHECK(eglDestroySurface(egl_display_, egl_surfaces_[i])); 242 CHECK(eglDestroySurface(egl_display_, egl_surfaces_[i]));
242 CHECK(eglTerminate(egl_display_)); 243 CHECK(eglTerminate(egl_display_));
243 Clear(); 244 Clear();
244 done->Signal(); 245 done->Signal();
245 } 246 }
246 247
247 void RenderingHelperEGL::CreateTexture(int window_id, 248 void RenderingHelperEGL::CreateTexture(int window_id,
249 uint32 texture_target,
248 uint32* texture_id, 250 uint32* texture_id,
249 base::WaitableEvent* done) { 251 base::WaitableEvent* done) {
250 if (MessageLoop::current() != message_loop_) { 252 if (MessageLoop::current() != message_loop_) {
251 message_loop_->PostTask( 253 message_loop_->PostTask(
252 FROM_HERE, 254 FROM_HERE,
253 base::Bind(&RenderingHelper::CreateTexture, base::Unretained(this), 255 base::Bind(&RenderingHelper::CreateTexture, base::Unretained(this),
254 window_id, texture_id, done)); 256 window_id, texture_target, texture_id, done));
255 return; 257 return;
256 } 258 }
259 CHECK_EQ(static_cast<uint32>(GL_TEXTURE_2D), texture_target);
257 CHECK(eglMakeCurrent(egl_display_, egl_surfaces_[window_id], 260 CHECK(eglMakeCurrent(egl_display_, egl_surfaces_[window_id],
258 egl_surfaces_[window_id], egl_context_)) 261 egl_surfaces_[window_id], egl_context_))
259 << eglGetError(); 262 << eglGetError();
260 glGenTextures(1, texture_id); 263 glGenTextures(1, texture_id);
261 glBindTexture(GL_TEXTURE_2D, *texture_id); 264 glBindTexture(GL_TEXTURE_2D, *texture_id);
262 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0, GL_RGBA, 265 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0, GL_RGBA,
263 GL_UNSIGNED_BYTE, NULL); 266 GL_UNSIGNED_BYTE, NULL);
264 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 267 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
265 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 268 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
266 // OpenGLES2.0.25 section 3.8.2 requires CLAMP_TO_EDGE for NPOT textures. 269 // OpenGLES2.0.25 section 3.8.2 requires CLAMP_TO_EDGE for NPOT textures.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 x_windows_.push_back(x_window); 382 x_windows_.push_back(x_window);
380 XStoreName(x_display_, x_window, "VideoDecodeAcceleratorTest"); 383 XStoreName(x_display_, x_window, "VideoDecodeAcceleratorTest");
381 XSelectInput(x_display_, x_window, ExposureMask); 384 XSelectInput(x_display_, x_window, ExposureMask);
382 XMapWindow(x_display_, x_window); 385 XMapWindow(x_display_, x_window);
383 return x_window; 386 return x_window;
384 } 387 }
385 388
386 #endif // OS_WIN 389 #endif // OS_WIN
387 390
388 } // namespace video_test_util 391 } // namespace video_test_util
OLDNEW
« no previous file with comments | « content/common/gpu/media/rendering_helper.h ('k') | content/common/gpu/media/rendering_helper_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698