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

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

Issue 2046033002: Revert of cc: Add mailbox support to ResourceProvider write locks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@worker_context_stream
Patch Set: Created 4 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
« no previous file with comments | « cc/resources/resource_provider_unittest.cc ('k') | cc/test/fake_tile_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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (resource_id == 0) 184 if (resource_id == 0)
185 return all_resources_.end(); 185 return all_resources_.end();
186 186
187 gpu::Mailbox mailbox; 187 gpu::Mailbox mailbox;
188 if (has_mailbox) { 188 if (has_mailbox) {
189 DCHECK(context_provider_); 189 DCHECK(context_provider_);
190 190
191 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); 191 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
192 192
193 gl->GenMailboxCHROMIUM(mailbox.name); 193 gl->GenMailboxCHROMIUM(mailbox.name);
194 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, resource_id, 194 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, resource_id);
195 false);
196 gl->ProduceTextureDirectCHROMIUM( 195 gl->ProduceTextureDirectCHROMIUM(
197 lock.texture_id(), 196 lock.texture_id(),
198 resource_provider_->GetResourceTextureTarget(resource_id), 197 resource_provider_->GetResourceTextureTarget(resource_id),
199 mailbox.name); 198 mailbox.name);
200 } 199 }
201 all_resources_.push_front( 200 all_resources_.push_front(
202 PlaneResource(resource_id, plane_size, format, mailbox)); 201 PlaneResource(resource_id, plane_size, format, mailbox));
203 return all_resources_.begin(); 202 return all_resources_.begin();
204 } 203 }
205 204
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 // Otherwise allocate a new resource. 577 // Otherwise allocate a new resource.
579 if (resource == all_resources_.end()) { 578 if (resource == all_resources_.end()) {
580 const bool is_immutable = false; 579 const bool is_immutable = false;
581 resource = AllocateResource(output_plane_resource_size, copy_target_format, 580 resource = AllocateResource(output_plane_resource_size, copy_target_format,
582 true, is_immutable); 581 true, is_immutable);
583 } 582 }
584 583
585 resource->add_ref(); 584 resource->add_ref();
586 585
587 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, 586 ResourceProvider::ScopedWriteLockGL lock(resource_provider_,
588 resource->resource_id(), false); 587 resource->resource_id());
588 uint32_t texture_id = lock.texture_id();
589
589 DCHECK_EQ( 590 DCHECK_EQ(
590 resource_provider_->GetResourceTextureTarget(resource->resource_id()), 591 resource_provider_->GetResourceTextureTarget(resource->resource_id()),
591 (GLenum)GL_TEXTURE_2D); 592 (GLenum)GL_TEXTURE_2D);
592 593
593 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); 594 gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData());
594 uint32_t src_texture_id = gl->CreateAndConsumeTextureCHROMIUM( 595 uint32_t src_texture_id = gl->CreateAndConsumeTextureCHROMIUM(
595 mailbox_holder.texture_target, mailbox_holder.mailbox.name); 596 mailbox_holder.texture_target, mailbox_holder.mailbox.name);
596 gl->CopySubTextureCHROMIUM(src_texture_id, lock.texture_id(), 0, 0, 0, 0, 597 gl->CopySubTextureCHROMIUM(src_texture_id, texture_id, 0, 0, 0, 0,
597 output_plane_resource_size.width(), 598 output_plane_resource_size.width(),
598 output_plane_resource_size.height(), false, false, 599 output_plane_resource_size.height(), false, false,
599 false); 600 false);
600 gl->DeleteTextures(1, &src_texture_id); 601 gl->DeleteTextures(1, &src_texture_id);
601 602
602 // Sync point for use of frame copy. 603 // Sync point for use of frame copy.
603 gpu::SyncToken sync_token; 604 gpu::SyncToken sync_token;
604 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); 605 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
605 gl->ShallowFlushCHROMIUM(); 606 gl->ShallowFlushCHROMIUM();
606 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 607 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 if (lost_resource) { 691 if (lost_resource) {
691 resource_it->clear_refs(); 692 resource_it->clear_refs();
692 updater->DeleteResource(resource_it); 693 updater->DeleteResource(resource_it);
693 return; 694 return;
694 } 695 }
695 696
696 resource_it->remove_ref(); 697 resource_it->remove_ref();
697 } 698 }
698 699
699 } // namespace cc 700 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider_unittest.cc ('k') | cc/test/fake_tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698