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

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, 8 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
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/display.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),
44 display_(new gpu::gles2::Display),
43 share_group_(share_group ? share_group : new gfx::GLShareGroup), 45 share_group_(share_group ? share_group : new gfx::GLShareGroup),
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
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 #if defined(ENABLE_GPU) 173 #if defined(ENABLE_GPU)
172 WillCreateCommandBuffer(init_params.gpu_preference); 174 WillCreateCommandBuffer(init_params.gpu_preference);
173 175
174 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 176 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
175 177
176 *route_id = GenerateRouteID(); 178 *route_id = GenerateRouteID();
177 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 179 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
178 this, 180 this,
179 share_group, 181 share_group,
180 window, 182 window,
183 display_,
181 gfx::Size(), 184 gfx::Size(),
182 disallowed_features_, 185 disallowed_features_,
183 init_params.allowed_extensions, 186 init_params.allowed_extensions,
184 init_params.attribs, 187 init_params.attribs,
185 init_params.gpu_preference, 188 init_params.gpu_preference,
186 *route_id, 189 *route_id,
187 surface_id, 190 surface_id,
188 watchdog_, 191 watchdog_,
189 software_)); 192 software_));
190 router_.AddRoute(*route_id, stub.get()); 193 router_.AddRoute(*route_id, stub.get());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 WillCreateCommandBuffer(init_params.gpu_preference); 315 WillCreateCommandBuffer(init_params.gpu_preference);
313 316
314 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 317 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
315 318
316 route_id = GenerateRouteID(); 319 route_id = GenerateRouteID();
317 320
318 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 321 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
319 this, 322 this,
320 share_group, 323 share_group,
321 gfx::GLSurfaceHandle(), 324 gfx::GLSurfaceHandle(),
325 display_.get(),
322 size, 326 size,
323 disallowed_features_, 327 disallowed_features_,
324 init_params.allowed_extensions, 328 init_params.allowed_extensions,
325 init_params.attribs, 329 init_params.attribs,
326 init_params.gpu_preference, 330 init_params.gpu_preference,
327 route_id, 331 route_id,
328 0, watchdog_, 332 0, watchdog_,
329 software_)); 333 software_));
330 router_.AddRoute(route_id, stub.get()); 334 router_.AddRoute(route_id, stub.get());
331 stubs_.AddWithID(stub.release(), route_id); 335 stubs_.AddWithID(stub.release(), route_id);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 428
425 #if defined(OS_POSIX) 429 #if defined(OS_POSIX)
426 int GpuChannel::TakeRendererFileDescriptor() { 430 int GpuChannel::TakeRendererFileDescriptor() {
427 if (!channel_.get()) { 431 if (!channel_.get()) {
428 NOTREACHED(); 432 NOTREACHED();
429 return -1; 433 return -1;
430 } 434 }
431 return channel_->TakeClientFileDescriptor(); 435 return channel_->TakeClientFileDescriptor();
432 } 436 }
433 #endif // defined(OS_POSIX) 437 #endif // defined(OS_POSIX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698