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

Side by Side Diff: gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Async upload token part of existing Async command; use separate shared memory to sync async upload … Created 6 years, 10 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 "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h" 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h"
6 6
7 #include <list> 7 #include <list>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 if (!texture_binder) 723 if (!texture_binder)
724 texture_binder.reset(new gfx::ScopedTextureBinder(GL_TEXTURE_2D, 0)); 724 texture_binder.reset(new gfx::ScopedTextureBinder(GL_TEXTURE_2D, 0));
725 725
726 // If the transfer is finished, bind it to the texture 726 // If the transfer is finished, bind it to the texture
727 // and remove it from pending list. 727 // and remove it from pending list.
728 delegate->BindTransfer(); 728 delegate->BindTransfer();
729 shared_state_.pending_allocations.pop_front(); 729 shared_state_.pending_allocations.pop_front();
730 } 730 }
731 } 731 }
732 732
733 void AsyncPixelTransferManagerEGL::AsyncRun(const base::Closure& callback) {
734 transfer_message_loop_proxy()->PostTask(FROM_HERE, callback);
735 }
736
733 void AsyncPixelTransferManagerEGL::AsyncNotifyCompletion( 737 void AsyncPixelTransferManagerEGL::AsyncNotifyCompletion(
734 const AsyncMemoryParams& mem_params, 738 const AsyncMemoryParams& mem_params,
735 AsyncPixelTransferCompletionObserver* observer) { 739 AsyncPixelTransferCompletionObserver* observer) {
736 DCHECK(mem_params.shared_memory); 740 DCHECK(mem_params.shared_memory);
737 DCHECK_LE(mem_params.shm_data_offset + mem_params.shm_data_size, 741 DCHECK_LE(mem_params.shm_data_offset + mem_params.shm_data_size,
738 mem_params.shm_size); 742 mem_params.shm_size);
739 // Post a PerformNotifyCompletion task to the upload thread. This task 743 // Post a PerformNotifyCompletion task to the upload thread. This task
740 // will run after all async transfers are complete. 744 // will run after all async transfers are complete.
741 transfer_message_loop_proxy()->PostTask( 745 AsyncRun(
742 FROM_HERE,
743 base::Bind(&PerformNotifyCompletion, 746 base::Bind(&PerformNotifyCompletion,
744 mem_params, 747 mem_params,
745 base::Owned( 748 base::Owned(
746 new ScopedSafeSharedMemory(safe_shared_memory_pool(), 749 new ScopedSafeSharedMemory(safe_shared_memory_pool(),
747 mem_params.shared_memory, 750 mem_params.shared_memory,
748 mem_params.shm_size)), 751 mem_params.shm_size)),
749 make_scoped_refptr(observer))); 752 make_scoped_refptr(observer)));
750 } 753 }
751 754
752 uint32 AsyncPixelTransferManagerEGL::GetTextureUploadCount() { 755 uint32 AsyncPixelTransferManagerEGL::GetTextureUploadCount() {
(...skipping 15 matching lines...) Expand all
768 771
769 AsyncPixelTransferDelegate* 772 AsyncPixelTransferDelegate*
770 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( 773 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl(
771 gles2::TextureRef* ref, 774 gles2::TextureRef* ref,
772 const AsyncTexImage2DParams& define_params) { 775 const AsyncTexImage2DParams& define_params) {
773 return new AsyncPixelTransferDelegateEGL( 776 return new AsyncPixelTransferDelegateEGL(
774 &shared_state_, ref->service_id(), define_params); 777 &shared_state_, ref->service_id(), define_params);
775 } 778 }
776 779
777 } // namespace gpu 780 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698