OLD | NEW |
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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 | 631 |
632 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); | 632 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); |
633 uint32_t src_texture_id = gl->CreateAndConsumeTextureCHROMIUM( | 633 uint32_t src_texture_id = gl->CreateAndConsumeTextureCHROMIUM( |
634 mailbox_holder.texture_target, mailbox_holder.mailbox.name); | 634 mailbox_holder.texture_target, mailbox_holder.mailbox.name); |
635 gl->CopySubTextureCHROMIUM(src_texture_id, lock.texture_id(), 0, 0, 0, 0, | 635 gl->CopySubTextureCHROMIUM(src_texture_id, lock.texture_id(), 0, 0, 0, 0, |
636 output_plane_resource_size.width(), | 636 output_plane_resource_size.width(), |
637 output_plane_resource_size.height(), false, false, | 637 output_plane_resource_size.height(), false, false, |
638 false); | 638 false); |
639 gl->DeleteTextures(1, &src_texture_id); | 639 gl->DeleteTextures(1, &src_texture_id); |
640 | 640 |
641 // Sync point for use of frame copy. | |
642 gpu::SyncToken sync_token; | |
643 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); | |
644 gl->ShallowFlushCHROMIUM(); | |
645 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | |
646 | |
647 // Done with the source video frame texture at this point. | 641 // Done with the source video frame texture at this point. |
648 video_frame->UpdateReleaseSyncToken(&client); | 642 video_frame->UpdateReleaseSyncToken(&client); |
649 | 643 |
650 TextureMailbox mailbox(resource->mailbox(), sync_token, GL_TEXTURE_2D, | 644 // VideoResourceUpdater shares a context with the compositor so a |
| 645 // sync token is not required. |
| 646 TextureMailbox mailbox(resource->mailbox(), gpu::SyncToken(), GL_TEXTURE_2D, |
651 video_frame->coded_size(), false, false); | 647 video_frame->coded_size(), false, false); |
652 mailbox.set_color_space(video_frame->ColorSpace()); | 648 mailbox.set_color_space(video_frame->ColorSpace()); |
653 external_resources->mailboxes.push_back(mailbox); | 649 external_resources->mailboxes.push_back(mailbox); |
654 | 650 |
655 external_resources->release_callbacks.push_back( | 651 external_resources->release_callbacks.push_back( |
656 base::Bind(&RecycleResource, AsWeakPtr(), resource->resource_id())); | 652 base::Bind(&RecycleResource, AsWeakPtr(), resource->resource_id())); |
657 } | 653 } |
658 | 654 |
659 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( | 655 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( |
660 scoped_refptr<media::VideoFrame> video_frame) { | 656 scoped_refptr<media::VideoFrame> video_frame) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 if (lost_resource) { | 725 if (lost_resource) { |
730 resource_it->clear_refs(); | 726 resource_it->clear_refs(); |
731 updater->DeleteResource(resource_it); | 727 updater->DeleteResource(resource_it); |
732 return; | 728 return; |
733 } | 729 } |
734 | 730 |
735 resource_it->remove_ref(); | 731 resource_it->remove_ref(); |
736 } | 732 } |
737 | 733 |
738 } // namespace cc | 734 } // namespace cc |
OLD | NEW |