| 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 602 |
| 603 // Sync point for use of frame copy. | 603 // Sync point for use of frame copy. |
| 604 gpu::SyncToken sync_token; | 604 gpu::SyncToken sync_token; |
| 605 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); | 605 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 606 gl->ShallowFlushCHROMIUM(); | 606 gl->ShallowFlushCHROMIUM(); |
| 607 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 607 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 608 | 608 |
| 609 // Done with the source video frame texture at this point. | 609 // Done with the source video frame texture at this point. |
| 610 video_frame->UpdateReleaseSyncToken(&client); | 610 video_frame->UpdateReleaseSyncToken(&client); |
| 611 | 611 |
| 612 external_resources->mailboxes.push_back(TextureMailbox( | 612 external_resources->mailboxes.push_back( |
| 613 resource->mailbox(), sync_token, GL_TEXTURE_2D, video_frame->coded_size(), | 613 TextureMailbox(resource->mailbox(), sync_token, GL_TEXTURE_2D, |
| 614 gfx::GpuMemoryBufferId(), false, false)); | 614 video_frame->coded_size(), false, false)); |
| 615 | 615 |
| 616 external_resources->release_callbacks.push_back( | 616 external_resources->release_callbacks.push_back( |
| 617 base::Bind(&RecycleResource, AsWeakPtr(), resource->resource_id())); | 617 base::Bind(&RecycleResource, AsWeakPtr(), resource->resource_id())); |
| 618 } | 618 } |
| 619 | 619 |
| 620 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( | 620 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( |
| 621 scoped_refptr<media::VideoFrame> video_frame) { | 621 scoped_refptr<media::VideoFrame> video_frame) { |
| 622 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes"); | 622 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes"); |
| 623 DCHECK(video_frame->HasTextures()); | 623 DCHECK(video_frame->HasTextures()); |
| 624 if (!context_provider_) | 624 if (!context_provider_) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 643 if (mailbox_holder.mailbox.IsZero()) | 643 if (mailbox_holder.mailbox.IsZero()) |
| 644 break; | 644 break; |
| 645 | 645 |
| 646 if (video_frame->metadata()->IsTrue( | 646 if (video_frame->metadata()->IsTrue( |
| 647 media::VideoFrameMetadata::COPY_REQUIRED)) { | 647 media::VideoFrameMetadata::COPY_REQUIRED)) { |
| 648 CopyPlaneTexture(video_frame.get(), mailbox_holder, &external_resources); | 648 CopyPlaneTexture(video_frame.get(), mailbox_holder, &external_resources); |
| 649 } else { | 649 } else { |
| 650 external_resources.mailboxes.push_back(TextureMailbox( | 650 external_resources.mailboxes.push_back(TextureMailbox( |
| 651 mailbox_holder.mailbox, mailbox_holder.sync_token, | 651 mailbox_holder.mailbox, mailbox_holder.sync_token, |
| 652 mailbox_holder.texture_target, video_frame->coded_size(), | 652 mailbox_holder.texture_target, video_frame->coded_size(), |
| 653 video_frame->texture_gpu_memory_buffer_id(i), | |
| 654 video_frame->metadata()->IsTrue( | 653 video_frame->metadata()->IsTrue( |
| 655 media::VideoFrameMetadata::ALLOW_OVERLAY), | 654 media::VideoFrameMetadata::ALLOW_OVERLAY), |
| 656 false)); | 655 false)); |
| 657 | 656 |
| 658 external_resources.release_callbacks.push_back( | 657 external_resources.release_callbacks.push_back( |
| 659 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); | 658 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); |
| 660 } | 659 } |
| 661 } | 660 } |
| 662 return external_resources; | 661 return external_resources; |
| 663 } | 662 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 691 if (lost_resource) { | 690 if (lost_resource) { |
| 692 resource_it->clear_refs(); | 691 resource_it->clear_refs(); |
| 693 updater->DeleteResource(resource_it); | 692 updater->DeleteResource(resource_it); |
| 694 return; | 693 return; |
| 695 } | 694 } |
| 696 | 695 |
| 697 resource_it->remove_ref(); | 696 resource_it->remove_ref(); |
| 698 } | 697 } |
| 699 | 698 |
| 700 } // namespace cc | 699 } // namespace cc |
| OLD | NEW |