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

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

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bfbc08f8 Android clang fixes. Created 6 years, 11 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 void GLHelper::DeleteTexture(GLuint texture_id) { 664 void GLHelper::DeleteTexture(GLuint texture_id) {
664 gl_->DeleteTextures(1, &texture_id); 665 gl_->DeleteTextures(1, &texture_id);
665 } 666 }
666 667
667 uint32 GLHelper::InsertSyncPoint() { return gl_->InsertSyncPointCHROMIUM(); } 668 uint32 GLHelper::InsertSyncPoint() { return gl_->InsertSyncPointCHROMIUM(); }
668 669
669 void GLHelper::WaitSyncPoint(uint32 sync_point) { 670 void GLHelper::WaitSyncPoint(uint32 sync_point) {
670 gl_->WaitSyncPointCHROMIUM(sync_point); 671 gl_->WaitSyncPointCHROMIUM(sync_point);
671 } 672 }
672 673
673 gpu::Mailbox GLHelper::ProduceMailboxFromTexture(GLuint texture_id, 674 gpu::MailboxHolder GLHelper::ProduceMailboxHolderFromTexture(
674 uint32* sync_point) { 675 GLuint texture_id) {
675 gpu::Mailbox mailbox; 676 gpu::Mailbox mailbox;
676 gl_->GenMailboxCHROMIUM(mailbox.name); 677 gl_->GenMailboxCHROMIUM(mailbox.name);
677 if (mailbox.IsZero()) { 678 if (mailbox.IsZero())
678 *sync_point = 0; 679 return gpu::MailboxHolder();
679 return mailbox;
680 }
681 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture_id); 680 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture_id);
682 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 681 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
683 *sync_point = InsertSyncPoint(); 682 return gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, InsertSyncPoint());
684 return mailbox;
685 } 683 }
686 684
687 GLuint GLHelper::ConsumeMailboxToTexture(const gpu::Mailbox& mailbox, 685 GLuint GLHelper::ConsumeMailboxToTexture(const gpu::Mailbox& mailbox,
688 uint32 sync_point) { 686 uint32 sync_point) {
689 if (mailbox.IsZero()) 687 if (mailbox.IsZero())
690 return 0; 688 return 0;
691 if (sync_point) 689 if (sync_point)
692 WaitSyncPoint(sync_point); 690 WaitSyncPoint(sync_point);
693 GLuint texture = CreateTexture(); 691 GLuint texture = CreateTexture();
694 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture); 692 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality, 1042 return copy_texture_to_impl_->CreateReadbackPipelineYUV(quality,
1045 src_size, 1043 src_size,
1046 src_subrect, 1044 src_subrect,
1047 dst_size, 1045 dst_size,
1048 dst_subrect, 1046 dst_subrect,
1049 flip_vertically, 1047 flip_vertically,
1050 use_mrt); 1048 use_mrt);
1051 } 1049 }
1052 1050
1053 } // namespace content 1051 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gl_helper.h ('k') | content/renderer/browser_plugin/browser_plugin_compositing_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698