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

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

Issue 12040049: gpu: Implement idle async pixel transfers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DCHECKs to ensure idle async uploads are only used with GL_TEXTURE_2D target Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 virtual void RestoreFramebufferBindings() const OVERRIDE; 628 virtual void RestoreFramebufferBindings() const OVERRIDE;
629 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; 629 virtual void RestoreTextureState(unsigned service_id) const OVERRIDE;
630 630
631 virtual QueryManager* GetQueryManager() OVERRIDE { 631 virtual QueryManager* GetQueryManager() OVERRIDE {
632 return query_manager_.get(); 632 return query_manager_.get();
633 } 633 }
634 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { 634 virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE {
635 return vertex_array_manager_.get(); 635 return vertex_array_manager_.get();
636 } 636 }
637 virtual bool ProcessPendingQueries() OVERRIDE; 637 virtual bool ProcessPendingQueries() OVERRIDE;
638 virtual bool HasMoreIdleWork() OVERRIDE;
639 virtual void PerformIdleWork() OVERRIDE;
638 640
639 virtual void SetResizeCallback( 641 virtual void SetResizeCallback(
640 const base::Callback<void(gfx::Size)>& callback) OVERRIDE; 642 const base::Callback<void(gfx::Size)>& callback) OVERRIDE;
641 643
642 virtual void SetMsgCallback(const MsgCallback& callback) OVERRIDE; 644 virtual void SetMsgCallback(const MsgCallback& callback) OVERRIDE;
643 virtual void SetShaderCacheCallback( 645 virtual void SetShaderCacheCallback(
644 const ShaderCacheCallback& callback) OVERRIDE; 646 const ShaderCacheCallback& callback) OVERRIDE;
645 virtual void SetWaitSyncPointCallback( 647 virtual void SetWaitSyncPointCallback(
646 const WaitSyncPointCallback& callback) OVERRIDE; 648 const WaitSyncPointCallback& callback) OVERRIDE;
647 649
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2867 2869
2868 void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() { 2870 void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() {
2869 if (engine() && query_manager_.get()) 2871 if (engine() && query_manager_.get())
2870 query_manager_->ProcessPendingTransferQueries(); 2872 query_manager_->ProcessPendingTransferQueries();
2871 2873
2872 // TODO(epenner): Is there a better place to do this? 2874 // TODO(epenner): Is there a better place to do this?
2873 // This needs to occur before we execute any batch of commands 2875 // This needs to occur before we execute any batch of commands
2874 // from the client, as the client may have recieved an async 2876 // from the client, as the client may have recieved an async
2875 // completion while issuing those commands. 2877 // completion while issuing those commands.
2876 // "DidFlushStart" would be ideal if we had such a callback. 2878 // "DidFlushStart" would be ideal if we had such a callback.
2879 // TODO(reveman): We should avoid using a bool return value to determine
2880 // if we need to restore some state. crbug.com/196303
2877 if (async_pixel_transfer_delegate_->BindCompletedAsyncTransfers()) 2881 if (async_pixel_transfer_delegate_->BindCompletedAsyncTransfers())
2878 RestoreCurrentTexture2DBindings(); 2882 RestoreCurrentTexture2DBindings();
2879 } 2883 }
2880 2884
2881 void GLES2DecoderImpl::ReleaseCurrent() { 2885 void GLES2DecoderImpl::ReleaseCurrent() {
2882 if (context_.get()) 2886 if (context_.get())
2883 context_->ReleaseCurrent(surface_.get()); 2887 context_->ReleaseCurrent(surface_.get());
2884 } 2888 }
2885 2889
2886 void GLES2DecoderImpl::RestoreCurrentRenderbufferBindings() { 2890 void GLES2DecoderImpl::RestoreCurrentRenderbufferBindings() {
(...skipping 6395 matching lines...) Expand 10 before | Expand all | Expand 10 after
9282 bool GLES2DecoderImpl::ProcessPendingQueries() { 9286 bool GLES2DecoderImpl::ProcessPendingQueries() {
9283 if (query_manager_.get() == NULL) { 9287 if (query_manager_.get() == NULL) {
9284 return false; 9288 return false;
9285 } 9289 }
9286 if (!query_manager_->ProcessPendingQueries()) { 9290 if (!query_manager_->ProcessPendingQueries()) {
9287 current_decoder_error_ = error::kOutOfBounds; 9291 current_decoder_error_ = error::kOutOfBounds;
9288 } 9292 }
9289 return query_manager_->HavePendingQueries(); 9293 return query_manager_->HavePendingQueries();
9290 } 9294 }
9291 9295
9296 bool GLES2DecoderImpl::HasMoreIdleWork() {
9297 return async_pixel_transfer_delegate_->NeedsProcessMorePendingTransfers();
9298 }
9299
9300 void GLES2DecoderImpl::PerformIdleWork() {
9301 if (!async_pixel_transfer_delegate_->NeedsProcessMorePendingTransfers())
9302 return;
9303 // TODO(reveman): We should avoid using a bool return value to determine
9304 // if we need to restore some state. crbug.com/196303
9305 if (async_pixel_transfer_delegate_->ProcessMorePendingTransfers())
9306 RestoreCurrentTexture2DBindings();
9307 ProcessFinishedAsyncTransfers();
9308 }
9309
9292 error::Error GLES2DecoderImpl::HandleBeginQueryEXT( 9310 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(
9293 uint32 immediate_data_size, const cmds::BeginQueryEXT& c) { 9311 uint32 immediate_data_size, const cmds::BeginQueryEXT& c) {
9294 GLenum target = static_cast<GLenum>(c.target); 9312 GLenum target = static_cast<GLenum>(c.target);
9295 GLuint client_id = static_cast<GLuint>(c.id); 9313 GLuint client_id = static_cast<GLuint>(c.id);
9296 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); 9314 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id);
9297 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); 9315 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset);
9298 9316
9299 switch (target) { 9317 switch (target) {
9300 case GL_COMMANDS_ISSUED_CHROMIUM: 9318 case GL_COMMANDS_ISSUED_CHROMIUM:
9301 case GL_LATENCY_QUERY_CHROMIUM: 9319 case GL_LATENCY_QUERY_CHROMIUM:
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
10439 return error::kNoError; 10457 return error::kNoError;
10440 } 10458 }
10441 10459
10442 // Include the auto-generated part of this file. We split this because it means 10460 // Include the auto-generated part of this file. We split this because it means
10443 // we can easily edit the non-auto generated parts right here in this file 10461 // we can easily edit the non-auto generated parts right here in this file
10444 // instead of having to edit some template or the code generator. 10462 // instead of having to edit some template or the code generator.
10445 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10463 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10446 10464
10447 } // namespace gles2 10465 } // namespace gles2
10448 } // namespace gpu 10466 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698