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

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 23234003: Support stream textures with the synchronous compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: this time for real Created 7 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "gpu/command_buffer/service/in_process_command_buffer.h" 5 #include "gpu/command_buffer/service/in_process_command_buffer.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <utility> 8 #include <utility>
9 9
10 #include <GLES2/gl2.h> 10 #include <GLES2/gl2.h>
(...skipping 16 matching lines...) Expand all
27 #include "gpu/command_buffer/service/context_group.h" 27 #include "gpu/command_buffer/service/context_group.h"
28 #include "gpu/command_buffer/service/gl_context_virtual.h" 28 #include "gpu/command_buffer/service/gl_context_virtual.h"
29 #include "gpu/command_buffer/service/gpu_scheduler.h" 29 #include "gpu/command_buffer/service/gpu_scheduler.h"
30 #include "gpu/command_buffer/service/image_manager.h" 30 #include "gpu/command_buffer/service/image_manager.h"
31 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 31 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
32 #include "ui/gfx/size.h" 32 #include "ui/gfx/size.h"
33 #include "ui/gl/gl_context.h" 33 #include "ui/gl/gl_context.h"
34 #include "ui/gl/gl_image.h" 34 #include "ui/gl/gl_image.h"
35 #include "ui/gl/gl_share_group.h" 35 #include "ui/gl/gl_share_group.h"
36 36
37 #if defined(OS_ANDROID)
38 #include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h "
39 #include "ui/gl/android/surface_texture_bridge.h"
40 #endif
41
37 namespace gpu { 42 namespace gpu {
38 43
39 namespace { 44 namespace {
40 45
41 static base::LazyInstance<std::set<InProcessCommandBuffer*> > 46 static base::LazyInstance<std::set<InProcessCommandBuffer*> >
42 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; 47 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER;
43 48
44 static bool g_use_virtualized_gl_context = false; 49 static bool g_use_virtualized_gl_context = false;
45 static bool g_uses_explicit_scheduling = false; 50 static bool g_uses_explicit_scheduling = false;
46 51
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 context_group = *it; 376 context_group = *it;
372 DCHECK(context_group->share_resources_); 377 DCHECK(context_group->share_resources_);
373 context_lost_ = context_group->IsContextLost(); 378 context_lost_ = context_group->IsContextLost();
374 break; 379 break;
375 } 380 }
376 } 381 }
377 if (!context_group) 382 if (!context_group)
378 share_group = new gfx::GLShareGroup; 383 share_group = new gfx::GLShareGroup;
379 } 384 }
380 385
386 StreamTextureManager* stream_texture_manager = NULL;
387 #if defined(OS_ANDROID)
388 stream_texture_manager = stream_texture_manager_ =
389 context_group ? context_group->stream_texture_manager_.get()
390 : new StreamTextureManagerInProcess;
391 #endif
392
381 bool bind_generates_resource = false; 393 bool bind_generates_resource = false;
382 decoder_.reset(gles2::GLES2Decoder::Create( 394 decoder_.reset(gles2::GLES2Decoder::Create(
383 context_group ? context_group->decoder_->GetContextGroup() 395 context_group ? context_group->decoder_->GetContextGroup()
384 : new gles2::ContextGroup( 396 : new gles2::ContextGroup(NULL,
385 NULL, NULL, NULL, NULL, bind_generates_resource))); 397 NULL,
398 NULL,
399 stream_texture_manager,
400 bind_generates_resource)));
386 401
387 gpu_scheduler_.reset( 402 gpu_scheduler_.reset(
388 new GpuScheduler(command_buffer.get(), decoder_.get(), decoder_.get())); 403 new GpuScheduler(command_buffer.get(), decoder_.get(), decoder_.get()));
389 command_buffer->SetGetBufferChangeCallback(base::Bind( 404 command_buffer->SetGetBufferChangeCallback(base::Bind(
390 &GpuScheduler::SetGetBuffer, base::Unretained(gpu_scheduler_.get()))); 405 &GpuScheduler::SetGetBuffer, base::Unretained(gpu_scheduler_.get())));
391 command_buffer_ = command_buffer.Pass(); 406 command_buffer_ = command_buffer.Pass();
392 407
393 decoder_->set_engine(gpu_scheduler_.get()); 408 decoder_->set_engine(gpu_scheduler_.get());
394 409
395 if (!surface_) { 410 if (!surface_) {
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 // ownership. 742 // ownership.
728 scoped_ptr<base::Closure> scoped_callback(new base::Closure(callback)); 743 scoped_ptr<base::Closure> scoped_callback(new base::Closure(callback));
729 base::Closure callback_on_client_thread = 744 base::Closure callback_on_client_thread =
730 base::Bind(&RunOnTargetThread, base::Passed(&scoped_callback)); 745 base::Bind(&RunOnTargetThread, base::Passed(&scoped_callback));
731 base::Closure wrapped_callback = 746 base::Closure wrapped_callback =
732 base::Bind(&PostCallback, base::MessageLoopProxy::current(), 747 base::Bind(&PostCallback, base::MessageLoopProxy::current(),
733 callback_on_client_thread); 748 callback_on_client_thread);
734 return wrapped_callback; 749 return wrapped_callback;
735 } 750 }
736 751
752 #if defined(OS_ANDROID)
753 scoped_refptr<gfx::SurfaceTextureBridge>
754 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) {
755 DCHECK(stream_texture_manager_);
756 return stream_texture_manager_->GetSurfaceTexture(stream_id);
757 }
758 #endif
759
737 // static 760 // static
738 void InProcessCommandBuffer::EnableVirtualizedContext() { 761 void InProcessCommandBuffer::EnableVirtualizedContext() {
739 g_use_virtualized_gl_context = true; 762 g_use_virtualized_gl_context = true;
740 } 763 }
741 764
742 // static 765 // static
743 void InProcessCommandBuffer::SetScheduleCallback( 766 void InProcessCommandBuffer::SetScheduleCallback(
744 const base::Closure& callback) { 767 const base::Closure& callback) {
745 DCHECK(!g_uses_explicit_scheduling); 768 DCHECK(!g_uses_explicit_scheduling);
746 DCHECK(!SchedulerClientBase::HasClients()); 769 DCHECK(!SchedulerClientBase::HasClients());
747 g_uses_explicit_scheduling = true; 770 g_uses_explicit_scheduling = true;
748 g_gpu_queue.Get().SetScheduleCallback(callback); 771 g_gpu_queue.Get().SetScheduleCallback(callback);
749 } 772 }
750 773
751 // static 774 // static
752 void InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread() { 775 void InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread() {
753 g_gpu_queue.Get().RunTasks(); 776 g_gpu_queue.Get().RunTasks();
754 } 777 }
755 778
756 } // namespace gpu 779 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698