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

Side by Side Diff: media/renderers/video_overlay_factory.cc

Issue 2648893002: Remove remaining traces of CreateGpuMemoryBufferImageCHROMIUM (Closed)
Patch Set: Rebase, but don't pull in extra changes... Created 3 years, 10 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 | « gpu/ipc/in_process_command_buffer.cc ('k') | ppapi/proxy/ppapi_command_buffer_proxy.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "media/renderers/video_overlay_factory.h" 5 #include "media/renderers/video_overlay_factory.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "gpu/GLES2/gl2extchromium.h" 8 #include "gpu/GLES2/gl2extchromium.h"
9 #include "gpu/command_buffer/client/gles2_interface.h" 9 #include "gpu/command_buffer/client/gles2_interface.h"
10 #include "gpu/command_buffer/common/mailbox.h" 10 #include "gpu/command_buffer/common/mailbox.h"
11 #include "gpu/command_buffer/common/sync_token.h" 11 #include "gpu/command_buffer/common/sync_token.h"
12 #include "media/base/video_frame.h" 12 #include "media/base/video_frame.h"
13 #include "media/renderers/gpu_video_accelerator_factories.h" 13 #include "media/renderers/gpu_video_accelerator_factories.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 class VideoOverlayFactory::Texture { 17 class VideoOverlayFactory::Texture {
18 public: 18 public:
19 explicit Texture(GpuVideoAcceleratorFactories* gpu_factories) 19 explicit Texture(GpuVideoAcceleratorFactories* gpu_factories)
20 : gpu_factories_(gpu_factories), image_id_(0), texture_id_(0) { 20 : gpu_factories_(gpu_factories), image_id_(0), texture_id_(0) {
21 DCHECK(gpu_factories_); 21 DCHECK(gpu_factories_);
22 DCHECK(gpu_factories_->GetTaskRunner()->BelongsToCurrentThread()); 22 DCHECK(gpu_factories_->GetTaskRunner()->BelongsToCurrentThread());
23 23
24 std::unique_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock> lock( 24 std::unique_ptr<GpuVideoAcceleratorFactories::ScopedGLContextLock> lock(
25 gpu_factories_->GetGLContextLock()); 25 gpu_factories_->GetGLContextLock());
26 if (lock) { 26 if (lock) {
27 gpu::gles2::GLES2Interface* gl = lock->ContextGL(); 27 gpu::gles2::GLES2Interface* gl = lock->ContextGL();
28 image_id_ = gl->CreateGpuMemoryBufferImageCHROMIUM( 28 gpu_memory_buffer_ = gpu_factories_->CreateGpuMemoryBuffer(
29 1, 1, GL_RGBA, GL_READ_WRITE_CHROMIUM); 29 gfx::Size(1, 1), gfx::BufferFormat::RGBA_8888,
30 gfx::BufferUsage::SCANOUT);
31 if (gpu_memory_buffer_) {
32 image_id_ = gl->CreateImageCHROMIUM(
33 gpu_memory_buffer_->AsClientBuffer(), 1, 1, GL_RGBA);
34 }
30 if (image_id_) { 35 if (image_id_) {
31 gl->GenTextures(1, &texture_id_); 36 gl->GenTextures(1, &texture_id_);
32 gl->BindTexture(GL_TEXTURE_2D, texture_id_); 37 gl->BindTexture(GL_TEXTURE_2D, texture_id_);
33 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_); 38 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_);
34 39
35 gl->GenMailboxCHROMIUM(mailbox_.name); 40 gl->GenMailboxCHROMIUM(mailbox_.name);
36 gl->ProduceTextureDirectCHROMIUM(texture_id_, GL_TEXTURE_2D, 41 gl->ProduceTextureDirectCHROMIUM(texture_id_, GL_TEXTURE_2D,
37 mailbox_.name); 42 mailbox_.name);
38 43
39 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); 44 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
(...skipping 18 matching lines...) Expand all
58 } 63 }
59 } 64 }
60 } 65 }
61 66
62 bool IsValid() const { return image_id_ != 0; } 67 bool IsValid() const { return image_id_ != 0; }
63 68
64 private: 69 private:
65 friend class VideoOverlayFactory; 70 friend class VideoOverlayFactory;
66 GpuVideoAcceleratorFactories* gpu_factories_; 71 GpuVideoAcceleratorFactories* gpu_factories_;
67 72
73 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_;
68 GLuint image_id_; 74 GLuint image_id_;
69 GLuint texture_id_; 75 GLuint texture_id_;
70 gpu::Mailbox mailbox_; 76 gpu::Mailbox mailbox_;
71 gpu::SyncToken sync_token_; 77 gpu::SyncToken sync_token_;
72 }; 78 };
73 79
74 VideoOverlayFactory::VideoOverlayFactory( 80 VideoOverlayFactory::VideoOverlayFactory(
75 GpuVideoAcceleratorFactories* gpu_factories) 81 GpuVideoAcceleratorFactories* gpu_factories)
76 : gpu_factories_(gpu_factories) {} 82 : gpu_factories_(gpu_factories) {}
77 83
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return nullptr; 118 return nullptr;
113 119
114 // Lazily create overlay texture. 120 // Lazily create overlay texture.
115 if (!texture_) 121 if (!texture_)
116 texture_.reset(new Texture(gpu_factories_)); 122 texture_.reset(new Texture(gpu_factories_));
117 123
118 return texture_->IsValid() ? texture_.get() : nullptr; 124 return texture_->IsValid() ? texture_.get() : nullptr;
119 } 125 }
120 126
121 } // namespace media 127 } // namespace media
OLDNEW
« no previous file with comments | « gpu/ipc/in_process_command_buffer.cc ('k') | ppapi/proxy/ppapi_command_buffer_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698