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

Side by Side Diff: cc/resources/video_resource_updater.cc

Issue 175223003: HW Video: Make media::VideoFrame handle the sync point of the compositor as well as webgl (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Add WaitSyncPoint in WMPImpl::paint(...) Created 6 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/gl_renderer.h" 8 #include "cc/output/gl_renderer.h"
9 #include "cc/resources/resource_provider.h" 9 #include "cc/resources/resource_provider.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 external_resources.mailboxes.push_back( 303 external_resources.mailboxes.push_back(
304 TextureMailbox(plane_resources[i].mailbox, GL_TEXTURE_2D, 0)); 304 TextureMailbox(plane_resources[i].mailbox, GL_TEXTURE_2D, 0));
305 external_resources.release_callbacks.push_back( 305 external_resources.release_callbacks.push_back(
306 base::Bind(&RecycleResource, AsWeakPtr(), recycle_data)); 306 base::Bind(&RecycleResource, AsWeakPtr(), recycle_data));
307 } 307 }
308 308
309 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; 309 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE;
310 return external_resources; 310 return external_resources;
311 } 311 }
312 312
313 static void ReturnTexture(const scoped_refptr<media::VideoFrame>& frame, 313 // static
314 uint32 sync_point, 314 void VideoResourceUpdater::ReturnTexture(
315 bool lost_resource) { 315 base::WeakPtr<VideoResourceUpdater> updater,
316 frame->mailbox_holder()->sync_point = sync_point; 316 const scoped_refptr<media::VideoFrame>& frame,
317 uint32 sync_point,
318 bool lost_resource) {
319 uint32 previous_sync_point = frame->SwapReleaseSyncPoint(sync_point);
320 // TODO(dshwang): |updater| can be deleted while ResourceProvider keeps
321 // this mailbox. If below code causes critical issue, ResourceProvider
danakj 2014/02/28 21:47:03 This is kinda ugly.. and since cc is giving the re
dshwang 2014/02/28 21:54:17 Yeah, I agree. your idea is better. I'll change Vi
322 // can provide ContextProvider* like |sync_point|.
323 if (updater && previous_sync_point) {
324 gpu::gles2::GLES2Interface* gl = updater->context_provider_->ContextGL();
325 GLC(gl, gl->WaitSyncPointCHROMIUM(previous_sync_point));
danakj 2014/02/28 21:47:03 This is inverted, you'd need to wait on the existi
dshwang 2014/02/28 21:54:17 Thank you for explanation. After VideoFrame keep m
326 }
317 } 327 }
318 328
319 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( 329 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
320 const scoped_refptr<media::VideoFrame>& video_frame) { 330 const scoped_refptr<media::VideoFrame>& video_frame) {
321 media::VideoFrame::Format frame_format = video_frame->format(); 331 media::VideoFrame::Format frame_format = video_frame->format();
322 332
323 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE); 333 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE);
324 if (frame_format != media::VideoFrame::NATIVE_TEXTURE) 334 if (frame_format != media::VideoFrame::NATIVE_TEXTURE)
325 return VideoFrameExternalResources(); 335 return VideoFrameExternalResources();
326 336
(...skipping 16 matching lines...) Expand all
343 default: 353 default:
344 NOTREACHED(); 354 NOTREACHED();
345 return VideoFrameExternalResources(); 355 return VideoFrameExternalResources();
346 } 356 }
347 357
348 external_resources.mailboxes.push_back( 358 external_resources.mailboxes.push_back(
349 TextureMailbox(mailbox_holder->mailbox, 359 TextureMailbox(mailbox_holder->mailbox,
350 mailbox_holder->texture_target, 360 mailbox_holder->texture_target,
351 mailbox_holder->sync_point)); 361 mailbox_holder->sync_point));
352 external_resources.release_callbacks.push_back( 362 external_resources.release_callbacks.push_back(
353 base::Bind(&ReturnTexture, video_frame)); 363 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame));
354 return external_resources; 364 return external_resources;
355 } 365 }
356 366
357 // static 367 // static
358 void VideoResourceUpdater::RecycleResource( 368 void VideoResourceUpdater::RecycleResource(
359 base::WeakPtr<VideoResourceUpdater> updater, 369 base::WeakPtr<VideoResourceUpdater> updater,
360 RecycleResourceData data, 370 RecycleResourceData data,
361 uint32 sync_point, 371 uint32 sync_point,
362 bool lost_resource) { 372 bool lost_resource) {
363 if (!updater.get()) { 373 if (!updater.get()) {
(...skipping 21 matching lines...) Expand all
385 } 395 }
386 396
387 PlaneResource recycled_resource(data.resource_id, 397 PlaneResource recycled_resource(data.resource_id,
388 data.resource_size, 398 data.resource_size,
389 data.resource_format, 399 data.resource_format,
390 data.mailbox); 400 data.mailbox);
391 updater->recycled_resources_.push_back(recycled_resource); 401 updater->recycled_resources_.push_back(recycled_resource);
392 } 402 }
393 403
394 } // namespace cc 404 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/video_resource_updater.h ('k') | content/renderer/media/renderer_gpu_video_accelerator_factories.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698