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

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

Issue 2814843002: gpu: GPU service scheduler. (Closed)
Patch Set: fix test dcheck failures Created 3 years, 7 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 "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "content/browser/renderer_host/dip_util.h" 53 #include "content/browser/renderer_host/dip_util.h"
54 #include "content/browser/renderer_host/frame_metadata_util.h" 54 #include "content/browser/renderer_host/frame_metadata_util.h"
55 #include "content/browser/renderer_host/input/input_router_impl.h" 55 #include "content/browser/renderer_host/input/input_router_impl.h"
56 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h " 56 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h "
57 #include "content/browser/renderer_host/input/web_input_event_builders_android.h " 57 #include "content/browser/renderer_host/input/web_input_event_builders_android.h "
58 #include "content/browser/renderer_host/render_process_host_impl.h" 58 #include "content/browser/renderer_host/render_process_host_impl.h"
59 #include "content/browser/renderer_host/render_view_host_delegate_view.h" 59 #include "content/browser/renderer_host/render_view_host_delegate_view.h"
60 #include "content/browser/renderer_host/render_view_host_impl.h" 60 #include "content/browser/renderer_host/render_view_host_impl.h"
61 #include "content/browser/renderer_host/render_widget_host_impl.h" 61 #include "content/browser/renderer_host/render_widget_host_impl.h"
62 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" 62 #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
63 #include "content/common/gpu_stream_constants.h"
63 #include "content/common/input_messages.h" 64 #include "content/common/input_messages.h"
64 #include "content/common/site_isolation_policy.h" 65 #include "content/common/site_isolation_policy.h"
65 #include "content/common/view_messages.h" 66 #include "content/common/view_messages.h"
66 #include "content/public/browser/android/compositor.h" 67 #include "content/public/browser/android/compositor.h"
67 #include "content/public/browser/android/synchronous_compositor_client.h" 68 #include "content/public/browser/android/synchronous_compositor_client.h"
68 #include "content/public/browser/browser_thread.h" 69 #include "content/public/browser/browser_thread.h"
69 #include "content/public/browser/devtools_agent_host.h" 70 #include "content/public/browser/devtools_agent_host.h"
70 #include "content/public/browser/render_view_host.h" 71 #include "content/public/browser/render_view_host.h"
71 #include "content/public/browser/render_widget_host_iterator.h" 72 #include "content/public/browser/render_widget_host_iterator.h"
72 #include "content/public/common/content_switches.h" 73 #include "content/public/common/content_switches.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 void GLHelperHolder::Initialize() { 170 void GLHelperHolder::Initialize() {
170 auto* factory = BrowserGpuChannelHostFactory::instance(); 171 auto* factory = BrowserGpuChannelHostFactory::instance();
171 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); 172 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel());
172 173
173 // The Browser Compositor is in charge of reestablishing the channel if its 174 // The Browser Compositor is in charge of reestablishing the channel if its
174 // missing. 175 // missing.
175 if (!gpu_channel_host) 176 if (!gpu_channel_host)
176 return; 177 return;
177 178
179 int32_t stream_id = kGpuStreamIdDefault;
180 gpu::SchedulingPriority stream_priority = kGpuStreamPriorityUI;
181
178 // This is for an offscreen context, so we don't need the default framebuffer 182 // This is for an offscreen context, so we don't need the default framebuffer
179 // to have alpha, stencil, depth, antialiasing. 183 // to have alpha, stencil, depth, antialiasing.
180 gpu::gles2::ContextCreationAttribHelper attributes; 184 gpu::gles2::ContextCreationAttribHelper attributes;
181 attributes.alpha_size = -1; 185 attributes.alpha_size = -1;
182 attributes.stencil_size = 0; 186 attributes.stencil_size = 0;
183 attributes.depth_size = 0; 187 attributes.depth_size = 0;
184 attributes.samples = 0; 188 attributes.samples = 0;
185 attributes.sample_buffers = 0; 189 attributes.sample_buffers = 0;
186 attributes.bind_generates_resource = false; 190 attributes.bind_generates_resource = false;
187 191
188 gpu::SharedMemoryLimits limits; 192 gpu::SharedMemoryLimits limits;
189 // The GLHelper context doesn't do a lot of stuff, so we don't expect it to 193 // The GLHelper context doesn't do a lot of stuff, so we don't expect it to
190 // need a lot of space for commands. 194 // need a lot of space for commands.
191 limits.command_buffer_size = 1024; 195 limits.command_buffer_size = 1024;
192 // The transfer buffer is used for shaders among other things, so give some 196 // The transfer buffer is used for shaders among other things, so give some
193 // reasonable but small limit. 197 // reasonable but small limit.
194 limits.start_transfer_buffer_size = 4 * 1024; 198 limits.start_transfer_buffer_size = 4 * 1024;
195 limits.min_transfer_buffer_size = 4 * 1024; 199 limits.min_transfer_buffer_size = 4 * 1024;
196 limits.max_transfer_buffer_size = 128 * 1024; 200 limits.max_transfer_buffer_size = 128 * 1024;
197 // Very few allocations from mapped memory pool, so this can be really low. 201 // Very few allocations from mapped memory pool, so this can be really low.
198 limits.mapped_memory_reclaim_limit = 4 * 1024; 202 limits.mapped_memory_reclaim_limit = 4 * 1024;
199 203
200 constexpr bool automatic_flushes = false; 204 constexpr bool automatic_flushes = false;
201 constexpr bool support_locking = false; 205 constexpr bool support_locking = false;
202 const GURL url("chrome://gpu/RenderWidgetHostViewAndroid"); 206 const GURL url("chrome://gpu/RenderWidgetHostViewAndroid");
203 207
204 provider_ = new ui::ContextProviderCommandBuffer( 208 provider_ = new ui::ContextProviderCommandBuffer(
205 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT, 209 std::move(gpu_channel_host), stream_id, stream_priority,
206 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, url, 210 gpu::kNullSurfaceHandle, url, automatic_flushes, support_locking, limits,
207 automatic_flushes, support_locking, limits, attributes, nullptr, 211 attributes, nullptr,
208 ui::command_buffer_metrics::BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT); 212 ui::command_buffer_metrics::BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT);
209 if (!provider_->BindToCurrentThread()) 213 if (!provider_->BindToCurrentThread())
210 return; 214 return;
211 provider_->ContextGL()->TraceBeginCHROMIUM( 215 provider_->ContextGL()->TraceBeginCHROMIUM(
212 "gpu_toplevel", 216 "gpu_toplevel",
213 base::StringPrintf("CmdBufferImageTransportFactory-%p", provider_.get()) 217 base::StringPrintf("CmdBufferImageTransportFactory-%p", provider_.get())
214 .c_str()); 218 .c_str());
215 provider_->SetLostContextCallback( 219 provider_->SetLostContextCallback(
216 base::Bind(&GLHelperHolder::OnContextLost, base::Unretained(this))); 220 base::Bind(&GLHelperHolder::OnContextLost, base::Unretained(this)));
217 gl_helper_.reset(new display_compositor::GLHelper( 221 gl_helper_.reset(new display_compositor::GLHelper(
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 2195
2192 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); 2196 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor();
2193 if (!compositor) 2197 if (!compositor)
2194 return; 2198 return;
2195 2199
2196 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( 2200 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
2197 overscroll_refresh_handler, compositor, view_.GetDipScale()); 2201 overscroll_refresh_handler, compositor, view_.GetDipScale());
2198 } 2202 }
2199 2203
2200 } // namespace content 2204 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.cc ('k') | content/common/gpu_stream_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698