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

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: video-mailbox: remove extra produce in webmediaplayer_impl Created 7 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 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/base/thread_impl.h" 8 #include "cc/base/thread_impl.h"
9 #include "cc/layers/content_layer.h" 9 #include "cc/layers/content_layer.h"
10 #include "cc/layers/heads_up_display_layer.h" 10 #include "cc/layers/heads_up_display_layer.h"
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 content_with_mask_->SetMaskLayer(mask_.get()); 1134 content_with_mask_->SetMaskLayer(mask_.get());
1135 root_->AddChild(content_with_mask_); 1135 root_->AddChild(content_with_mask_);
1136 1136
1137 scoped_refptr<VideoLayer> video_color_ = VideoLayer::Create( 1137 scoped_refptr<VideoLayer> video_color_ = VideoLayer::Create(
1138 &color_frame_provider_); 1138 &color_frame_provider_);
1139 video_color_->SetBounds(gfx::Size(10, 10)); 1139 video_color_->SetBounds(gfx::Size(10, 10));
1140 video_color_->SetAnchorPoint(gfx::PointF()); 1140 video_color_->SetAnchorPoint(gfx::PointF());
1141 video_color_->SetIsDrawable(true); 1141 video_color_->SetIsDrawable(true);
1142 root_->AddChild(video_color_); 1142 root_->AddChild(video_color_);
1143 1143
1144 if (!delegating_renderer()) { 1144 scoped_refptr<VideoLayer> video_hw_ = VideoLayer::Create(
1145 // TODO(danakj): Hardware video decode can not be transported. 1145 &hw_frame_provider_);
1146 // crbug.com/179729 1146 video_hw_->SetBounds(gfx::Size(10, 10));
1147 scoped_refptr<VideoLayer> video_hw_ = VideoLayer::Create( 1147 video_hw_->SetAnchorPoint(gfx::PointF());
1148 &hw_frame_provider_); 1148 video_hw_->SetIsDrawable(true);
1149 video_hw_->SetBounds(gfx::Size(10, 10)); 1149 root_->AddChild(video_hw_);
1150 video_hw_->SetAnchorPoint(gfx::PointF());
1151 video_hw_->SetIsDrawable(true);
1152 root_->AddChild(video_hw_);
1153 1150
1154 scoped_refptr<VideoLayer> video_scaled_hw_ = VideoLayer::Create( 1151 scoped_refptr<VideoLayer> video_scaled_hw_ = VideoLayer::Create(
1155 &scaled_hw_frame_provider_); 1152 &scaled_hw_frame_provider_);
1156 video_scaled_hw_->SetBounds(gfx::Size(10, 10)); 1153 video_scaled_hw_->SetBounds(gfx::Size(10, 10));
1157 video_scaled_hw_->SetAnchorPoint(gfx::PointF()); 1154 video_scaled_hw_->SetAnchorPoint(gfx::PointF());
1158 video_scaled_hw_->SetIsDrawable(true); 1155 video_scaled_hw_->SetIsDrawable(true);
1159 root_->AddChild(video_scaled_hw_); 1156 root_->AddChild(video_scaled_hw_);
1160 }
1161 1157
1162 if (!delegating_renderer()) { 1158 if (!delegating_renderer()) {
1163 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 1159 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335
1164 scoped_refptr<IOSurfaceLayer> io_surface_ = IOSurfaceLayer::Create(); 1160 scoped_refptr<IOSurfaceLayer> io_surface_ = IOSurfaceLayer::Create();
1165 io_surface_->SetBounds(gfx::Size(10, 10)); 1161 io_surface_->SetBounds(gfx::Size(10, 10));
1166 io_surface_->SetAnchorPoint(gfx::PointF()); 1162 io_surface_->SetAnchorPoint(gfx::PointF());
1167 io_surface_->SetIsDrawable(true); 1163 io_surface_->SetIsDrawable(true);
1168 io_surface_->SetIOSurfaceProperties(1, gfx::Size(10, 10)); 1164 io_surface_->SetIOSurfaceProperties(1, gfx::Size(10, 10));
1169 root_->AddChild(io_surface_); 1165 root_->AddChild(io_surface_);
1170 } 1166 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 texture_impl->set_texture_id( 1229 texture_impl->set_texture_id(
1234 resource_provider->GraphicsContext3D()->createTexture()); 1230 resource_provider->GraphicsContext3D()->createTexture());
1235 1231
1236 DCHECK(resource_provider->GraphicsContext3D()); 1232 DCHECK(resource_provider->GraphicsContext3D());
1237 ResourceProvider::ResourceId texture = resource_provider->CreateResource( 1233 ResourceProvider::ResourceId texture = resource_provider->CreateResource(
1238 gfx::Size(4, 4), 1234 gfx::Size(4, 4),
1239 resource_provider->default_resource_type(), 1235 resource_provider->default_resource_type(),
1240 ResourceProvider::TextureUsageAny); 1236 ResourceProvider::TextureUsageAny);
1241 ResourceProvider::ScopedWriteLockGL lock(resource_provider, texture); 1237 ResourceProvider::ScopedWriteLockGL lock(resource_provider, texture);
1242 1238
1239 gpu::Mailbox mailbox;
1240 resource_provider->GraphicsContext3D()->genMailboxCHROMIUM(mailbox.name);
1241 unsigned sync_point =
1242 resource_provider->GraphicsContext3D()->insertSyncPoint();
1243
1243 color_video_frame_ = VideoFrame::CreateColorFrame( 1244 color_video_frame_ = VideoFrame::CreateColorFrame(
1244 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); 1245 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
1245 hw_video_frame_ = VideoFrame::WrapNativeTexture( 1246 hw_video_frame_ = VideoFrame::WrapNativeTexture(
1246 lock.texture_id(), 1247 mailbox,
1248 sync_point,
1247 GL_TEXTURE_2D, 1249 GL_TEXTURE_2D,
1248 gfx::Size(4, 4), gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), 1250 gfx::Size(4, 4), gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4),
1249 base::TimeDelta(), 1251 base::TimeDelta(),
1250 VideoFrame::ReadPixelsCB(), 1252 VideoFrame::ReadPixelsCB(),
1253 VideoFrame::TextureNoLongerNeededCallback(),
1251 base::Closure()); 1254 base::Closure());
1252 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( 1255 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture(
1253 lock.texture_id(), 1256 mailbox,
1257 sync_point,
1254 GL_TEXTURE_2D, 1258 GL_TEXTURE_2D,
1255 gfx::Size(4, 4), gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), 1259 gfx::Size(4, 4), gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4),
1256 base::TimeDelta(), 1260 base::TimeDelta(),
1257 VideoFrame::ReadPixelsCB(), 1261 VideoFrame::ReadPixelsCB(),
1262 VideoFrame::TextureNoLongerNeededCallback(),
1258 base::Closure()); 1263 base::Closure());
1259 1264
1260 color_frame_provider_.set_frame(color_video_frame_); 1265 color_frame_provider_.set_frame(color_video_frame_);
1261 hw_frame_provider_.set_frame(hw_video_frame_); 1266 hw_frame_provider_.set_frame(hw_video_frame_);
1262 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); 1267 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_);
1263 return; 1268 return;
1264 } 1269 }
1265 1270
1266 if (host_impl->active_tree()->source_frame_number() == 3) { 1271 if (host_impl->active_tree()->source_frame_number() == 3) {
1267 // On the third commit we're recovering from context loss. Hardware 1272 // On the third commit we're recovering from context loss. Hardware
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 LayerTreeHost::Create(this, settings, impl_ccthread.Pass()); 1595 LayerTreeHost::Create(this, settings, impl_ccthread.Pass());
1591 EXPECT_FALSE(layer_tree_host); 1596 EXPECT_FALSE(layer_tree_host);
1592 } 1597 }
1593 }; 1598 };
1594 1599
1595 SINGLE_AND_MULTI_THREAD_TEST_F( 1600 SINGLE_AND_MULTI_THREAD_TEST_F(
1596 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface); 1601 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface);
1597 1602
1598 } // namespace 1603 } // namespace
1599 } // namespace cc 1604 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698