| 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 "gpu/command_buffer/service/in_process_command_buffer.h" | 5 #include "gpu/ipc/in_process_command_buffer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 InProcessCommandBuffer::Service::Service() | 149 InProcessCommandBuffer::Service::Service() |
| 150 : gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()) {} | 150 : gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()) {} |
| 151 | 151 |
| 152 InProcessCommandBuffer::Service::Service(const GpuPreferences& gpu_preferences) | 152 InProcessCommandBuffer::Service::Service(const GpuPreferences& gpu_preferences) |
| 153 : gpu_preferences_(gpu_preferences), | 153 : gpu_preferences_(gpu_preferences), |
| 154 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()) {} | 154 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()) {} |
| 155 | 155 |
| 156 InProcessCommandBuffer::Service::~Service() {} | 156 InProcessCommandBuffer::Service::~Service() {} |
| 157 | 157 |
| 158 const gpu::GpuPreferences& | 158 const gpu::GpuPreferences& InProcessCommandBuffer::Service::gpu_preferences() { |
| 159 InProcessCommandBuffer::Service::gpu_preferences() { | |
| 160 return gpu_preferences_; | 159 return gpu_preferences_; |
| 161 } | 160 } |
| 162 | 161 |
| 163 const gpu::GpuDriverBugWorkarounds& | 162 const gpu::GpuDriverBugWorkarounds& |
| 164 InProcessCommandBuffer::Service::gpu_driver_bug_workarounds() { | 163 InProcessCommandBuffer::Service::gpu_driver_bug_workarounds() { |
| 165 return gpu_driver_bug_workarounds_; | 164 return gpu_driver_bug_workarounds_; |
| 166 } | 165 } |
| 167 | 166 |
| 168 scoped_refptr<gl::GLShareGroup> InProcessCommandBuffer::Service::share_group() { | 167 scoped_refptr<gl::GLShareGroup> InProcessCommandBuffer::Service::share_group() { |
| 169 if (!share_group_.get()) | 168 if (!share_group_.get()) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 transfer_buffer_manager_ = manager; | 307 transfer_buffer_manager_ = manager; |
| 309 manager->Initialize(); | 308 manager->Initialize(); |
| 310 | 309 |
| 311 std::unique_ptr<CommandBufferService> command_buffer( | 310 std::unique_ptr<CommandBufferService> command_buffer( |
| 312 new CommandBufferService(transfer_buffer_manager_.get())); | 311 new CommandBufferService(transfer_buffer_manager_.get())); |
| 313 command_buffer->SetPutOffsetChangeCallback(base::Bind( | 312 command_buffer->SetPutOffsetChangeCallback(base::Bind( |
| 314 &InProcessCommandBuffer::PumpCommandsOnGpuThread, gpu_thread_weak_ptr_)); | 313 &InProcessCommandBuffer::PumpCommandsOnGpuThread, gpu_thread_weak_ptr_)); |
| 315 command_buffer->SetParseErrorCallback(base::Bind( | 314 command_buffer->SetParseErrorCallback(base::Bind( |
| 316 &InProcessCommandBuffer::OnContextLostOnGpuThread, gpu_thread_weak_ptr_)); | 315 &InProcessCommandBuffer::OnContextLostOnGpuThread, gpu_thread_weak_ptr_)); |
| 317 | 316 |
| 318 gl_share_group_ = params.context_group | 317 gl_share_group_ = params.context_group ? params.context_group->gl_share_group_ |
| 319 ? params.context_group->gl_share_group_ | 318 : service_->share_group(); |
| 320 : service_->share_group(); | |
| 321 | 319 |
| 322 bool bind_generates_resource = false; | 320 bool bind_generates_resource = false; |
| 323 scoped_refptr<gles2::FeatureInfo> feature_info = | 321 scoped_refptr<gles2::FeatureInfo> feature_info = |
| 324 new gles2::FeatureInfo(service_->gpu_driver_bug_workarounds()); | 322 new gles2::FeatureInfo(service_->gpu_driver_bug_workarounds()); |
| 325 decoder_.reset(gles2::GLES2Decoder::Create( | 323 decoder_.reset(gles2::GLES2Decoder::Create( |
| 326 params.context_group | 324 params.context_group |
| 327 ? params.context_group->decoder_->GetContextGroup() | 325 ? params.context_group->decoder_->GetContextGroup() |
| 328 : new gles2::ContextGroup( | 326 : new gles2::ContextGroup( |
| 329 service_->gpu_preferences(), service_->mailbox_manager(), NULL, | 327 service_->gpu_preferences(), service_->mailbox_manager(), NULL, |
| 330 service_->shader_translator_cache(), | 328 service_->shader_translator_cache(), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 .use_virtualized_gl_contexts) { | 361 .use_virtualized_gl_contexts) { |
| 364 context_ = gl_share_group_->GetSharedContext(surface_.get()); | 362 context_ = gl_share_group_->GetSharedContext(surface_.get()); |
| 365 if (!context_.get()) { | 363 if (!context_.get()) { |
| 366 context_ = gl::init::CreateGLContext( | 364 context_ = gl::init::CreateGLContext( |
| 367 gl_share_group_.get(), surface_.get(), | 365 gl_share_group_.get(), surface_.get(), |
| 368 GenerateGLContextAttribs( | 366 GenerateGLContextAttribs( |
| 369 params.attribs, decoder_->GetContextGroup()->gpu_preferences())); | 367 params.attribs, decoder_->GetContextGroup()->gpu_preferences())); |
| 370 gl_share_group_->SetSharedContext(surface_.get(), context_.get()); | 368 gl_share_group_->SetSharedContext(surface_.get(), context_.get()); |
| 371 } | 369 } |
| 372 | 370 |
| 373 context_ = new GLContextVirtual( | 371 context_ = new GLContextVirtual(gl_share_group_.get(), context_.get(), |
| 374 gl_share_group_.get(), context_.get(), decoder_->AsWeakPtr()); | 372 decoder_->AsWeakPtr()); |
| 375 if (context_->Initialize( | 373 if (context_->Initialize( |
| 376 surface_.get(), | 374 surface_.get(), |
| 377 GenerateGLContextAttribs( | 375 GenerateGLContextAttribs( |
| 378 params.attribs, | 376 params.attribs, |
| 379 decoder_->GetContextGroup()->gpu_preferences()))) { | 377 decoder_->GetContextGroup()->gpu_preferences()))) { |
| 380 VLOG(1) << "Created virtual GL context."; | 378 VLOG(1) << "Created virtual GL context."; |
| 381 } else { | 379 } else { |
| 382 context_ = NULL; | 380 context_ = NULL; |
| 383 } | 381 } |
| 384 } else { | 382 } else { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 403 if (!decoder_->GetContextGroup()->has_program_cache() && | 401 if (!decoder_->GetContextGroup()->has_program_cache() && |
| 404 !decoder_->GetContextGroup() | 402 !decoder_->GetContextGroup() |
| 405 ->feature_info() | 403 ->feature_info() |
| 406 ->workarounds() | 404 ->workarounds() |
| 407 .disable_program_cache) { | 405 .disable_program_cache) { |
| 408 decoder_->GetContextGroup()->set_program_cache(service_->program_cache()); | 406 decoder_->GetContextGroup()->set_program_cache(service_->program_cache()); |
| 409 } | 407 } |
| 410 | 408 |
| 411 gles2::DisallowedFeatures disallowed_features; | 409 gles2::DisallowedFeatures disallowed_features; |
| 412 disallowed_features.gpu_memory_manager = true; | 410 disallowed_features.gpu_memory_manager = true; |
| 413 if (!decoder_->Initialize(surface_, | 411 if (!decoder_->Initialize(surface_, context_, params.is_offscreen, |
| 414 context_, | 412 disallowed_features, params.attribs)) { |
| 415 params.is_offscreen, | |
| 416 disallowed_features, | |
| 417 params.attribs)) { | |
| 418 LOG(ERROR) << "Could not initialize decoder."; | 413 LOG(ERROR) << "Could not initialize decoder."; |
| 419 DestroyOnGpuThread(); | 414 DestroyOnGpuThread(); |
| 420 return false; | 415 return false; |
| 421 } | 416 } |
| 422 *params.capabilities = decoder_->GetCapabilities(); | 417 *params.capabilities = decoder_->GetCapabilities(); |
| 423 | 418 |
| 424 decoder_->SetFenceSyncReleaseCallback( | 419 decoder_->SetFenceSyncReleaseCallback( |
| 425 base::Bind(&InProcessCommandBuffer::FenceSyncReleaseOnGpuThread, | 420 base::Bind(&InProcessCommandBuffer::FenceSyncReleaseOnGpuThread, |
| 426 base::Unretained(this))); | 421 base::Unretained(this))); |
| 427 decoder_->SetWaitFenceSyncCallback( | 422 decoder_->SetWaitFenceSyncCallback( |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 return; | 576 return; |
| 582 | 577 |
| 583 if (last_put_offset_ == put_offset) | 578 if (last_put_offset_ == put_offset) |
| 584 return; | 579 return; |
| 585 | 580 |
| 586 SyncPointManager* sync_manager = service_->sync_point_manager(); | 581 SyncPointManager* sync_manager = service_->sync_point_manager(); |
| 587 const uint32_t order_num = | 582 const uint32_t order_num = |
| 588 sync_point_order_data_->GenerateUnprocessedOrderNumber(sync_manager); | 583 sync_point_order_data_->GenerateUnprocessedOrderNumber(sync_manager); |
| 589 last_put_offset_ = put_offset; | 584 last_put_offset_ = put_offset; |
| 590 base::Closure task = base::Bind(&InProcessCommandBuffer::FlushOnGpuThread, | 585 base::Closure task = base::Bind(&InProcessCommandBuffer::FlushOnGpuThread, |
| 591 gpu_thread_weak_ptr_, | 586 gpu_thread_weak_ptr_, put_offset, order_num); |
| 592 put_offset, | |
| 593 order_num); | |
| 594 QueueTask(task); | 587 QueueTask(task); |
| 595 | 588 |
| 596 flushed_fence_sync_release_ = next_fence_sync_release_ - 1; | 589 flushed_fence_sync_release_ = next_fence_sync_release_ - 1; |
| 597 } | 590 } |
| 598 | 591 |
| 599 void InProcessCommandBuffer::OrderingBarrier(int32_t put_offset) { | 592 void InProcessCommandBuffer::OrderingBarrier(int32_t put_offset) { |
| 600 Flush(put_offset); | 593 Flush(put_offset); |
| 601 } | 594 } |
| 602 | 595 |
| 603 void InProcessCommandBuffer::WaitForTokenInRange(int32_t start, int32_t end) { | 596 void InProcessCommandBuffer::WaitForTokenInRange(int32_t start, int32_t end) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 int32_t* id) { | 646 int32_t* id) { |
| 654 CheckSequencedThread(); | 647 CheckSequencedThread(); |
| 655 base::AutoLock lock(command_buffer_lock_); | 648 base::AutoLock lock(command_buffer_lock_); |
| 656 return command_buffer_->CreateTransferBuffer(size, id); | 649 return command_buffer_->CreateTransferBuffer(size, id); |
| 657 } | 650 } |
| 658 | 651 |
| 659 void InProcessCommandBuffer::DestroyTransferBuffer(int32_t id) { | 652 void InProcessCommandBuffer::DestroyTransferBuffer(int32_t id) { |
| 660 CheckSequencedThread(); | 653 CheckSequencedThread(); |
| 661 base::Closure task = | 654 base::Closure task = |
| 662 base::Bind(&InProcessCommandBuffer::DestroyTransferBufferOnGpuThread, | 655 base::Bind(&InProcessCommandBuffer::DestroyTransferBufferOnGpuThread, |
| 663 base::Unretained(this), | 656 base::Unretained(this), id); |
| 664 id); | |
| 665 | 657 |
| 666 QueueTask(task); | 658 QueueTask(task); |
| 667 } | 659 } |
| 668 | 660 |
| 669 void InProcessCommandBuffer::DestroyTransferBufferOnGpuThread(int32_t id) { | 661 void InProcessCommandBuffer::DestroyTransferBufferOnGpuThread(int32_t id) { |
| 670 base::AutoLock lock(command_buffer_lock_); | 662 base::AutoLock lock(command_buffer_lock_); |
| 671 command_buffer_->DestroyTransferBuffer(id); | 663 command_buffer_->DestroyTransferBuffer(id); |
| 672 } | 664 } |
| 673 | 665 |
| 674 void InProcessCommandBuffer::SetGpuControlClient(GpuControlClient* client) { | 666 void InProcessCommandBuffer::SetGpuControlClient(GpuControlClient* client) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 694 | 686 |
| 695 DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(), | 687 DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(), |
| 696 capabilities_)); | 688 capabilities_)); |
| 697 DCHECK(gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat( | 689 DCHECK(gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat( |
| 698 internalformat, gpu_memory_buffer->GetFormat())); | 690 internalformat, gpu_memory_buffer->GetFormat())); |
| 699 | 691 |
| 700 // This handle is owned by the GPU thread and must be passed to it or it | 692 // This handle is owned by the GPU thread and must be passed to it or it |
| 701 // will leak. In otherwords, do not early out on error between here and the | 693 // will leak. In otherwords, do not early out on error between here and the |
| 702 // queuing of the CreateImage task below. | 694 // queuing of the CreateImage task below. |
| 703 bool requires_sync_point = false; | 695 bool requires_sync_point = false; |
| 704 gfx::GpuMemoryBufferHandle handle = | 696 gfx::GpuMemoryBufferHandle handle = ShareGpuMemoryBufferToGpuThread( |
| 705 ShareGpuMemoryBufferToGpuThread(gpu_memory_buffer->GetHandle(), | 697 gpu_memory_buffer->GetHandle(), &requires_sync_point); |
| 706 &requires_sync_point); | |
| 707 | 698 |
| 708 SyncPointManager* sync_manager = service_->sync_point_manager(); | 699 SyncPointManager* sync_manager = service_->sync_point_manager(); |
| 709 const uint32_t order_num = | 700 const uint32_t order_num = |
| 710 sync_point_order_data_->GenerateUnprocessedOrderNumber(sync_manager); | 701 sync_point_order_data_->GenerateUnprocessedOrderNumber(sync_manager); |
| 711 | 702 |
| 712 uint64_t fence_sync = 0; | 703 uint64_t fence_sync = 0; |
| 713 if (requires_sync_point) { | 704 if (requires_sync_point) { |
| 714 fence_sync = GenerateFenceSyncRelease(); | 705 fence_sync = GenerateFenceSyncRelease(); |
| 715 | 706 |
| 716 // Previous fence syncs should be flushed already. | 707 // Previous fence syncs should be flushed already. |
| 717 DCHECK_EQ(fence_sync - 1, flushed_fence_sync_release_); | 708 DCHECK_EQ(fence_sync - 1, flushed_fence_sync_release_); |
| 718 } | 709 } |
| 719 | 710 |
| 720 QueueTask(base::Bind(&InProcessCommandBuffer::CreateImageOnGpuThread, | 711 QueueTask(base::Bind( |
| 721 base::Unretained(this), new_id, handle, | 712 &InProcessCommandBuffer::CreateImageOnGpuThread, base::Unretained(this), |
| 722 gfx::Size(width, height), gpu_memory_buffer->GetFormat(), | 713 new_id, handle, gfx::Size(base::checked_cast<int>(width), |
| 723 internalformat, order_num, fence_sync)); | 714 base::checked_cast<int>(height)), |
| 715 gpu_memory_buffer->GetFormat(), |
| 716 base::checked_cast<uint32_t>(internalformat), order_num, fence_sync)); |
| 724 | 717 |
| 725 if (fence_sync) { | 718 if (fence_sync) { |
| 726 flushed_fence_sync_release_ = fence_sync; | 719 flushed_fence_sync_release_ = fence_sync; |
| 727 SyncToken sync_token(GetNamespaceID(), GetExtraCommandBufferData(), | 720 SyncToken sync_token(GetNamespaceID(), GetExtraCommandBufferData(), |
| 728 GetCommandBufferID(), fence_sync); | 721 GetCommandBufferID(), fence_sync); |
| 729 sync_token.SetVerifyFlush(); | 722 sync_token.SetVerifyFlush(); |
| 730 gpu_memory_buffer_manager_->SetDestructionSyncToken(gpu_memory_buffer, | 723 gpu_memory_buffer_manager_->SetDestructionSyncToken(gpu_memory_buffer, |
| 731 sync_token); | 724 sync_token); |
| 732 } | 725 } |
| 733 | 726 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 | 789 |
| 797 if (fence_sync) { | 790 if (fence_sync) { |
| 798 sync_point_client_->ReleaseFenceSync(fence_sync); | 791 sync_point_client_->ReleaseFenceSync(fence_sync); |
| 799 } | 792 } |
| 800 } | 793 } |
| 801 | 794 |
| 802 void InProcessCommandBuffer::DestroyImage(int32_t id) { | 795 void InProcessCommandBuffer::DestroyImage(int32_t id) { |
| 803 CheckSequencedThread(); | 796 CheckSequencedThread(); |
| 804 | 797 |
| 805 QueueTask(base::Bind(&InProcessCommandBuffer::DestroyImageOnGpuThread, | 798 QueueTask(base::Bind(&InProcessCommandBuffer::DestroyImageOnGpuThread, |
| 806 base::Unretained(this), | 799 base::Unretained(this), id)); |
| 807 id)); | |
| 808 } | 800 } |
| 809 | 801 |
| 810 void InProcessCommandBuffer::DestroyImageOnGpuThread(int32_t id) { | 802 void InProcessCommandBuffer::DestroyImageOnGpuThread(int32_t id) { |
| 811 if (!decoder_) | 803 if (!decoder_) |
| 812 return; | 804 return; |
| 813 | 805 |
| 814 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 806 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
| 815 DCHECK(image_manager); | 807 DCHECK(image_manager); |
| 816 if (!image_manager->LookupImage(id)) { | 808 if (!image_manager->LookupImage(id)) { |
| 817 LOG(ERROR) << "Image with ID doesn't exist."; | 809 LOG(ERROR) << "Image with ID doesn't exist."; |
| 818 return; | 810 return; |
| 819 } | 811 } |
| 820 | 812 |
| 821 image_manager->RemoveImage(id); | 813 image_manager->RemoveImage(id); |
| 822 } | 814 } |
| 823 | 815 |
| 824 int32_t InProcessCommandBuffer::CreateGpuMemoryBufferImage( | 816 int32_t InProcessCommandBuffer::CreateGpuMemoryBufferImage( |
| 825 size_t width, | 817 size_t width, |
| 826 size_t height, | 818 size_t height, |
| 827 unsigned internalformat, | 819 unsigned internalformat, |
| 828 unsigned usage) { | 820 unsigned usage) { |
| 829 CheckSequencedThread(); | 821 CheckSequencedThread(); |
| 830 | 822 |
| 831 DCHECK(gpu_memory_buffer_manager_); | 823 DCHECK(gpu_memory_buffer_manager_); |
| 832 std::unique_ptr<gfx::GpuMemoryBuffer> buffer( | 824 std::unique_ptr<gfx::GpuMemoryBuffer> buffer( |
| 833 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( | 825 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( |
| 834 gfx::Size(width, height), | 826 gfx::Size(base::checked_cast<int>(width), |
| 827 base::checked_cast<int>(height)), |
| 835 gpu::DefaultBufferFormatForImageFormat(internalformat), | 828 gpu::DefaultBufferFormatForImageFormat(internalformat), |
| 836 gfx::BufferUsage::SCANOUT, gpu::kNullSurfaceHandle)); | 829 gfx::BufferUsage::SCANOUT, gpu::kNullSurfaceHandle)); |
| 837 if (!buffer) | 830 if (!buffer) |
| 838 return -1; | 831 return -1; |
| 839 | 832 |
| 840 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); | 833 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); |
| 841 } | 834 } |
| 842 | 835 |
| 843 void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) { | 836 void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) { |
| 844 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release)); | 837 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 | 878 |
| 886 void InProcessCommandBuffer::DescheduleUntilFinishedOnGpuThread() { | 879 void InProcessCommandBuffer::DescheduleUntilFinishedOnGpuThread() { |
| 887 NOTIMPLEMENTED(); | 880 NOTIMPLEMENTED(); |
| 888 } | 881 } |
| 889 | 882 |
| 890 void InProcessCommandBuffer::RescheduleAfterFinishedOnGpuThread() { | 883 void InProcessCommandBuffer::RescheduleAfterFinishedOnGpuThread() { |
| 891 NOTIMPLEMENTED(); | 884 NOTIMPLEMENTED(); |
| 892 } | 885 } |
| 893 | 886 |
| 894 void InProcessCommandBuffer::SignalSyncTokenOnGpuThread( | 887 void InProcessCommandBuffer::SignalSyncTokenOnGpuThread( |
| 895 const SyncToken& sync_token, const base::Closure& callback) { | 888 const SyncToken& sync_token, |
| 889 const base::Closure& callback) { |
| 896 gpu::SyncPointManager* sync_point_manager = service_->sync_point_manager(); | 890 gpu::SyncPointManager* sync_point_manager = service_->sync_point_manager(); |
| 897 DCHECK(sync_point_manager); | 891 DCHECK(sync_point_manager); |
| 898 | 892 |
| 899 scoped_refptr<gpu::SyncPointClientState> release_state = | 893 scoped_refptr<gpu::SyncPointClientState> release_state = |
| 900 sync_point_manager->GetSyncPointClientState( | 894 sync_point_manager->GetSyncPointClientState( |
| 901 sync_token.namespace_id(), sync_token.command_buffer_id()); | 895 sync_token.namespace_id(), sync_token.command_buffer_id()); |
| 902 | 896 |
| 903 if (!release_state) { | 897 if (!release_state) { |
| 904 callback.Run(); | 898 callback.Run(); |
| 905 return; | 899 return; |
| 906 } | 900 } |
| 907 | 901 |
| 908 sync_point_client_->WaitOutOfOrder( | 902 sync_point_client_->WaitOutOfOrder( |
| 909 release_state.get(), sync_token.release_count(), WrapCallback(callback)); | 903 release_state.get(), sync_token.release_count(), WrapCallback(callback)); |
| 910 } | 904 } |
| 911 | 905 |
| 912 void InProcessCommandBuffer::SignalQuery(unsigned query_id, | 906 void InProcessCommandBuffer::SignalQuery(unsigned query_id, |
| 913 const base::Closure& callback) { | 907 const base::Closure& callback) { |
| 914 CheckSequencedThread(); | 908 CheckSequencedThread(); |
| 915 QueueTask(base::Bind(&InProcessCommandBuffer::SignalQueryOnGpuThread, | 909 QueueTask(base::Bind(&InProcessCommandBuffer::SignalQueryOnGpuThread, |
| 916 base::Unretained(this), | 910 base::Unretained(this), query_id, |
| 917 query_id, | |
| 918 WrapCallback(callback))); | 911 WrapCallback(callback))); |
| 919 } | 912 } |
| 920 | 913 |
| 921 void InProcessCommandBuffer::SignalQueryOnGpuThread( | 914 void InProcessCommandBuffer::SignalQueryOnGpuThread( |
| 922 unsigned query_id, | 915 unsigned query_id, |
| 923 const base::Closure& callback) { | 916 const base::Closure& callback) { |
| 924 gles2::QueryManager* query_manager_ = decoder_->GetQueryManager(); | 917 gles2::QueryManager* query_manager_ = decoder_->GetQueryManager(); |
| 925 DCHECK(query_manager_); | 918 DCHECK(query_manager_); |
| 926 | 919 |
| 927 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id); | 920 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 } | 958 } |
| 966 | 959 |
| 967 bool InProcessCommandBuffer::IsFenceSyncFlushReceived(uint64_t release) { | 960 bool InProcessCommandBuffer::IsFenceSyncFlushReceived(uint64_t release) { |
| 968 return IsFenceSyncFlushed(release); | 961 return IsFenceSyncFlushed(release); |
| 969 } | 962 } |
| 970 | 963 |
| 971 void InProcessCommandBuffer::SignalSyncToken(const SyncToken& sync_token, | 964 void InProcessCommandBuffer::SignalSyncToken(const SyncToken& sync_token, |
| 972 const base::Closure& callback) { | 965 const base::Closure& callback) { |
| 973 CheckSequencedThread(); | 966 CheckSequencedThread(); |
| 974 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncTokenOnGpuThread, | 967 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncTokenOnGpuThread, |
| 975 base::Unretained(this), | 968 base::Unretained(this), sync_token, |
| 976 sync_token, | |
| 977 WrapCallback(callback))); | 969 WrapCallback(callback))); |
| 978 } | 970 } |
| 979 | 971 |
| 980 bool InProcessCommandBuffer::CanWaitUnverifiedSyncToken( | 972 bool InProcessCommandBuffer::CanWaitUnverifiedSyncToken( |
| 981 const SyncToken* sync_token) { | 973 const SyncToken* sync_token) { |
| 982 return sync_token->namespace_id() == GetNamespaceID(); | 974 return sync_token->namespace_id() == GetNamespaceID(); |
| 983 } | 975 } |
| 984 | 976 |
| 985 gpu::error::Error InProcessCommandBuffer::GetLastError() { | 977 gpu::error::Error InProcessCommandBuffer::GetLastError() { |
| 986 CheckSequencedThread(); | 978 CheckSequencedThread(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 framebuffer_completeness_cache_ = | 1060 framebuffer_completeness_cache_ = |
| 1069 new gpu::gles2::FramebufferCompletenessCache; | 1061 new gpu::gles2::FramebufferCompletenessCache; |
| 1070 return framebuffer_completeness_cache_; | 1062 return framebuffer_completeness_cache_; |
| 1071 } | 1063 } |
| 1072 | 1064 |
| 1073 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1065 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
| 1074 return sync_point_manager_; | 1066 return sync_point_manager_; |
| 1075 } | 1067 } |
| 1076 | 1068 |
| 1077 } // namespace gpu | 1069 } // namespace gpu |
| OLD | NEW |