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

Side by Side Diff: content/browser/renderer_host/image_transport_factory_android.cc

Issue 17294003: Tune helper context buffer sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « no previous file | content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/renderer_host/image_transport_factory_android.h" 5 #include "content/browser/renderer_host/image_transport_factory_android.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
9 #include "content/browser/renderer_host/compositor_impl_android.h" 9 #include "content/browser/renderer_host/compositor_impl_android.h"
10 #include "content/common/gpu/client/gl_helper.h" 10 #include "content/common/gpu/client/gl_helper.h"
11 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 11 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
12 #include "content/common/gpu/gpu_process_launch_causes.h" 12 #include "content/common/gpu/gpu_process_launch_causes.h"
13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
14 #include "third_party/khronos/GLES2/gl2.h" 14 #include "third_party/khronos/GLES2/gl2.h"
15 #include "ui/gfx/android/device_display_info.h"
15 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" 16 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
16 17
17 namespace content { 18 namespace content {
18 19
19 namespace { 20 namespace {
20 21
21 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; 22 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
22 23
23 static ImageTransportFactoryAndroid* g_factory = NULL; 24 static ImageTransportFactoryAndroid* g_factory = NULL;
24 25
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 CmdBufferImageTransportFactory::CmdBufferImageTransportFactory() { 90 CmdBufferImageTransportFactory::CmdBufferImageTransportFactory() {
90 WebKit::WebGraphicsContext3D::Attributes attrs; 91 WebKit::WebGraphicsContext3D::Attributes attrs;
91 attrs.shareResources = true; 92 attrs.shareResources = true;
92 GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance(); 93 GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance();
93 GURL url("chrome://gpu/ImageTransportFactoryAndroid"); 94 GURL url("chrome://gpu/ImageTransportFactoryAndroid");
94 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client; 95 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client;
95 context_.reset(new WebGraphicsContext3DCommandBufferImpl(0, // offscreen 96 context_.reset(new WebGraphicsContext3DCommandBufferImpl(0, // offscreen
96 url, 97 url,
97 factory, 98 factory,
98 swap_client)); 99 swap_client));
99 context_->InitializeWithDefaultBufferSizes( 100 static size_t kBitsPerByte = 8;
no sievers 2013/06/17 19:06:35 nit: const
kaanb 2013/06/18 11:20:03 Done.
101 gfx::DeviceDisplayInfo display_info;
102 size_t full_screen_texture_size_in_bytes =
103 display_info.GetDisplayHeight() *
104 display_info.GetDisplayWidth() *
105 display_info.GetBitsPerPixel() / kBitsPerByte;
no sievers 2013/06/17 19:06:35 I don't think we need to look at the display bpp h
kaanb 2013/06/18 11:20:03 Done.
106 context_->Initialize(
100 attrs, 107 attrs,
101 false, 108 false,
102 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); 109 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE,
110 64 * 1024, // command buffer size
111 std::min(full_screen_texture_size_in_bytes,
112 kDefaultStartTransferBufferSize),
113 kDefaultMinTransferBufferSize,
114 std::min(3 * full_screen_texture_size_in_bytes,
115 kDefaultMaxTransferBufferSize));
no sievers 2013/06/17 19:06:35 These values seem to not cap anything if you assum
kaanb 2013/06/18 11:20:03 Yes, we're not capping the starting size but we're
103 } 116 }
104 117
105 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { 118 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() {
106 } 119 }
107 120
108 uint32_t CmdBufferImageTransportFactory::InsertSyncPoint() { 121 uint32_t CmdBufferImageTransportFactory::InsertSyncPoint() {
109 if (!context_->makeContextCurrent()) { 122 if (!context_->makeContextCurrent()) {
110 LOG(ERROR) << "Failed to make helper context current."; 123 LOG(ERROR) << "Failed to make helper context current.";
111 return 0; 124 return 0;
112 } 125 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return g_factory; 192 return g_factory;
180 } 193 }
181 194
182 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() { 195 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() {
183 } 196 }
184 197
185 ImageTransportFactoryAndroid::~ImageTransportFactoryAndroid() { 198 ImageTransportFactoryAndroid::~ImageTransportFactoryAndroid() {
186 } 199 }
187 200
188 } // namespace content 201 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698