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

Side by Side Diff: mojo/gles2/command_buffer_client_impl.cc

Issue 1189833005: Revert of Support impl-side painting in Mandoline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « mojo/gles2/command_buffer_client_impl.h ('k') | mojo/gles2/gles2_impl.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gles2/command_buffer_client_impl.h" 5 #include "mojo/gles2/command_buffer_client_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
11 #include "components/view_manager/gles2/command_buffer_type_conversions.h" 11 #include "components/view_manager/gles2/command_buffer_type_conversions.h"
12 #include "components/view_manager/gles2/mojo_buffer_backing.h" 12 #include "components/view_manager/gles2/mojo_buffer_backing.h"
13 #include "components/view_manager/gles2/mojo_gpu_memory_buffer.h"
14 #include "gpu/command_buffer/service/image_factory.h"
15 #include "mojo/platform_handle/platform_handle_functions.h"
16 13
17 namespace gles2 { 14 namespace gles2 {
18 15
19 namespace { 16 namespace {
20 17
21 bool CreateMapAndDupSharedBuffer(size_t size, 18 bool CreateMapAndDupSharedBuffer(size_t size,
22 void** memory, 19 void** memory,
23 mojo::ScopedSharedBufferHandle* handle, 20 mojo::ScopedSharedBufferHandle* handle,
24 mojo::ScopedSharedBufferHandle* duped) { 21 mojo::ScopedSharedBufferHandle* duped) {
25 MojoResult result = mojo::CreateSharedBuffer(NULL, size, handle); 22 MojoResult result = mojo::CreateSharedBuffer(NULL, size, handle);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 113
117 CommandBufferClientImpl::CommandBufferClientImpl( 114 CommandBufferClientImpl::CommandBufferClientImpl(
118 CommandBufferDelegate* delegate, 115 CommandBufferDelegate* delegate,
119 const MojoAsyncWaiter* async_waiter, 116 const MojoAsyncWaiter* async_waiter,
120 mojo::ScopedMessagePipeHandle command_buffer_handle) 117 mojo::ScopedMessagePipeHandle command_buffer_handle)
121 : delegate_(delegate), 118 : delegate_(delegate),
122 observer_binding_(this), 119 observer_binding_(this),
123 shared_state_(NULL), 120 shared_state_(NULL),
124 last_put_offset_(-1), 121 last_put_offset_(-1),
125 next_transfer_buffer_id_(0), 122 next_transfer_buffer_id_(0),
126 next_image_id_(0),
127 async_waiter_(async_waiter) { 123 async_waiter_(async_waiter) {
128 command_buffer_.Bind(mojo::InterfacePtrInfo<mojo::CommandBuffer>( 124 command_buffer_.Bind(mojo::InterfacePtrInfo<mojo::CommandBuffer>(
129 command_buffer_handle.Pass(), 0u), 125 command_buffer_handle.Pass(), 0u),
130 async_waiter); 126 async_waiter);
131 command_buffer_.set_error_handler(this); 127 command_buffer_.set_error_handler(this);
132 } 128 }
133 129
134 CommandBufferClientImpl::~CommandBufferClientImpl() {} 130 CommandBufferClientImpl::~CommandBufferClientImpl() {}
135 131
136 bool CommandBufferClientImpl::Initialize() { 132 bool CommandBufferClientImpl::Initialize() {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 238 }
243 239
244 gpu::Capabilities CommandBufferClientImpl::GetCapabilities() { 240 gpu::Capabilities CommandBufferClientImpl::GetCapabilities() {
245 return capabilities_; 241 return capabilities_;
246 } 242 }
247 243
248 int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer, 244 int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer,
249 size_t width, 245 size_t width,
250 size_t height, 246 size_t height,
251 unsigned internalformat) { 247 unsigned internalformat) {
252 int32 new_id = ++next_image_id_; 248 // TODO(piman)
253 249 NOTIMPLEMENTED();
254 mojo::SizePtr size = mojo::Size::New(); 250 return -1;
255 size->width = width;
256 size->height = height;
257
258 MojoGpuMemoryBufferImpl* gpu_memory_buffer =
259 MojoGpuMemoryBufferImpl::FromClientBuffer(buffer);
260 gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle();
261
262 bool requires_sync_point = false;
263 base::SharedMemoryHandle dupd_handle =
264 base::SharedMemory::DuplicateHandle(handle.handle);
265 #if defined(OS_WIN)
266 HANDLE platform_handle = dupd_handle;
267 #else
268 int platform_handle = dupd_handle.fd;
269 #endif
270
271 if (handle.type != gfx::SHARED_MEMORY_BUFFER) {
272 requires_sync_point = true;
273 NOTIMPLEMENTED();
274 return -1;
275 }
276
277 MojoHandle mojo_handle = MOJO_HANDLE_INVALID;
278 MojoResult create_result = MojoCreatePlatformHandleWrapper(
279 platform_handle, &mojo_handle);
280 if (create_result != MOJO_RESULT_OK) {
281 NOTIMPLEMENTED();
282 return -1;
283 }
284 mojo::ScopedHandle scoped_handle;
285 scoped_handle.reset(mojo::Handle(mojo_handle));
286 command_buffer_->CreateImage(new_id,
287 scoped_handle.Pass(),
288 handle.type,
289 size.Pass(),
290 gpu_memory_buffer->GetFormat(),
291 internalformat);
292 if (requires_sync_point) {
293 NOTIMPLEMENTED();
294 // TODO(jam): need to support this if we support types other than
295 // SHARED_MEMORY_BUFFER.
296 //gpu_memory_buffer_manager->SetDestructionSyncPoint(gpu_memory_buffer,
297 // InsertSyncPoint());
298 }
299
300 return new_id;
301 } 251 }
302 252
303 void CommandBufferClientImpl::DestroyImage(int32 id) { 253 void CommandBufferClientImpl::DestroyImage(int32 id) {
304 command_buffer_->DestroyImage(id); 254 // TODO(piman)
255 NOTIMPLEMENTED();
305 } 256 }
306 257
307 int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage( 258 int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage(
308 size_t width, 259 size_t width,
309 size_t height, 260 size_t height,
310 unsigned internalformat, 261 unsigned internalformat,
311 unsigned usage) { 262 unsigned usage) {
312 scoped_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create( 263 // TODO(piman)
313 gfx::Size(width, height), 264 NOTIMPLEMENTED();
314 gpu::ImageFactory::ImageFormatToGpuMemoryBufferFormat(internalformat), 265 return -1;
315 gpu::ImageFactory::ImageUsageToGpuMemoryBufferUsage(usage)));
316 if (!buffer)
317 return -1;
318
319 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat);
320 } 266 }
321 267
322 uint32_t CommandBufferClientImpl::InsertSyncPoint() { 268 uint32_t CommandBufferClientImpl::InsertSyncPoint() {
323 command_buffer_->InsertSyncPoint(true); 269 command_buffer_->InsertSyncPoint(true);
324 return sync_point_client_impl_->WaitForInsertSyncPoint(); 270 return sync_point_client_impl_->WaitForInsertSyncPoint();
325 } 271 }
326 272
327 uint32_t CommandBufferClientImpl::InsertFutureSyncPoint() { 273 uint32_t CommandBufferClientImpl::InsertFutureSyncPoint() {
328 command_buffer_->InsertSyncPoint(false); 274 command_buffer_->InsertSyncPoint(false);
329 return sync_point_client_impl_->WaitForInsertSyncPoint(); 275 return sync_point_client_impl_->WaitForInsertSyncPoint();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 334
389 void CommandBufferClientImpl::SetLock(base::Lock* lock) { 335 void CommandBufferClientImpl::SetLock(base::Lock* lock) {
390 } 336 }
391 337
392 bool CommandBufferClientImpl::IsGpuChannelLost() { 338 bool CommandBufferClientImpl::IsGpuChannelLost() {
393 // This is only possible for out-of-process command buffers. 339 // This is only possible for out-of-process command buffers.
394 return false; 340 return false;
395 } 341 }
396 342
397 } // namespace gles2 343 } // namespace gles2
OLDNEW
« no previous file with comments | « mojo/gles2/command_buffer_client_impl.h ('k') | mojo/gles2/gles2_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698