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

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

Issue 1957583002: cc: Add GpuMemoryBufferId to TextureMailbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unsigned -> signed Created 4 years, 7 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
« no previous file with comments | « cc/resources/transferable_resource.h ('k') | cc/test/test_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 653
654 // Sync point for use of frame copy. 654 // Sync point for use of frame copy.
655 gpu::SyncToken sync_token; 655 gpu::SyncToken sync_token;
656 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); 656 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
657 gl->ShallowFlushCHROMIUM(); 657 gl->ShallowFlushCHROMIUM();
658 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 658 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
659 659
660 // Done with the source video frame texture at this point. 660 // Done with the source video frame texture at this point.
661 video_frame->UpdateReleaseSyncToken(&client); 661 video_frame->UpdateReleaseSyncToken(&client);
662 662
663 external_resources->mailboxes.push_back( 663 external_resources->mailboxes.push_back(TextureMailbox(
664 TextureMailbox(resource->mailbox, sync_token, GL_TEXTURE_2D, 664 resource->mailbox, sync_token, GL_TEXTURE_2D, video_frame->coded_size(),
665 video_frame->coded_size(), false, false)); 665 gfx::GpuMemoryBufferId(), false, false));
666 666
667 external_resources->release_callbacks.push_back( 667 external_resources->release_callbacks.push_back(
668 base::Bind(&RecycleResource, AsWeakPtr(), resource->resource_id)); 668 base::Bind(&RecycleResource, AsWeakPtr(), resource->resource_id));
669 } 669 }
670 670
671 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( 671 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
672 scoped_refptr<media::VideoFrame> video_frame) { 672 scoped_refptr<media::VideoFrame> video_frame) {
673 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes"); 673 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes");
674 DCHECK(video_frame->HasTextures()); 674 DCHECK(video_frame->HasTextures());
675 if (!context_provider_) 675 if (!context_provider_)
(...skipping 15 matching lines...) Expand all
691 const size_t num_planes = media::VideoFrame::NumPlanes(video_frame->format()); 691 const size_t num_planes = media::VideoFrame::NumPlanes(video_frame->format());
692 for (size_t i = 0; i < num_planes; ++i) { 692 for (size_t i = 0; i < num_planes; ++i) {
693 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(i); 693 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(i);
694 if (mailbox_holder.mailbox.IsZero()) 694 if (mailbox_holder.mailbox.IsZero())
695 break; 695 break;
696 696
697 if (video_frame->metadata()->IsTrue( 697 if (video_frame->metadata()->IsTrue(
698 media::VideoFrameMetadata::COPY_REQUIRED)) { 698 media::VideoFrameMetadata::COPY_REQUIRED)) {
699 CopyPlaneTexture(video_frame.get(), mailbox_holder, &external_resources); 699 CopyPlaneTexture(video_frame.get(), mailbox_holder, &external_resources);
700 } else { 700 } else {
701 external_resources.mailboxes.push_back(TextureMailbox( 701 external_resources.mailboxes.push_back(
702 mailbox_holder.mailbox, mailbox_holder.sync_token, 702 TextureMailbox(mailbox_holder.mailbox, mailbox_holder.sync_token,
703 mailbox_holder.texture_target, video_frame->coded_size(), 703 mailbox_holder.texture_target,
704 video_frame->metadata()->IsTrue( 704 video_frame->coded_size(), gfx::GpuMemoryBufferId(),
705 media::VideoFrameMetadata::ALLOW_OVERLAY), 705 video_frame->metadata()->IsTrue(
706 false)); 706 media::VideoFrameMetadata::ALLOW_OVERLAY),
707 false));
707 708
708 external_resources.release_callbacks.push_back( 709 external_resources.release_callbacks.push_back(
709 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); 710 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame));
710 } 711 }
711 } 712 }
712 return external_resources; 713 return external_resources;
713 } 714 }
714 715
715 // static 716 // static
716 void VideoResourceUpdater::RecycleResource( 717 void VideoResourceUpdater::RecycleResource(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 plane_resource.plane_index == 0; 765 plane_resource.plane_index == 0;
765 }); 766 });
766 if (resource_it == updater->all_resources_.end()) 767 if (resource_it == updater->all_resources_.end())
767 return; 768 return;
768 769
769 resource_it->destructed = true; 770 resource_it->destructed = true;
770 } 771 }
771 #endif 772 #endif
772 773
773 } // namespace cc 774 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/transferable_resource.h ('k') | cc/test/test_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698