summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client/gles2_implementation.cc
diff options
context:
space:
mode:
authordyen <dyen@chromium.org>2015-10-19 10:23:47 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-19 17:24:30 +0000
commit13ac193d767c089c720497398a1dec39c07e2929 (patch)
treefd7e71130f33c9d030c8be7c49138f9832a87dbd /gpu/command_buffer/client/gles2_implementation.cc
parentc161ed7ab728dc12168d87609c1a86ca756b56ad (diff)
downloadchromium_src-13ac193d767c089c720497398a1dec39c07e2929.zip
chromium_src-13ac193d767c089c720497398a1dec39c07e2929.tar.gz
chromium_src-13ac193d767c089c720497398a1dec39c07e2929.tar.bz2
Fixed tough texture upload benchmark on low end devices.
Fast extra shared memory texture upload path is now disabled for low end devices, they don't have enough memory to allocate this. R=sievers@chromium.org BUG=543067, 462078 Review URL: https://codereview.chromium.org/1408843002 Cr-Commit-Position: refs/heads/master@{#354797}
Diffstat (limited to 'gpu/command_buffer/client/gles2_implementation.cc')
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index e91bbd6..72df5bb 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -17,6 +17,7 @@
#include <string>
#include "base/compiler_specific.h"
#include "base/strings/stringprintf.h"
+#include "base/sys_info.h"
#include "base/thread_task_runner_handle.h"
#include "base/trace_event/memory_allocator_dump.h"
#include "base/trace_event/memory_dump_manager.h"
@@ -111,6 +112,17 @@ GLES2Implementation::GLES2Implementation(
lose_context_when_out_of_memory_(lose_context_when_out_of_memory),
support_client_side_arrays_(support_client_side_arrays),
use_count_(0),
+ max_extra_transfer_buffer_size_(
+#if defined(OS_NACL)
+ 0),
+#else
+ // Do not use more than 5% of extra shared memory, and do not
+ // use any extra for memory contrained devices (<=1GB).
+ base::SysInfo::AmountOfPhysicalMemory() > 1024 * 1024 * 1024
+ ? base::saturated_cast<uint32_t>(
+ base::SysInfo::AmountOfPhysicalMemory() / 20)
+ : 0),
+#endif
error_message_callback_(NULL),
current_trace_stack_(0),
gpu_control_(gpu_control),
@@ -2306,7 +2318,7 @@ void GLES2Implementation::TexImage2D(
shm_id = transfer_alloc.shm_id();
shm_offset = transfer_alloc.offset();
buffer_pointer = transfer_alloc.address();
- } else {
+ } else if (size < max_extra_transfer_buffer_size_) {
mapped_alloc.Reset(size);
if (mapped_alloc.valid()) {
transfer_alloc.Discard();
@@ -2432,7 +2444,7 @@ void GLES2Implementation::TexImage3D(
shm_id = transfer_alloc.shm_id();
shm_offset = transfer_alloc.offset();
buffer_pointer = transfer_alloc.address();
- } else {
+ } else if (size < max_extra_transfer_buffer_size_) {
mapped_alloc.Reset(size);
if (mapped_alloc.valid()) {
transfer_alloc.Discard();