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

Side by Side Diff: content/common/gpu/client/gl_helper.cc

Issue 132233041: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ff7262fa Rebase. Created 6 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 | 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/client/gl_helper.h" 5 #include "content/common/gpu/client/gl_helper.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "content/common/gpu/client/gl_helper_scaling.h" 18 #include "content/common/gpu/client/gl_helper_scaling.h"
19 #include "gpu/GLES2/gl2extchromium.h" 19 #include "gpu/GLES2/gl2extchromium.h"
20 #include "gpu/command_buffer/client/context_support.h" 20 #include "gpu/command_buffer/client/context_support.h"
21 #include "gpu/command_buffer/common/mailbox.h" 21 #include "gpu/command_buffer/common/mailbox.h"
22 #include "gpu/command_buffer/common/mailbox_holder.h"
22 #include "media/base/video_frame.h" 23 #include "media/base/video_frame.h"
23 #include "media/base/video_util.h" 24 #include "media/base/video_util.h"
24 #include "third_party/skia/include/core/SkRegion.h" 25 #include "third_party/skia/include/core/SkRegion.h"
25 #include "ui/gfx/rect.h" 26 #include "ui/gfx/rect.h"
26 #include "ui/gfx/size.h" 27 #include "ui/gfx/size.h"
27 28
28 using gpu::gles2::GLES2Interface; 29 using gpu::gles2::GLES2Interface;
29 30
30 namespace { 31 namespace {
31 32
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 void GLHelper::DeleteTexture(GLuint texture_id) { 816 void GLHelper::DeleteTexture(GLuint texture_id) {
816 gl_->DeleteTextures(1, &texture_id); 817 gl_->DeleteTextures(1, &texture_id);
817 } 818 }
818 819
819 uint32 GLHelper::InsertSyncPoint() { return gl_->InsertSyncPointCHROMIUM(); } 820 uint32 GLHelper::InsertSyncPoint() { return gl_->InsertSyncPointCHROMIUM(); }
820 821
821 void GLHelper::WaitSyncPoint(uint32 sync_point) { 822 void GLHelper::WaitSyncPoint(uint32 sync_point) {
822 gl_->WaitSyncPointCHROMIUM(sync_point); 823 gl_->WaitSyncPointCHROMIUM(sync_point);
823 } 824 }
824 825
825 gpu::Mailbox GLHelper::ProduceMailboxFromTexture(GLuint texture_id, 826 gpu::MailboxHolder GLHelper::ProduceMailboxHolderFromTexture(
826 uint32* sync_point) { 827 GLuint texture_id) {
827 gpu::Mailbox mailbox; 828 gpu::Mailbox mailbox;
828 gl_->GenMailboxCHROMIUM(mailbox.name); 829 gl_->GenMailboxCHROMIUM(mailbox.name);
829 if (mailbox.IsZero()) { 830 if (mailbox.IsZero())
830 *sync_point = 0; 831 return gpu::MailboxHolder();
831 return mailbox;
832 }
833 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture_id); 832 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture_id);
834 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 833 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
835 *sync_point = InsertSyncPoint(); 834 return gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, InsertSyncPoint());
836 return mailbox;
837 } 835 }
838 836
839 GLuint GLHelper::ConsumeMailboxToTexture(const gpu::Mailbox& mailbox, 837 GLuint GLHelper::ConsumeMailboxToTexture(const gpu::Mailbox& mailbox,
840 uint32 sync_point) { 838 uint32 sync_point) {
841 if (mailbox.IsZero()) 839 if (mailbox.IsZero())
842 return 0; 840 return 0;
843 if (sync_point) 841 if (sync_point)
844 WaitSyncPoint(sync_point); 842 WaitSyncPoint(sync_point);
845 GLuint texture = CreateTexture(); 843 GLuint texture = CreateTexture();
846 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); 844 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture);
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, 1235 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality,
1238 src_size, 1236 src_size,
1239 src_subrect, 1237 src_subrect,
1240 dst_size, 1238 dst_size,
1241 dst_subrect, 1239 dst_subrect,
1242 flip_vertically, 1240 flip_vertically,
1243 use_mrt); 1241 use_mrt);
1244 } 1242 }
1245 1243
1246 } // namespace content 1244 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gl_helper.h ('k') | content/renderer/child_frame_compositing_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698