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

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

Issue 10543125: gpu: Add support for GLX_EXT_texture_from_pixmap extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add kGLImplementationMockGL case to gl_image_android.cc. Created 8 years, 2 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_channel_manager.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/message_loop_proxy.h" 14 #include "base/message_loop_proxy.h"
15 #include "base/process_util.h" 15 #include "base/process_util.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "content/common/child_process.h" 17 #include "content/common/child_process.h"
18 #include "content/common/gpu/gpu_channel_manager.h" 18 #include "content/common/gpu/gpu_channel_manager.h"
19 #include "content/common/gpu/gpu_messages.h" 19 #include "content/common/gpu/gpu_messages.h"
20 #include "content/common/gpu/sync_point_manager.h" 20 #include "content/common/gpu/sync_point_manager.h"
21 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
22 #include "gpu/command_buffer/service/image_manager.h"
22 #include "gpu/command_buffer/service/mailbox_manager.h" 23 #include "gpu/command_buffer/service/mailbox_manager.h"
23 #include "gpu/command_buffer/service/gpu_scheduler.h" 24 #include "gpu/command_buffer/service/gpu_scheduler.h"
24 #include "ipc/ipc_channel.h" 25 #include "ipc/ipc_channel.h"
25 #include "ipc/ipc_channel_proxy.h" 26 #include "ipc/ipc_channel_proxy.h"
26 #include "ui/gl/gl_context.h" 27 #include "ui/gl/gl_context.h"
28 #include "ui/gl/gl_image.h"
27 #include "ui/gl/gl_surface.h" 29 #include "ui/gl/gl_surface.h"
28 30
29 #if defined(OS_POSIX) 31 #if defined(OS_POSIX)
30 #include "ipc/ipc_channel_posix.h" 32 #include "ipc/ipc_channel_posix.h"
31 #endif 33 #endif
32 34
33 #if defined(OS_ANDROID) 35 #if defined(OS_ANDROID)
34 #include "content/common/gpu/stream_texture_manager_android.h" 36 #include "content/common/gpu/stream_texture_manager_android.h"
35 #endif 37 #endif
36 38
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 GpuWatchdog* watchdog, 148 GpuWatchdog* watchdog,
147 gfx::GLShareGroup* share_group, 149 gfx::GLShareGroup* share_group,
148 gpu::gles2::MailboxManager* mailbox, 150 gpu::gles2::MailboxManager* mailbox,
149 int client_id, 151 int client_id,
150 bool software) 152 bool software)
151 : gpu_channel_manager_(gpu_channel_manager), 153 : gpu_channel_manager_(gpu_channel_manager),
152 unprocessed_messages_(new gpu::RefCountedCounter), 154 unprocessed_messages_(new gpu::RefCountedCounter),
153 client_id_(client_id), 155 client_id_(client_id),
154 share_group_(share_group ? share_group : new gfx::GLShareGroup), 156 share_group_(share_group ? share_group : new gfx::GLShareGroup),
155 mailbox_manager_(mailbox ? mailbox : new gpu::gles2::MailboxManager), 157 mailbox_manager_(mailbox ? mailbox : new gpu::gles2::MailboxManager),
158 image_manager_(new gpu::gles2::ImageManager),
156 watchdog_(watchdog), 159 watchdog_(watchdog),
157 software_(software), 160 software_(software),
158 handle_messages_scheduled_(false), 161 handle_messages_scheduled_(false),
159 processed_get_state_fast_(false), 162 processed_get_state_fast_(false),
160 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 163 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
161 DCHECK(gpu_channel_manager); 164 DCHECK(gpu_channel_manager);
162 DCHECK(client_id); 165 DCHECK(client_id);
163 166
164 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu"); 167 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu");
165 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 168 const CommandLine* command_line = CommandLine::ForCurrentProcess();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 #if defined(ENABLE_GPU) 319 #if defined(ENABLE_GPU)
317 320
318 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 321 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
319 322
320 *route_id = GenerateRouteID(); 323 *route_id = GenerateRouteID();
321 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 324 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
322 this, 325 this,
323 share_group, 326 share_group,
324 window, 327 window,
325 mailbox_manager_, 328 mailbox_manager_,
329 image_manager_,
326 gfx::Size(), 330 gfx::Size(),
327 disallowed_features_, 331 disallowed_features_,
328 init_params.allowed_extensions, 332 init_params.allowed_extensions,
329 init_params.attribs, 333 init_params.attribs,
330 init_params.gpu_preference, 334 init_params.gpu_preference,
331 *route_id, 335 *route_id,
332 surface_id, 336 surface_id,
333 watchdog_, 337 watchdog_,
334 software_, 338 software_,
335 init_params.active_url)); 339 init_params.active_url));
336 if (preempt_by_counter_.get()) 340 if (preempt_by_counter_.get())
337 stub->SetPreemptByCounter(preempt_by_counter_); 341 stub->SetPreemptByCounter(preempt_by_counter_);
338 router_.AddRoute(*route_id, stub.get()); 342 router_.AddRoute(*route_id, stub.get());
339 stubs_.AddWithID(stub.release(), *route_id); 343 stubs_.AddWithID(stub.release(), *route_id);
340 #endif // ENABLE_GPU 344 #endif // ENABLE_GPU
341 } 345 }
342 346
343 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) { 347 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) {
344 return stubs_.Lookup(route_id); 348 return stubs_.Lookup(route_id);
345 } 349 }
346 350
351 void GpuChannel::CreateImage(
352 gfx::PluginWindowHandle window,
353 int32 image_id,
354 gfx::Size* size) {
355 TRACE_EVENT1("gpu",
356 "GpuChannel::CreateImage",
357 "image_id",
358 image_id);
359
360 *size = gfx::Size();
361
362 if (image_manager_->LookupImage(image_id)) {
363 LOG(ERROR) << "CreateImage failed, image_id already in use.";
364 return;
365 }
366
367 scoped_refptr<gfx::GLImage> image = gfx::GLImage::CreateGLImage(window);
368 if (!image)
369 return;
370
371 image_manager_->AddImage(image.get(), image_id);
372 *size = image->GetSize();
373 }
374
375 void GpuChannel::DeleteImage(int32 image_id) {
376 TRACE_EVENT1("gpu",
377 "GpuChannel::DeleteImage",
378 "image_id",
379 image_id);
380
381 image_manager_->RemoveImage(image_id);
382 }
383
347 void GpuChannel::LoseAllContexts() { 384 void GpuChannel::LoseAllContexts() {
348 gpu_channel_manager_->LoseAllContexts(); 385 gpu_channel_manager_->LoseAllContexts();
349 } 386 }
350 387
351 void GpuChannel::DestroySoon() { 388 void GpuChannel::DestroySoon() {
352 MessageLoop::current()->PostTask( 389 MessageLoop::current()->PostTask(
353 FROM_HERE, base::Bind(&GpuChannel::OnDestroy, this)); 390 FROM_HERE, base::Bind(&GpuChannel::OnDestroy, this));
354 } 391 }
355 392
356 int GpuChannel::GenerateRouteID() { 393 int GpuChannel::GenerateRouteID() {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 #if defined(ENABLE_GPU) 508 #if defined(ENABLE_GPU)
472 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 509 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
473 510
474 route_id = GenerateRouteID(); 511 route_id = GenerateRouteID();
475 512
476 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 513 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
477 this, 514 this,
478 share_group, 515 share_group,
479 gfx::GLSurfaceHandle(), 516 gfx::GLSurfaceHandle(),
480 mailbox_manager_.get(), 517 mailbox_manager_.get(),
518 image_manager_.get(),
481 size, 519 size,
482 disallowed_features_, 520 disallowed_features_,
483 init_params.allowed_extensions, 521 init_params.allowed_extensions,
484 init_params.attribs, 522 init_params.attribs,
485 init_params.gpu_preference, 523 init_params.gpu_preference,
486 route_id, 524 route_id,
487 0, watchdog_, 525 0, watchdog_,
488 software_, 526 software_,
489 init_params.active_url)); 527 init_params.active_url));
490 if (preempt_by_counter_.get()) 528 if (preempt_by_counter_.get())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 stats.total_texture_upload_time += total_texture_upload_time; 600 stats.total_texture_upload_time += total_texture_upload_time;
563 stats.total_processing_commands_time += total_processing_commands_time; 601 stats.total_processing_commands_time += total_processing_commands_time;
564 } 602 }
565 } 603 }
566 604
567 GpuChannelMsg_CollectRenderingStatsForSurface::WriteReplyParams( 605 GpuChannelMsg_CollectRenderingStatsForSurface::WriteReplyParams(
568 reply_message, 606 reply_message,
569 stats); 607 stats);
570 Send(reply_message); 608 Send(reply_message);
571 } 609 }
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698