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

Side by Side Diff: mojo/services/gles2/command_buffer_impl.cc

Issue 354933002: Connect X11 ConfigureNotify events to Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed double-notification for node bounds changes Created 6 years, 5 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 "mojo/services/gles2/command_buffer_impl.h" 5 #include "mojo/services/gles2/command_buffer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 9
10 #include "gpu/command_buffer/common/constants.h" 10 #include "gpu/command_buffer/common/constants.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void CommandBufferImpl::Initialize( 66 void CommandBufferImpl::Initialize(
67 CommandBufferSyncClientPtr sync_client, 67 CommandBufferSyncClientPtr sync_client,
68 mojo::ScopedSharedBufferHandle shared_state) { 68 mojo::ScopedSharedBufferHandle shared_state) {
69 sync_client_ = sync_client.Pass(); 69 sync_client_ = sync_client.Pass();
70 sync_client_->DidInitialize(DoInitialize(shared_state.Pass())); 70 sync_client_->DidInitialize(DoInitialize(shared_state.Pass()));
71 } 71 }
72 72
73 bool CommandBufferImpl::DoInitialize( 73 bool CommandBufferImpl::DoInitialize(
74 mojo::ScopedSharedBufferHandle shared_state) { 74 mojo::ScopedSharedBufferHandle shared_state) {
75 // TODO(piman): offscreen surface. 75 // TODO(piman): offscreen surface.
76 scoped_refptr<gfx::GLSurface> surface = 76 surface_ = gfx::GLSurface::CreateViewGLSurface(widget_);
77 gfx::GLSurface::CreateViewGLSurface(widget_); 77 if (!surface_.get())
78 if (!surface.get())
79 return false; 78 return false;
80 79
81 // TODO(piman): context sharing, virtual contexts, gpu preference. 80 // TODO(piman): context sharing, virtual contexts, gpu preference.
82 scoped_refptr<gfx::GLContext> context = gfx::GLContext::CreateGLContext( 81 scoped_refptr<gfx::GLContext> context = gfx::GLContext::CreateGLContext(
83 NULL, surface.get(), gfx::PreferIntegratedGpu); 82 NULL, surface_.get(), gfx::PreferIntegratedGpu);
84 if (!context.get()) 83 if (!context.get())
85 return false; 84 return false;
86 85
87 if (!context->MakeCurrent(surface.get())) 86 if (!context->MakeCurrent(surface_.get()))
88 return false; 87 return false;
89 88
90 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but 89 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but
91 // only needs to be per-thread. 90 // only needs to be per-thread.
92 scoped_refptr<gpu::gles2::ContextGroup> context_group = 91 scoped_refptr<gpu::gles2::ContextGroup> context_group =
93 new gpu::gles2::ContextGroup(NULL, 92 new gpu::gles2::ContextGroup(NULL,
94 NULL, 93 NULL,
95 new MemoryTrackerStub, 94 new MemoryTrackerStub,
96 new gpu::gles2::ShaderTranslatorCache, 95 new gpu::gles2::ShaderTranslatorCache,
97 NULL, 96 NULL,
98 true); 97 true);
99 98
100 command_buffer_.reset( 99 command_buffer_.reset(
101 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); 100 new gpu::CommandBufferService(context_group->transfer_buffer_manager()));
102 bool result = command_buffer_->Initialize(); 101 bool result = command_buffer_->Initialize();
103 DCHECK(result); 102 DCHECK(result);
104 103
105 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); 104 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get()));
106 scheduler_.reset(new gpu::GpuScheduler( 105 scheduler_.reset(new gpu::GpuScheduler(
107 command_buffer_.get(), decoder_.get(), decoder_.get())); 106 command_buffer_.get(), decoder_.get(), decoder_.get()));
108 decoder_->set_engine(scheduler_.get()); 107 decoder_->set_engine(scheduler_.get());
108 decoder_->SetResizeCallback(
109 base::Bind(&CommandBufferImpl::OnResize, base::Unretained(this)));
109 110
110 gpu::gles2::DisallowedFeatures disallowed_features; 111 gpu::gles2::DisallowedFeatures disallowed_features;
111 112
112 // TODO(piman): attributes. 113 // TODO(piman): attributes.
113 std::vector<int32> attrib_vector; 114 std::vector<int32> attrib_vector;
114 if (!decoder_->Initialize(surface, 115 if (!decoder_->Initialize(surface_,
115 context, 116 context,
116 false /* offscreen */, 117 false /* offscreen */,
117 size_, 118 size_,
118 disallowed_features, 119 disallowed_features,
119 attrib_vector)) 120 attrib_vector))
120 return false; 121 return false;
121 122
122 gpu_control_.reset( 123 gpu_control_.reset(
123 new gpu::GpuControlService(context_group->image_manager(), NULL)); 124 new gpu::GpuControlService(context_group->image_manager(), NULL));
124 125
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 188
188 void CommandBufferImpl::CancelAnimationFrames() { timer_.Stop(); } 189 void CommandBufferImpl::CancelAnimationFrames() { timer_.Stop(); }
189 190
190 void CommandBufferImpl::OnParseError() { 191 void CommandBufferImpl::OnParseError() {
191 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); 192 gpu::CommandBuffer::State state = command_buffer_->GetLastState();
192 client()->LostContext(state.context_lost_reason); 193 client()->LostContext(state.context_lost_reason);
193 } 194 }
194 195
195 void CommandBufferImpl::DrawAnimationFrame() { client()->DrawAnimationFrame(); } 196 void CommandBufferImpl::DrawAnimationFrame() { client()->DrawAnimationFrame(); }
196 197
198 void CommandBufferImpl::OnResize(gfx::Size size, float scale_factor) {
199 surface_->Resize(size);
200 }
201
197 } // namespace services 202 } // namespace services
198 } // namespace mojo 203 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/gles2/command_buffer_impl.h ('k') | mojo/services/native_viewport/native_viewport_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698