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

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

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: [WIP] Introduced internal SetAsyncToken command buffer command Created 6 years, 11 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 (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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 void DeleteBuffersHelper(GLsizei n, const GLuint* client_ids); 669 void DeleteBuffersHelper(GLsizei n, const GLuint* client_ids);
670 bool GenFramebuffersHelper(GLsizei n, const GLuint* client_ids); 670 bool GenFramebuffersHelper(GLsizei n, const GLuint* client_ids);
671 void DeleteFramebuffersHelper(GLsizei n, const GLuint* client_ids); 671 void DeleteFramebuffersHelper(GLsizei n, const GLuint* client_ids);
672 bool GenRenderbuffersHelper(GLsizei n, const GLuint* client_ids); 672 bool GenRenderbuffersHelper(GLsizei n, const GLuint* client_ids);
673 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids); 673 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids);
674 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids); 674 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids);
675 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids); 675 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids);
676 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); 676 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids);
677 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); 677 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids);
678 678
679 // Callback for completed async uploads.
680 void AsyncUploadCompleted(uint32 async_token);
reveman 2014/01/22 17:30:04 This is not really a completed upload, it's the pa
681
682 // Overridden from CommonDecoder
683 virtual void OnSetAsyncToken(uint32 async_token) OVERRIDE;
684
679 // Workarounds 685 // Workarounds
680 void OnFboChanged() const; 686 void OnFboChanged() const;
681 void OnUseFramebuffer() const; 687 void OnUseFramebuffer() const;
682 688
683 // TODO(gman): Cache these pointers? 689 // TODO(gman): Cache these pointers?
684 BufferManager* buffer_manager() { 690 BufferManager* buffer_manager() {
685 return group_->buffer_manager(); 691 return group_->buffer_manager();
686 } 692 }
687 693
688 RenderbufferManager* renderbuffer_manager() { 694 RenderbufferManager* renderbuffer_manager() {
(...skipping 2851 matching lines...) Expand 10 before | Expand all | Expand 10 after
3540 return error::kNoError; 3546 return error::kNoError;
3541 } 3547 }
3542 3548
3543 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { 3549 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const {
3544 if (command_id > kStartPoint && command_id < kNumCommands) { 3550 if (command_id > kStartPoint && command_id < kNumCommands) {
3545 return gles2::GetCommandName(static_cast<CommandId>(command_id)); 3551 return gles2::GetCommandName(static_cast<CommandId>(command_id));
3546 } 3552 }
3547 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); 3553 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id));
3548 } 3554 }
3549 3555
3556 void GLES2DecoderImpl::AsyncUploadCompleted(uint32 async_token) {
3557 engine()->set_async_token(async_token);
3558 }
3559
3560 void GLES2DecoderImpl::OnSetAsyncToken(uint32 async_token) {
3561 GetAsyncPixelTransferManager()->AsyncRunWhenCompleted(
3562 base::Bind(&GLES2DecoderImpl::AsyncUploadCompleted,
3563 base::Unretained(this),
3564 async_token));
3565 }
3566
3550 // Decode command with its arguments, and call the corresponding GL function. 3567 // Decode command with its arguments, and call the corresponding GL function.
3551 // Note: args is a pointer to the command buffer. As such, it could be changed 3568 // Note: args is a pointer to the command buffer. As such, it could be changed
3552 // by a (malicious) client at any time, so if validation has to happen, it 3569 // by a (malicious) client at any time, so if validation has to happen, it
3553 // should operate on a copy of them. 3570 // should operate on a copy of them.
3554 error::Error GLES2DecoderImpl::DoCommand( 3571 error::Error GLES2DecoderImpl::DoCommand(
3555 unsigned int command, 3572 unsigned int command,
3556 unsigned int arg_count, 3573 unsigned int arg_count,
3557 const void* cmd_data) { 3574 const void* cmd_data) {
3558 error::Error result = error::kNoError; 3575 error::Error result = error::kNoError;
3559 if (log_commands()) { 3576 if (log_commands()) {
(...skipping 7077 matching lines...) Expand 10 before | Expand all | Expand 10 after
10637 DoDidUseTexImageIfNeeded(texture, texture->target()); 10654 DoDidUseTexImageIfNeeded(texture, texture->target());
10638 } 10655 }
10639 10656
10640 // Include the auto-generated part of this file. We split this because it means 10657 // Include the auto-generated part of this file. We split this because it means
10641 // we can easily edit the non-auto generated parts right here in this file 10658 // we can easily edit the non-auto generated parts right here in this file
10642 // instead of having to edit some template or the code generator. 10659 // instead of having to edit some template or the code generator.
10643 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10660 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10644 10661
10645 } // namespace gles2 10662 } // namespace gles2
10646 } // namespace gpu 10663 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698