| 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/command_buffer/service/in_process_command_buffer.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/sequence_checker.h" | 18 #include "base/sequence_checker.h" |
| 19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 20 #include "base/thread_task_runner_handle.h" | 20 #include "base/thread_task_runner_handle.h" |
| 21 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 21 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
| 22 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 22 #include "gpu/command_buffer/common/value_state.h" | 23 #include "gpu/command_buffer/common/value_state.h" |
| 23 #include "gpu/command_buffer/service/command_buffer_service.h" | 24 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 24 #include "gpu/command_buffer/service/context_group.h" | 25 #include "gpu/command_buffer/service/context_group.h" |
| 25 #include "gpu/command_buffer/service/gl_context_virtual.h" | 26 #include "gpu/command_buffer/service/gl_context_virtual.h" |
| 26 #include "gpu/command_buffer/service/gpu_scheduler.h" | 27 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 27 #include "gpu/command_buffer/service/gpu_switches.h" | 28 #include "gpu/command_buffer/service/gpu_switches.h" |
| 28 #include "gpu/command_buffer/service/image_factory.h" | 29 #include "gpu/command_buffer/service/image_factory.h" |
| 29 #include "gpu/command_buffer/service/image_manager.h" | 30 #include "gpu/command_buffer/service/image_manager.h" |
| 30 #include "gpu/command_buffer/service/mailbox_manager.h" | 31 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 31 #include "gpu/command_buffer/service/memory_program_cache.h" | 32 #include "gpu/command_buffer/service/memory_program_cache.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 176 } |
| 176 | 177 |
| 177 InProcessCommandBuffer::InProcessCommandBuffer( | 178 InProcessCommandBuffer::InProcessCommandBuffer( |
| 178 const scoped_refptr<Service>& service) | 179 const scoped_refptr<Service>& service) |
| 179 : command_buffer_id_(g_next_command_buffer_id.GetNext()), | 180 : command_buffer_id_(g_next_command_buffer_id.GetNext()), |
| 180 context_lost_(false), | 181 context_lost_(false), |
| 181 delayed_work_pending_(false), | 182 delayed_work_pending_(false), |
| 182 image_factory_(nullptr), | 183 image_factory_(nullptr), |
| 183 last_put_offset_(-1), | 184 last_put_offset_(-1), |
| 184 gpu_memory_buffer_manager_(nullptr), | 185 gpu_memory_buffer_manager_(nullptr), |
| 186 next_fence_sync_release_(1), |
| 187 flushed_fence_sync_release_(0), |
| 185 flush_event_(false, false), | 188 flush_event_(false, false), |
| 186 service_(GetInitialService(service)), | 189 service_(GetInitialService(service)), |
| 190 fence_sync_wait_event_(false, false), |
| 187 gpu_thread_weak_ptr_factory_(this) { | 191 gpu_thread_weak_ptr_factory_(this) { |
| 188 DCHECK(service_.get()); | 192 DCHECK(service_.get()); |
| 189 next_image_id_.GetNext(); | 193 next_image_id_.GetNext(); |
| 190 } | 194 } |
| 191 | 195 |
| 192 InProcessCommandBuffer::~InProcessCommandBuffer() { | 196 InProcessCommandBuffer::~InProcessCommandBuffer() { |
| 193 Destroy(); | 197 Destroy(); |
| 194 } | 198 } |
| 195 | 199 |
| 196 void InProcessCommandBuffer::OnResizeView(gfx::Size size, float scale_factor) { | 200 void InProcessCommandBuffer::OnResizeView(gfx::Size size, float scale_factor) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 else | 341 else |
| 338 surface_ = gfx::GLSurface::CreateViewGLSurface(params.window); | 342 surface_ = gfx::GLSurface::CreateViewGLSurface(params.window); |
| 339 } | 343 } |
| 340 | 344 |
| 341 if (!surface_.get()) { | 345 if (!surface_.get()) { |
| 342 LOG(ERROR) << "Could not create GLSurface."; | 346 LOG(ERROR) << "Could not create GLSurface."; |
| 343 DestroyOnGpuThread(); | 347 DestroyOnGpuThread(); |
| 344 return false; | 348 return false; |
| 345 } | 349 } |
| 346 | 350 |
| 347 sync_point_client_state_ = SyncPointClientState::Create(); | 351 sync_point_order_data_ = SyncPointOrderData::Create(); |
| 348 sync_point_client_ = service_->sync_point_manager()->CreateSyncPointClient( | 352 sync_point_client_ = service_->sync_point_manager()->CreateSyncPointClient( |
| 349 sync_point_client_state_, | 353 sync_point_order_data_, GetNamespaceID(), GetCommandBufferID()); |
| 350 GetNamespaceID(), GetCommandBufferID()); | |
| 351 | 354 |
| 352 if (service_->UseVirtualizedGLContexts() || | 355 if (service_->UseVirtualizedGLContexts() || |
| 353 decoder_->GetContextGroup() | 356 decoder_->GetContextGroup() |
| 354 ->feature_info() | 357 ->feature_info() |
| 355 ->UseVirtualizedGLContexts()) { | 358 ->UseVirtualizedGLContexts()) { |
| 356 context_ = gl_share_group_->GetSharedContext(); | 359 context_ = gl_share_group_->GetSharedContext(); |
| 357 if (!context_.get()) { | 360 if (!context_.get()) { |
| 358 context_ = gfx::GLContext::CreateGLContext( | 361 context_ = gfx::GLContext::CreateGLContext( |
| 359 gl_share_group_.get(), surface_.get(), params.gpu_preference); | 362 gl_share_group_.get(), surface_.get(), params.gpu_preference); |
| 360 gl_share_group_->SetSharedContext(context_.get()); | 363 gl_share_group_->SetSharedContext(context_.get()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } | 409 } |
| 407 *params.capabilities = decoder_->GetCapabilities(); | 410 *params.capabilities = decoder_->GetCapabilities(); |
| 408 | 411 |
| 409 if (!params.is_offscreen) { | 412 if (!params.is_offscreen) { |
| 410 decoder_->SetResizeCallback(base::Bind( | 413 decoder_->SetResizeCallback(base::Bind( |
| 411 &InProcessCommandBuffer::OnResizeView, gpu_thread_weak_ptr_)); | 414 &InProcessCommandBuffer::OnResizeView, gpu_thread_weak_ptr_)); |
| 412 } | 415 } |
| 413 decoder_->SetWaitSyncPointCallback( | 416 decoder_->SetWaitSyncPointCallback( |
| 414 base::Bind(&InProcessCommandBuffer::WaitSyncPointOnGpuThread, | 417 base::Bind(&InProcessCommandBuffer::WaitSyncPointOnGpuThread, |
| 415 base::Unretained(this))); | 418 base::Unretained(this))); |
| 419 decoder_->SetFenceSyncReleaseCallback( |
| 420 base::Bind(&InProcessCommandBuffer::FenceSyncReleaseOnGpuThread, |
| 421 base::Unretained(this))); |
| 422 decoder_->SetWaitFenceSyncCallback( |
| 423 base::Bind(&InProcessCommandBuffer::WaitFenceSyncOnGpuThread, |
| 424 base::Unretained(this))); |
| 416 | 425 |
| 417 image_factory_ = params.image_factory; | 426 image_factory_ = params.image_factory; |
| 418 | 427 |
| 419 return true; | 428 return true; |
| 420 } | 429 } |
| 421 | 430 |
| 422 void InProcessCommandBuffer::Destroy() { | 431 void InProcessCommandBuffer::Destroy() { |
| 423 CheckSequencedThread(); | 432 CheckSequencedThread(); |
| 424 | 433 |
| 425 base::WaitableEvent completion(true, false); | 434 base::WaitableEvent completion(true, false); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 437 command_buffer_.reset(); | 446 command_buffer_.reset(); |
| 438 // Clean up GL resources if possible. | 447 // Clean up GL resources if possible. |
| 439 bool have_context = context_.get() && context_->MakeCurrent(surface_.get()); | 448 bool have_context = context_.get() && context_->MakeCurrent(surface_.get()); |
| 440 if (decoder_) { | 449 if (decoder_) { |
| 441 decoder_->Destroy(have_context); | 450 decoder_->Destroy(have_context); |
| 442 decoder_.reset(); | 451 decoder_.reset(); |
| 443 } | 452 } |
| 444 context_ = NULL; | 453 context_ = NULL; |
| 445 surface_ = NULL; | 454 surface_ = NULL; |
| 446 sync_point_client_ = NULL; | 455 sync_point_client_ = NULL; |
| 447 sync_point_client_state_ = NULL; | 456 if (sync_point_order_data_) { |
| 457 sync_point_order_data_->Destroy(); |
| 458 sync_point_order_data_ = nullptr; |
| 459 } |
| 448 gl_share_group_ = NULL; | 460 gl_share_group_ = NULL; |
| 449 #if defined(OS_ANDROID) | 461 #if defined(OS_ANDROID) |
| 450 stream_texture_manager_.reset(); | 462 stream_texture_manager_.reset(); |
| 451 #endif | 463 #endif |
| 452 | 464 |
| 453 return true; | 465 return true; |
| 454 } | 466 } |
| 455 | 467 |
| 456 void InProcessCommandBuffer::CheckSequencedThread() { | 468 void InProcessCommandBuffer::CheckSequencedThread() { |
| 457 DCHECK(!sequence_checker_ || | 469 DCHECK(!sequence_checker_ || |
| (...skipping 28 matching lines...) Expand all Loading... |
| 486 GetStateFast(); | 498 GetStateFast(); |
| 487 return last_state_.token; | 499 return last_state_.token; |
| 488 } | 500 } |
| 489 | 501 |
| 490 void InProcessCommandBuffer::FlushOnGpuThread(int32 put_offset, | 502 void InProcessCommandBuffer::FlushOnGpuThread(int32 put_offset, |
| 491 uint32_t order_num) { | 503 uint32_t order_num) { |
| 492 CheckSequencedThread(); | 504 CheckSequencedThread(); |
| 493 ScopedEvent handle_flush(&flush_event_); | 505 ScopedEvent handle_flush(&flush_event_); |
| 494 base::AutoLock lock(command_buffer_lock_); | 506 base::AutoLock lock(command_buffer_lock_); |
| 495 | 507 |
| 496 sync_point_client_state_->BeginProcessingOrderNumber(order_num); | 508 sync_point_order_data_->BeginProcessingOrderNumber(order_num); |
| 497 command_buffer_->Flush(put_offset); | 509 command_buffer_->Flush(put_offset); |
| 498 { | 510 { |
| 499 // Update state before signaling the flush event. | 511 // Update state before signaling the flush event. |
| 500 base::AutoLock lock(state_after_last_flush_lock_); | 512 base::AutoLock lock(state_after_last_flush_lock_); |
| 501 state_after_last_flush_ = command_buffer_->GetLastState(); | 513 state_after_last_flush_ = command_buffer_->GetLastState(); |
| 502 } | 514 } |
| 503 DCHECK((!error::IsError(state_after_last_flush_.error) && !context_lost_) || | 515 DCHECK((!error::IsError(state_after_last_flush_.error) && !context_lost_) || |
| 504 (error::IsError(state_after_last_flush_.error) && context_lost_)); | 516 (error::IsError(state_after_last_flush_.error) && context_lost_)); |
| 505 | 517 |
| 506 // Currently the in process command buffer does not support being descheduled, | 518 // Currently the in process command buffer does not support being descheduled, |
| 507 // if it does we would need to back off on calling the finish processing | 519 // if it does we would need to back off on calling the finish processing |
| 508 // order number function until the message is rescheduled and finished | 520 // order number function until the message is rescheduled and finished |
| 509 // processing. This DCHECK is to enforce this. | 521 // processing. This DCHECK is to enforce this. |
| 510 DCHECK(context_lost_ || put_offset == state_after_last_flush_.get_offset); | 522 DCHECK(context_lost_ || put_offset == state_after_last_flush_.get_offset); |
| 511 sync_point_client_state_->FinishProcessingOrderNumber(order_num); | 523 sync_point_order_data_->FinishProcessingOrderNumber(order_num); |
| 512 | 524 |
| 513 // If we've processed all pending commands but still have pending queries, | 525 // If we've processed all pending commands but still have pending queries, |
| 514 // pump idle work until the query is passed. | 526 // pump idle work until the query is passed. |
| 515 if (put_offset == state_after_last_flush_.get_offset && | 527 if (put_offset == state_after_last_flush_.get_offset && |
| 516 (gpu_scheduler_->HasMoreIdleWork() || | 528 (gpu_scheduler_->HasMoreIdleWork() || |
| 517 gpu_scheduler_->HasPendingQueries())) { | 529 gpu_scheduler_->HasPendingQueries())) { |
| 518 ScheduleDelayedWorkOnGpuThread(); | 530 ScheduleDelayedWorkOnGpuThread(); |
| 519 } | 531 } |
| 520 } | 532 } |
| 521 | 533 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 545 void InProcessCommandBuffer::Flush(int32 put_offset) { | 557 void InProcessCommandBuffer::Flush(int32 put_offset) { |
| 546 CheckSequencedThread(); | 558 CheckSequencedThread(); |
| 547 if (last_state_.error != gpu::error::kNoError) | 559 if (last_state_.error != gpu::error::kNoError) |
| 548 return; | 560 return; |
| 549 | 561 |
| 550 if (last_put_offset_ == put_offset) | 562 if (last_put_offset_ == put_offset) |
| 551 return; | 563 return; |
| 552 | 564 |
| 553 SyncPointManager* sync_manager = service_->sync_point_manager(); | 565 SyncPointManager* sync_manager = service_->sync_point_manager(); |
| 554 const uint32_t order_num = | 566 const uint32_t order_num = |
| 555 sync_point_client_state_->GenerateUnprocessedOrderNumber(sync_manager); | 567 sync_point_order_data_->GenerateUnprocessedOrderNumber(sync_manager); |
| 556 last_put_offset_ = put_offset; | 568 last_put_offset_ = put_offset; |
| 557 base::Closure task = base::Bind(&InProcessCommandBuffer::FlushOnGpuThread, | 569 base::Closure task = base::Bind(&InProcessCommandBuffer::FlushOnGpuThread, |
| 558 gpu_thread_weak_ptr_, | 570 gpu_thread_weak_ptr_, |
| 559 put_offset, | 571 put_offset, |
| 560 order_num); | 572 order_num); |
| 561 QueueTask(task); | 573 QueueTask(task); |
| 574 |
| 575 flushed_fence_sync_release_ = next_fence_sync_release_ - 1; |
| 562 } | 576 } |
| 563 | 577 |
| 564 void InProcessCommandBuffer::OrderingBarrier(int32 put_offset) { | 578 void InProcessCommandBuffer::OrderingBarrier(int32 put_offset) { |
| 565 Flush(put_offset); | 579 Flush(put_offset); |
| 566 } | 580 } |
| 567 | 581 |
| 568 void InProcessCommandBuffer::WaitForTokenInRange(int32 start, int32 end) { | 582 void InProcessCommandBuffer::WaitForTokenInRange(int32 start, int32 end) { |
| 569 CheckSequencedThread(); | 583 CheckSequencedThread(); |
| 570 while (!InRange(start, end, GetLastToken()) && | 584 while (!InRange(start, end, GetLastToken()) && |
| 571 last_state_.error == gpu::error::kNoError) | 585 last_state_.error == gpu::error::kNoError) |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 804 |
| 791 void InProcessCommandBuffer::RetireSyncPointOnGpuThread(uint32 sync_point) { | 805 void InProcessCommandBuffer::RetireSyncPointOnGpuThread(uint32 sync_point) { |
| 792 gles2::MailboxManager* mailbox_manager = | 806 gles2::MailboxManager* mailbox_manager = |
| 793 decoder_->GetContextGroup()->mailbox_manager(); | 807 decoder_->GetContextGroup()->mailbox_manager(); |
| 794 if (mailbox_manager->UsesSync()) { | 808 if (mailbox_manager->UsesSync()) { |
| 795 bool make_current_success = false; | 809 bool make_current_success = false; |
| 796 { | 810 { |
| 797 base::AutoLock lock(command_buffer_lock_); | 811 base::AutoLock lock(command_buffer_lock_); |
| 798 make_current_success = MakeCurrent(); | 812 make_current_success = MakeCurrent(); |
| 799 } | 813 } |
| 800 if (make_current_success) | 814 if (make_current_success) { |
| 801 mailbox_manager->PushTextureUpdates(sync_point); | 815 // Old sync points are global and do not have a command buffer ID, |
| 816 // We can simply use the GPUIO namespace with 0 for the command buffer ID |
| 817 // (under normal circumstances 0 is invalid so will not be used) until |
| 818 // the old sync points are replaced. |
| 819 gles2::SyncToken sync_token = { |
| 820 gpu::CommandBufferNamespace::GPU_IO, |
| 821 0, |
| 822 sync_point |
| 823 }; |
| 824 mailbox_manager->PushTextureUpdates(sync_token); |
| 825 } |
| 802 } | 826 } |
| 803 service_->sync_point_manager()->RetireSyncPoint(sync_point); | 827 service_->sync_point_manager()->RetireSyncPoint(sync_point); |
| 804 } | 828 } |
| 805 | 829 |
| 806 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point, | 830 void InProcessCommandBuffer::SignalSyncPoint(unsigned sync_point, |
| 807 const base::Closure& callback) { | 831 const base::Closure& callback) { |
| 808 CheckSequencedThread(); | 832 CheckSequencedThread(); |
| 809 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncPointOnGpuThread, | 833 QueueTask(base::Bind(&InProcessCommandBuffer::SignalSyncPointOnGpuThread, |
| 810 base::Unretained(this), | 834 base::Unretained(this), |
| 811 sync_point, | 835 sync_point, |
| 812 WrapCallback(callback))); | 836 WrapCallback(callback))); |
| 813 } | 837 } |
| 814 | 838 |
| 815 bool InProcessCommandBuffer::WaitSyncPointOnGpuThread(unsigned sync_point) { | 839 bool InProcessCommandBuffer::WaitSyncPointOnGpuThread(unsigned sync_point) { |
| 816 service_->sync_point_manager()->WaitSyncPoint(sync_point); | 840 service_->sync_point_manager()->WaitSyncPoint(sync_point); |
| 817 gles2::MailboxManager* mailbox_manager = | 841 gles2::MailboxManager* mailbox_manager = |
| 818 decoder_->GetContextGroup()->mailbox_manager(); | 842 decoder_->GetContextGroup()->mailbox_manager(); |
| 819 mailbox_manager->PullTextureUpdates(sync_point); | 843 // Old sync points are global and do not have a command buffer ID, |
| 844 // We can simply use the GPUIO namespace with 0 for the command buffer ID |
| 845 // (under normal circumstances 0 is invalid so will not be used) until |
| 846 // the old sync points are replaced. |
| 847 gles2::SyncToken sync_token = { |
| 848 gpu::CommandBufferNamespace::GPU_IO, |
| 849 0, |
| 850 sync_point |
| 851 }; |
| 852 mailbox_manager->PullTextureUpdates(sync_token); |
| 820 return true; | 853 return true; |
| 821 } | 854 } |
| 822 | 855 |
| 856 void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) { |
| 857 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release)); |
| 858 gles2::MailboxManager* mailbox_manager = |
| 859 decoder_->GetContextGroup()->mailbox_manager(); |
| 860 if (mailbox_manager->UsesSync()) { |
| 861 bool make_current_success = false; |
| 862 { |
| 863 base::AutoLock lock(command_buffer_lock_); |
| 864 make_current_success = MakeCurrent(); |
| 865 } |
| 866 if (make_current_success) { |
| 867 gles2::SyncToken sync_token = { |
| 868 GetNamespaceID(), |
| 869 GetCommandBufferID(), |
| 870 release |
| 871 }; |
| 872 mailbox_manager->PushTextureUpdates(sync_token); |
| 873 } |
| 874 } |
| 875 |
| 876 sync_point_client_->ReleaseFenceSync(release); |
| 877 } |
| 878 |
| 879 bool InProcessCommandBuffer::WaitFenceSyncOnGpuThread( |
| 880 gpu::CommandBufferNamespace namespace_id, |
| 881 uint64_t command_buffer_id, |
| 882 uint64_t release) { |
| 883 gpu::SyncPointManager* sync_point_manager = service_->sync_point_manager(); |
| 884 DCHECK(sync_point_manager); |
| 885 |
| 886 scoped_refptr<gpu::SyncPointClientState> release_state = |
| 887 sync_point_manager->GetSyncPointClientState(namespace_id, |
| 888 command_buffer_id); |
| 889 |
| 890 if (!release_state) |
| 891 return true; |
| 892 |
| 893 if (!release_state->IsFenceSyncReleased(release)) { |
| 894 // Use waitable event which is signalled when the release fence is released. |
| 895 sync_point_client_->Wait( |
| 896 release_state, |
| 897 release, |
| 898 base::Bind(&base::WaitableEvent::Signal, |
| 899 base::Unretained(&fence_sync_wait_event_))); |
| 900 fence_sync_wait_event_.Wait(); |
| 901 } |
| 902 |
| 903 gles2::MailboxManager* mailbox_manager = |
| 904 decoder_->GetContextGroup()->mailbox_manager(); |
| 905 gles2::SyncToken sync_token = { |
| 906 namespace_id, |
| 907 command_buffer_id, |
| 908 release |
| 909 }; |
| 910 mailbox_manager->PullTextureUpdates(sync_token); |
| 911 return true; |
| 912 } |
| 913 |
| 823 void InProcessCommandBuffer::SignalSyncPointOnGpuThread( | 914 void InProcessCommandBuffer::SignalSyncPointOnGpuThread( |
| 824 unsigned sync_point, | 915 unsigned sync_point, |
| 825 const base::Closure& callback) { | 916 const base::Closure& callback) { |
| 826 service_->sync_point_manager()->AddSyncPointCallback(sync_point, callback); | 917 service_->sync_point_manager()->AddSyncPointCallback(sync_point, callback); |
| 827 } | 918 } |
| 828 | 919 |
| 829 void InProcessCommandBuffer::SignalQuery(unsigned query_id, | 920 void InProcessCommandBuffer::SignalQuery(unsigned query_id, |
| 830 const base::Closure& callback) { | 921 const base::Closure& callback) { |
| 831 CheckSequencedThread(); | 922 CheckSequencedThread(); |
| 832 QueueTask(base::Bind(&InProcessCommandBuffer::SignalQueryOnGpuThread, | 923 QueueTask(base::Bind(&InProcessCommandBuffer::SignalQueryOnGpuThread, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 } | 964 } |
| 874 | 965 |
| 875 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const { | 966 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const { |
| 876 return CommandBufferNamespace::IN_PROCESS; | 967 return CommandBufferNamespace::IN_PROCESS; |
| 877 } | 968 } |
| 878 | 969 |
| 879 uint64_t InProcessCommandBuffer::GetCommandBufferID() const { | 970 uint64_t InProcessCommandBuffer::GetCommandBufferID() const { |
| 880 return command_buffer_id_; | 971 return command_buffer_id_; |
| 881 } | 972 } |
| 882 | 973 |
| 974 uint64_t InProcessCommandBuffer::GenerateFenceSyncRelease() { |
| 975 return next_fence_sync_release_++; |
| 976 } |
| 977 |
| 978 bool InProcessCommandBuffer::IsFenceSyncRelease(uint64_t release) { |
| 979 return release != 0 && release < next_fence_sync_release_; |
| 980 } |
| 981 |
| 982 bool InProcessCommandBuffer::IsFenceSyncFlushed(uint64_t release) { |
| 983 return release <= flushed_fence_sync_release_; |
| 984 } |
| 985 |
| 883 uint32 InProcessCommandBuffer::CreateStreamTextureOnGpuThread( | 986 uint32 InProcessCommandBuffer::CreateStreamTextureOnGpuThread( |
| 884 uint32 client_texture_id) { | 987 uint32 client_texture_id) { |
| 885 #if defined(OS_ANDROID) | 988 #if defined(OS_ANDROID) |
| 886 return stream_texture_manager_->CreateStreamTexture( | 989 return stream_texture_manager_->CreateStreamTexture( |
| 887 client_texture_id, decoder_->GetContextGroup()->texture_manager()); | 990 client_texture_id, decoder_->GetContextGroup()->texture_manager()); |
| 888 #else | 991 #else |
| 889 return 0; | 992 return 0; |
| 890 #endif | 993 #endif |
| 891 } | 994 } |
| 892 | 995 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 framebuffer_completeness_cache_ = | 1090 framebuffer_completeness_cache_ = |
| 988 new gpu::gles2::FramebufferCompletenessCache; | 1091 new gpu::gles2::FramebufferCompletenessCache; |
| 989 return framebuffer_completeness_cache_; | 1092 return framebuffer_completeness_cache_; |
| 990 } | 1093 } |
| 991 | 1094 |
| 992 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1095 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
| 993 return sync_point_manager_; | 1096 return sync_point_manager_; |
| 994 } | 1097 } |
| 995 | 1098 |
| 996 } // namespace gpu | 1099 } // namespace gpu |
| OLD | NEW |