summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorepenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-12 23:34:24 +0000
committerepenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-12 23:34:24 +0000
commitfddbbcd1b8cbfdeb3556328ee2bc3e8a93f0b8c9 (patch)
treec454f732393b06784ce9999d31ac104ecef25865
parentceca69a8391debb80f9cfc60a990a077e14c45f1 (diff)
downloadchromium_src-fddbbcd1b8cbfdeb3556328ee2bc3e8a93f0b8c9.zip
chromium_src-fddbbcd1b8cbfdeb3556328ee2bc3e8a93f0b8c9.tar.gz
chromium_src-fddbbcd1b8cbfdeb3556328ee2bc3e8a93f0b8c9.tar.bz2
gpu: Enable idle uploads as the default fallback and for IMG.
To enable this for IMG, we need to fall back on texImage rather than texSubImage. This is both due to IMG driver bugs and for performance (the GPU process also uses texImage in this case). BUG=249147,248429 Review URL: https://chromiumcodereview.appspot.com/18644010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211481 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--gpu/command_buffer/service/async_pixel_transfer_manager_android.cc6
-rw-r--r--gpu/command_buffer/service/async_pixel_transfer_manager_idle.cc33
2 files changed, 32 insertions, 7 deletions
diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc b/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc
index 5ec33e2..8de7d58a 100644
--- a/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc
+++ b/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc
@@ -5,8 +5,8 @@
#include "gpu/command_buffer/service/async_pixel_transfer_manager.h"
#include "base/debug/trace_event.h"
-#include "base/sys_info.h"
#include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h"
+#include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h"
#include "gpu/command_buffer/service/async_pixel_transfer_manager_stub.h"
#include "gpu/command_buffer/service/async_pixel_transfer_manager_sync.h"
#include "ui/gl/gl_context.h"
@@ -50,11 +50,11 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
context->HasExtension("EGL_KHR_gl_texture_2D_image") &&
context->HasExtension("GL_OES_EGL_image") &&
!IsBroadcom() &&
- (!IsImagination() || base::SysInfo::DalvikHeapSizeMB() > 128)) {
+ !IsImagination()) {
return new AsyncPixelTransferManagerEGL;
}
LOG(INFO) << "Async pixel transfers not supported";
- return new AsyncPixelTransferManagerSync;
+ return new AsyncPixelTransferManagerIdle;
case gfx::kGLImplementationMockGL:
return new AsyncPixelTransferManagerStub;
default:
diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager_idle.cc b/gpu/command_buffer/service/async_pixel_transfer_manager_idle.cc
index eb751fc..88aff57 100644
--- a/gpu/command_buffer/service/async_pixel_transfer_manager_idle.cc
+++ b/gpu/command_buffer/service/async_pixel_transfer_manager_idle.cc
@@ -44,7 +44,8 @@ class AsyncPixelTransferDelegateIdle
public:
AsyncPixelTransferDelegateIdle(
AsyncPixelTransferManagerIdle::SharedState* state,
- GLuint texture_id);
+ GLuint texture_id,
+ const AsyncTexImage2DParams& define_params);
virtual ~AsyncPixelTransferDelegateIdle();
// Implement AsyncPixelTransferDelegate:
@@ -72,6 +73,7 @@ class AsyncPixelTransferDelegateIdle
uint64 id_;
GLuint texture_id_;
bool transfer_in_progress_;
+ AsyncTexImage2DParams define_params_;
// Safe to hold a raw pointer because SharedState is owned by the Manager
// which owns the Delegate.
@@ -82,10 +84,12 @@ class AsyncPixelTransferDelegateIdle
AsyncPixelTransferDelegateIdle::AsyncPixelTransferDelegateIdle(
AsyncPixelTransferManagerIdle::SharedState* shared_state,
- GLuint texture_id)
+ GLuint texture_id,
+ const AsyncTexImage2DParams& define_params)
: id_(g_next_pixel_transfer_state_id++),
texture_id_(texture_id),
transfer_in_progress_(false),
+ define_params_(define_params),
shared_state_(shared_state) {}
AsyncPixelTransferDelegateIdle::~AsyncPixelTransferDelegateIdle() {}
@@ -206,7 +210,26 @@ void AsyncPixelTransferDelegateIdle::PerformAsyncTexSubImage2D(
base::TimeTicks begin_time(base::TimeTicks::HighResNow());
gfx::ScopedTextureBinder texture_binder(tex_params.target, texture_id_);
- {
+ // If it's a full texture update, use glTexImage2D as it's faster.
+ // TODO(epenner): Make this configurable (http://crbug.com/259924)
+ if (tex_params.xoffset == 0 &&
+ tex_params.yoffset == 0 &&
+ tex_params.target == define_params_.target &&
+ tex_params.level == define_params_.level &&
+ tex_params.width == define_params_.width &&
+ tex_params.height == define_params_.height) {
+ TRACE_EVENT0("gpu", "glTexImage2D");
+ glTexImage2D(
+ define_params_.target,
+ define_params_.level,
+ define_params_.internal_format,
+ define_params_.width,
+ define_params_.height,
+ define_params_.border,
+ tex_params.format,
+ tex_params.type,
+ data);
+ } else {
TRACE_EVENT0("gpu", "glTexSubImage2D");
glTexSubImage2D(
tex_params.target,
@@ -307,7 +330,9 @@ AsyncPixelTransferDelegate*
AsyncPixelTransferManagerIdle::CreatePixelTransferDelegateImpl(
gles2::TextureRef* ref,
const AsyncTexImage2DParams& define_params) {
- return new AsyncPixelTransferDelegateIdle(&shared_state_, ref->service_id());
+ return new AsyncPixelTransferDelegateIdle(&shared_state_,
+ ref->service_id(),
+ define_params);
}
} // namespace gpu