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

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: virtualandroid 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/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 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 new VideoFrame::MailboxHolder(
1248 mailbox,
1249 sync_point,
1250 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback()),
1247 GL_TEXTURE_2D, 1251 GL_TEXTURE_2D,
1248 gfx::Size(4, 4), gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), 1252 gfx::Size(4, 4), gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4),
1249 base::TimeDelta(), 1253 base::TimeDelta(),
1250 VideoFrame::ReadPixelsCB(), 1254 VideoFrame::ReadPixelsCB(),
1251 base::Closure()); 1255 base::Closure());
1252 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( 1256 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture(
1253 lock.texture_id(), 1257 new VideoFrame::MailboxHolder(
1258 mailbox,
1259 sync_point,
1260 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback()),
1254 GL_TEXTURE_2D, 1261 GL_TEXTURE_2D,
1255 gfx::Size(4, 4), gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), 1262 gfx::Size(4, 4), gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4),
1256 base::TimeDelta(), 1263 base::TimeDelta(),
1257 VideoFrame::ReadPixelsCB(), 1264 VideoFrame::ReadPixelsCB(),
1258 base::Closure()); 1265 base::Closure());
1259 1266
1260 color_frame_provider_.set_frame(color_video_frame_); 1267 color_frame_provider_.set_frame(color_video_frame_);
1261 hw_frame_provider_.set_frame(hw_video_frame_); 1268 hw_frame_provider_.set_frame(hw_video_frame_);
1262 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); 1269 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_);
1263 return; 1270 return;
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 impl_thread ? impl_thread->message_loop_proxy() : NULL); 1597 impl_thread ? impl_thread->message_loop_proxy() : NULL);
1591 EXPECT_FALSE(layer_tree_host); 1598 EXPECT_FALSE(layer_tree_host);
1592 } 1599 }
1593 }; 1600 };
1594 1601
1595 SINGLE_AND_MULTI_THREAD_TEST_F( 1602 SINGLE_AND_MULTI_THREAD_TEST_F(
1596 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface); 1603 LayerTreeHostTestCannotCreateIfCannotCreateOutputSurface);
1597 1604
1598 } // namespace 1605 } // namespace
1599 } // namespace cc 1606 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | content/browser/renderer_host/surface_texture_transport_client_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698