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

Side by Side Diff: content/common/gpu/gpu_channel.cc

Issue 10106015: Allow textures to be moved from one GL context group to another. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.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 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #endif 7 #endif
8 8
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
14 #include "base/process_util.h" 14 #include "base/process_util.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "content/common/child_process.h" 16 #include "content/common/child_process.h"
17 #include "content/common/gpu/gpu_channel_manager.h" 17 #include "content/common/gpu/gpu_channel_manager.h"
18 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
19 #include "content/public/common/content_client.h" 19 #include "content/public/common/content_client.h"
20 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
21 #include "gpu/command_buffer/service/mailbox_manager.h"
21 #include "ui/gfx/gl/gl_context.h" 22 #include "ui/gfx/gl/gl_context.h"
22 #include "ui/gfx/gl/gl_surface.h" 23 #include "ui/gfx/gl/gl_surface.h"
23 24
24 #if defined(OS_POSIX) 25 #if defined(OS_POSIX)
25 #include "ipc/ipc_channel_posix.h" 26 #include "ipc/ipc_channel_posix.h"
26 #endif 27 #endif
27 28
28 namespace { 29 namespace {
29 // The first time polling a fence, delay some extra time to allow other 30 // The first time polling a fence, delay some extra time to allow other
30 // stubs to process some work, or else the timing of the fences could 31 // stubs to process some work, or else the timing of the fences could
31 // allow a pattern of alternating fast and slow frames to occur. 32 // allow a pattern of alternating fast and slow frames to occur.
32 const int64 kHandleMoreWorkPeriodMs = 2; 33 const int64 kHandleMoreWorkPeriodMs = 2;
33 const int64 kHandleMoreWorkPeriodBusyMs = 1; 34 const int64 kHandleMoreWorkPeriodBusyMs = 1;
34 } 35 }
35 36
36 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, 37 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager,
37 GpuWatchdog* watchdog, 38 GpuWatchdog* watchdog,
38 gfx::GLShareGroup* share_group, 39 gfx::GLShareGroup* share_group,
39 int client_id, 40 int client_id,
40 bool software) 41 bool software)
41 : gpu_channel_manager_(gpu_channel_manager), 42 : gpu_channel_manager_(gpu_channel_manager),
42 client_id_(client_id), 43 client_id_(client_id),
43 share_group_(share_group ? share_group : new gfx::GLShareGroup), 44 share_group_(share_group ? share_group : new gfx::GLShareGroup),
45 mailbox_manager_(new gpu::gles2::MailboxManager),
44 watchdog_(watchdog), 46 watchdog_(watchdog),
45 software_(software), 47 software_(software),
46 handle_messages_scheduled_(false), 48 handle_messages_scheduled_(false),
47 processed_get_state_fast_(false), 49 processed_get_state_fast_(false),
48 num_contexts_preferring_discrete_gpu_(0), 50 num_contexts_preferring_discrete_gpu_(0),
49 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 51 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
50 DCHECK(gpu_channel_manager); 52 DCHECK(gpu_channel_manager);
51 DCHECK(client_id); 53 DCHECK(client_id);
52 54
53 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu"); 55 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu");
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 #if defined(ENABLE_GPU) 187 #if defined(ENABLE_GPU)
186 WillCreateCommandBuffer(init_params.gpu_preference); 188 WillCreateCommandBuffer(init_params.gpu_preference);
187 189
188 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 190 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
189 191
190 *route_id = GenerateRouteID(); 192 *route_id = GenerateRouteID();
191 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 193 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
192 this, 194 this,
193 share_group, 195 share_group,
194 window, 196 window,
197 mailbox_manager_,
195 gfx::Size(), 198 gfx::Size(),
196 disallowed_features_, 199 disallowed_features_,
197 init_params.allowed_extensions, 200 init_params.allowed_extensions,
198 init_params.attribs, 201 init_params.attribs,
199 init_params.gpu_preference, 202 init_params.gpu_preference,
200 *route_id, 203 *route_id,
201 surface_id, 204 surface_id,
202 watchdog_, 205 watchdog_,
203 software_)); 206 software_));
204 router_.AddRoute(*route_id, stub.get()); 207 router_.AddRoute(*route_id, stub.get());
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 WillCreateCommandBuffer(init_params.gpu_preference); 345 WillCreateCommandBuffer(init_params.gpu_preference);
343 346
344 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 347 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
345 348
346 route_id = GenerateRouteID(); 349 route_id = GenerateRouteID();
347 350
348 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 351 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
349 this, 352 this,
350 share_group, 353 share_group,
351 gfx::GLSurfaceHandle(), 354 gfx::GLSurfaceHandle(),
355 mailbox_manager_.get(),
352 size, 356 size,
353 disallowed_features_, 357 disallowed_features_,
354 init_params.allowed_extensions, 358 init_params.allowed_extensions,
355 init_params.attribs, 359 init_params.attribs,
356 init_params.gpu_preference, 360 init_params.gpu_preference,
357 route_id, 361 route_id,
358 0, watchdog_, 362 0, watchdog_,
359 software_)); 363 software_));
360 router_.AddRoute(route_id, stub.get()); 364 router_.AddRoute(route_id, stub.get());
361 stubs_.AddWithID(stub.release(), route_id); 365 stubs_.AddWithID(stub.release(), route_id);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 void GpuChannel::WillCreateCommandBuffer(gfx::GpuPreference gpu_preference) { 428 void GpuChannel::WillCreateCommandBuffer(gfx::GpuPreference gpu_preference) {
425 if (gpu_preference == gfx::PreferDiscreteGpu) 429 if (gpu_preference == gfx::PreferDiscreteGpu)
426 ++num_contexts_preferring_discrete_gpu_; 430 ++num_contexts_preferring_discrete_gpu_;
427 } 431 }
428 432
429 void GpuChannel::DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference) { 433 void GpuChannel::DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference) {
430 if (gpu_preference == gfx::PreferDiscreteGpu) 434 if (gpu_preference == gfx::PreferDiscreteGpu)
431 --num_contexts_preferring_discrete_gpu_; 435 --num_contexts_preferring_discrete_gpu_;
432 DCHECK_GE(num_contexts_preferring_discrete_gpu_, 0); 436 DCHECK_GE(num_contexts_preferring_discrete_gpu_, 0);
433 } 437 }
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698