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

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: Move CreateGLImage below virtual methods. 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
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 scoped_refptr<gfx::GLImage> image = gfx::GLImage::CreateGLImage(window);
363 if (!image)
364 return;
365
366 image_manager_->AddImage(image, image_id);
piman 2012/10/12 22:05:11 Should we consider the case where image_id already
reveman 2012/10/13 05:25:53 I made it fail if an image_id already exists.
367 *size = image->GetSize();
368 }
369
370 void GpuChannel::DeleteImage(int32 image_id) {
371 TRACE_EVENT1("gpu",
372 "GpuChannel::DeleteImage",
373 "image_id",
374 image_id);
375
376 image_manager_->RemoveImage(image_id);
377 }
378
347 void GpuChannel::LoseAllContexts() { 379 void GpuChannel::LoseAllContexts() {
348 gpu_channel_manager_->LoseAllContexts(); 380 gpu_channel_manager_->LoseAllContexts();
349 } 381 }
350 382
351 void GpuChannel::DestroySoon() { 383 void GpuChannel::DestroySoon() {
352 MessageLoop::current()->PostTask( 384 MessageLoop::current()->PostTask(
353 FROM_HERE, base::Bind(&GpuChannel::OnDestroy, this)); 385 FROM_HERE, base::Bind(&GpuChannel::OnDestroy, this));
354 } 386 }
355 387
356 int GpuChannel::GenerateRouteID() { 388 int GpuChannel::GenerateRouteID() {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 #if defined(ENABLE_GPU) 503 #if defined(ENABLE_GPU)
472 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 504 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
473 505
474 route_id = GenerateRouteID(); 506 route_id = GenerateRouteID();
475 507
476 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 508 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
477 this, 509 this,
478 share_group, 510 share_group,
479 gfx::GLSurfaceHandle(), 511 gfx::GLSurfaceHandle(),
480 mailbox_manager_.get(), 512 mailbox_manager_.get(),
513 image_manager_.get(),
481 size, 514 size,
482 disallowed_features_, 515 disallowed_features_,
483 init_params.allowed_extensions, 516 init_params.allowed_extensions,
484 init_params.attribs, 517 init_params.attribs,
485 init_params.gpu_preference, 518 init_params.gpu_preference,
486 route_id, 519 route_id,
487 0, watchdog_, 520 0, watchdog_,
488 software_, 521 software_,
489 init_params.active_url)); 522 init_params.active_url));
490 if (preempt_by_counter_.get()) 523 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; 595 stats.total_texture_upload_time += total_texture_upload_time;
563 stats.total_processing_commands_time += total_processing_commands_time; 596 stats.total_processing_commands_time += total_processing_commands_time;
564 } 597 }
565 } 598 }
566 599
567 GpuChannelMsg_CollectRenderingStatsForSurface::WriteReplyParams( 600 GpuChannelMsg_CollectRenderingStatsForSurface::WriteReplyParams(
568 reply_message, 601 reply_message,
569 stats); 602 stats);
570 Send(reply_message); 603 Send(reply_message);
571 } 604 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698