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

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] gpu: Reuse transfer buffers more aggresively 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 9331 matching lines...) Expand 10 before | Expand all | Expand 10 after
9342 } 9342 }
9343 // NOTE: We don't generate Query objects here. Only in BeginQueryEXT 9343 // NOTE: We don't generate Query objects here. Only in BeginQueryEXT
9344 return true; 9344 return true;
9345 } 9345 }
9346 9346
9347 void GLES2DecoderImpl::DeleteQueriesEXTHelper( 9347 void GLES2DecoderImpl::DeleteQueriesEXTHelper(
9348 GLsizei n, const GLuint* client_ids) { 9348 GLsizei n, const GLuint* client_ids) {
9349 for (GLsizei ii = 0; ii < n; ++ii) { 9349 for (GLsizei ii = 0; ii < n; ++ii) {
9350 QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]); 9350 QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]);
9351 if (query && !query->IsDeleted()) { 9351 if (query && !query->IsDeleted()) {
9352 ContextState::QueryMap::iterator it = 9352 bool internal = query->serial() != 0;
9353 state_.current_queries.find(query->target()); 9353 ContextState::QueryMap::iterator it = state_.current_queries.find(
9354 std::make_pair(query->target(), internal));
9354 if (it != state_.current_queries.end()) 9355 if (it != state_.current_queries.end())
9355 state_.current_queries.erase(it); 9356 state_.current_queries.erase(it);
9356 9357
9357 query->Destroy(true); 9358 query->Destroy(true);
9358 query_manager_->RemoveQuery(client_ids[ii]); 9359 query_manager_->RemoveQuery(client_ids[ii]);
9359 } 9360 }
9360 } 9361 }
9361 } 9362 }
9362 9363
9363 bool GLES2DecoderImpl::ProcessPendingQueries() { 9364 bool GLES2DecoderImpl::ProcessPendingQueries() {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
9404 async_pixel_transfer_manager_->ProcessMorePendingTransfers(); 9405 async_pixel_transfer_manager_->ProcessMorePendingTransfers();
9405 ProcessFinishedAsyncTransfers(); 9406 ProcessFinishedAsyncTransfers();
9406 } 9407 }
9407 9408
9408 error::Error GLES2DecoderImpl::HandleBeginQueryEXT( 9409 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(
9409 uint32 immediate_data_size, const cmds::BeginQueryEXT& c) { 9410 uint32 immediate_data_size, const cmds::BeginQueryEXT& c) {
9410 GLenum target = static_cast<GLenum>(c.target); 9411 GLenum target = static_cast<GLenum>(c.target);
9411 GLuint client_id = static_cast<GLuint>(c.id); 9412 GLuint client_id = static_cast<GLuint>(c.id);
9412 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); 9413 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id);
9413 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); 9414 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset);
9415 uint32 serial = static_cast<uint32>(c.serial);
9416 bool internal = serial != 0;
9417 ContextState::QueryKey key = std::make_pair(target, internal);
9414 9418
9415 switch (target) { 9419 switch (target) {
9416 case GL_COMMANDS_ISSUED_CHROMIUM: 9420 case GL_COMMANDS_ISSUED_CHROMIUM:
9417 case GL_LATENCY_QUERY_CHROMIUM: 9421 case GL_LATENCY_QUERY_CHROMIUM:
9418 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: 9422 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM:
9419 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: 9423 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM:
9420 case GL_GET_ERROR_QUERY_CHROMIUM: 9424 case GL_GET_ERROR_QUERY_CHROMIUM:
9421 break; 9425 break;
9422 default: 9426 default:
9423 if (!features().occlusion_query_boolean) { 9427 if (!features().occlusion_query_boolean) {
9424 LOCAL_SET_GL_ERROR( 9428 LOCAL_SET_GL_ERROR(
9425 GL_INVALID_OPERATION, "glBeginQueryEXT", 9429 GL_INVALID_OPERATION, "glBeginQueryEXT",
9426 "not enabled for occlusion queries"); 9430 "not enabled for occlusion queries");
9427 return error::kNoError; 9431 return error::kNoError;
9428 } 9432 }
9429 break; 9433 break;
9430 } 9434 }
9431 9435
9432 if (state_.current_queries.find(target) != state_.current_queries.end()) { 9436 if (state_.current_queries.find(key) != state_.current_queries.end()) {
9433 LOCAL_SET_GL_ERROR( 9437 LOCAL_SET_GL_ERROR(
9434 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress"); 9438 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress");
9435 return error::kNoError; 9439 return error::kNoError;
9436 } 9440 }
9437 9441
9438 if (client_id == 0) { 9442 if (client_id == 0) {
9439 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBeginQueryEXT", "id is 0"); 9443 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBeginQueryEXT", "id is 0");
9440 return error::kNoError; 9444 return error::kNoError;
9441 } 9445 }
9442 9446
(...skipping 12 matching lines...) Expand all
9455 // IdAllocatorInterface* id_allocator = 9459 // IdAllocatorInterface* id_allocator =
9456 // group_->GetIdAllocator(id_namespaces::kQueries); 9460 // group_->GetIdAllocator(id_namespaces::kQueries);
9457 // if (!id_allocator->InUse(client_id)) { 9461 // if (!id_allocator->InUse(client_id)) {
9458 // LOCAL_SET_GL_ERROR( 9462 // LOCAL_SET_GL_ERROR(
9459 // GL_INVALID_OPERATION, 9463 // GL_INVALID_OPERATION,
9460 // "glBeginQueryEXT", "id not made by glGenQueriesEXT"); 9464 // "glBeginQueryEXT", "id not made by glGenQueriesEXT");
9461 // return error::kNoError; 9465 // return error::kNoError;
9462 // } 9466 // }
9463 query = query_manager_->CreateQuery( 9467 query = query_manager_->CreateQuery(
9464 target, client_id, sync_shm_id, sync_shm_offset); 9468 target, client_id, sync_shm_id, sync_shm_offset);
9469 query->set_serial(serial);
9465 } 9470 }
9466 9471
9467 if (query->target() != target) { 9472 if (query->target() != target) {
9468 LOCAL_SET_GL_ERROR( 9473 LOCAL_SET_GL_ERROR(
9469 GL_INVALID_OPERATION, "glBeginQueryEXT", "target does not match"); 9474 GL_INVALID_OPERATION, "glBeginQueryEXT", "target does not match");
9470 return error::kNoError; 9475 return error::kNoError;
9471 } else if (query->shm_id() != sync_shm_id || 9476 } else if (query->shm_id() != sync_shm_id ||
9472 query->shm_offset() != sync_shm_offset) { 9477 query->shm_offset() != sync_shm_offset) {
9473 DLOG(ERROR) << "Shared memory used by query not the same as before"; 9478 DLOG(ERROR) << "Shared memory used by query not the same as before";
9474 return error::kInvalidArguments; 9479 return error::kInvalidArguments;
9475 } 9480 }
9476 9481
9477 if (!query_manager_->BeginQuery(query)) { 9482 if (!query_manager_->BeginQuery(query)) {
9478 return error::kOutOfBounds; 9483 return error::kOutOfBounds;
9479 } 9484 }
9480 9485
9481 state_.current_queries[target] = query; 9486 state_.current_queries[key] = query;
9482 return error::kNoError; 9487 return error::kNoError;
9483 } 9488 }
9484 9489
9485 error::Error GLES2DecoderImpl::HandleEndQueryEXT( 9490 error::Error GLES2DecoderImpl::HandleEndQueryEXT(
9486 uint32 immediate_data_size, const cmds::EndQueryEXT& c) { 9491 uint32 immediate_data_size, const cmds::EndQueryEXT& c) {
9487 GLenum target = static_cast<GLenum>(c.target); 9492 GLenum target = static_cast<GLenum>(c.target);
9488 uint32 submit_count = static_cast<GLuint>(c.submit_count); 9493 uint32 submit_count = static_cast<GLuint>(c.submit_count);
9489 ContextState::QueryMap::iterator it = state_.current_queries.find(target); 9494 uint32 serial = static_cast<uint32>(c.serial);
9495 bool internal = serial != 0;
9496 ContextState::QueryKey key = std::make_pair(target, internal);
9497 ContextState::QueryMap::iterator it = state_.current_queries.find(key);
9490 9498
9491 if (it == state_.current_queries.end()) { 9499 if (it == state_.current_queries.end()) {
9492 LOCAL_SET_GL_ERROR( 9500 LOCAL_SET_GL_ERROR(
9493 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query"); 9501 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query");
9494 return error::kNoError; 9502 return error::kNoError;
9495 } 9503 }
9496 9504
9497 QueryManager::Query* query = it->second.get(); 9505 QueryManager::Query* query = it->second.get();
9498 if (!query_manager_->EndQuery(query, submit_count)) { 9506 if (!query_manager_->EndQuery(query, submit_count)) {
9499 return error::kOutOfBounds; 9507 return error::kOutOfBounds;
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
10637 DoDidUseTexImageIfNeeded(texture, texture->target()); 10645 DoDidUseTexImageIfNeeded(texture, texture->target());
10638 } 10646 }
10639 10647
10640 // Include the auto-generated part of this file. We split this because it means 10648 // 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 10649 // 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. 10650 // instead of having to edit some template or the code generator.
10643 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10651 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10644 10652
10645 } // namespace gles2 10653 } // namespace gles2
10646 } // namespace gpu 10654 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698