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

Side by Side Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 14199002: Send hardware video frames with mailboxes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use the texture target in the hardware video frame Created 7 years, 8 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "cc/layers/content_layer.h" 8 #include "cc/layers/content_layer.h"
9 #include "cc/layers/heads_up_display_layer.h" 9 #include "cc/layers/heads_up_display_layer.h"
10 #include "cc/layers/io_surface_layer.h" 10 #include "cc/layers/io_surface_layer.h"
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 pass_list.push_back(pass_for_quad.PassAs<RenderPass>()); 1013 pass_list.push_back(pass_for_quad.PassAs<RenderPass>());
1014 pass_list.push_back(pass.PassAs<RenderPass>()); 1014 pass_list.push_back(pass.PassAs<RenderPass>());
1015 1015
1016 // First child is the delegated layer. 1016 // First child is the delegated layer.
1017 FakeDelegatedRendererLayerImpl* delegated_impl = 1017 FakeDelegatedRendererLayerImpl* delegated_impl =
1018 static_cast<FakeDelegatedRendererLayerImpl*>( 1018 static_cast<FakeDelegatedRendererLayerImpl*>(
1019 host_impl->active_tree()->root_layer()->children()[0]); 1019 host_impl->active_tree()->root_layer()->children()[0]);
1020 delegated_impl->SetFrameDataForRenderPasses(&pass_list); 1020 delegated_impl->SetFrameDataForRenderPasses(&pass_list);
1021 EXPECT_TRUE(pass_list.empty()); 1021 EXPECT_TRUE(pass_list.empty());
1022 1022
1023 gpu::Mailbox mailbox;
1024 resource_provider->GraphicsContext3D()->genMailboxCHROMIUM(mailbox.name);
1025 unsigned sync_point =
1026 resource_provider->GraphicsContext3D()->insertSyncPoint();
1027
1023 color_video_frame_ = VideoFrame::CreateColorFrame( 1028 color_video_frame_ = VideoFrame::CreateColorFrame(
1024 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); 1029 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
1025 hw_video_frame_ = VideoFrame::WrapNativeTexture( 1030 hw_video_frame_ = VideoFrame::WrapNativeTexture(
1026 resource_provider->GraphicsContext3D()->createTexture(), 1031 mailbox,
1032 sync_point,
1027 GL_TEXTURE_2D, 1033 GL_TEXTURE_2D,
1028 gfx::Size(4, 4), gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), 1034 gfx::Size(4, 4), gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4),
1029 base::TimeDelta(), 1035 base::TimeDelta(),
1030 VideoFrame::ReadPixelsCB(), 1036 VideoFrame::ReadPixelsCB(),
1037 VideoFrame::TextureNoLongerNeededCallback(),
1031 base::Closure()); 1038 base::Closure());
1032 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( 1039 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture(
1033 resource_provider->GraphicsContext3D()->createTexture(), 1040 mailbox,
1041 sync_point,
1034 GL_TEXTURE_2D, 1042 GL_TEXTURE_2D,
1035 gfx::Size(4, 4), gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), 1043 gfx::Size(4, 4), gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4),
1036 base::TimeDelta(), 1044 base::TimeDelta(),
1037 VideoFrame::ReadPixelsCB(), 1045 VideoFrame::ReadPixelsCB(),
1046 VideoFrame::TextureNoLongerNeededCallback(),
1038 base::Closure()); 1047 base::Closure());
1039 1048
1040 color_frame_provider_.set_frame(color_video_frame_); 1049 color_frame_provider_.set_frame(color_video_frame_);
1041 hw_frame_provider_.set_frame(hw_video_frame_); 1050 hw_frame_provider_.set_frame(hw_video_frame_);
1042 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); 1051 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_);
1043 return; 1052 return;
1044 } 1053 }
1045 1054
1046 if (host_impl->active_tree()->source_frame_number() == 3) { 1055 if (host_impl->active_tree()->source_frame_number() == 3) {
1047 // On the third commit we're recovering from context loss. Hardware 1056 // On the third commit we're recovering from context loss. Hardware
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 1230
1222 private: 1231 private:
1223 int commits_; 1232 int commits_;
1224 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_; 1233 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_;
1225 }; 1234 };
1226 1235
1227 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext); 1236 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext);
1228 1237
1229 } // namespace 1238 } // namespace
1230 } // namespace cc 1239 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698