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

Side by Side Diff: components/mus/gles2/command_buffer_local.cc

Issue 1849313002: Pull gpu CmdBuf service/client shared GpuMemoryBuffer code to common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/gles2/command_buffer_local.h" 5 #include "components/mus/gles2/command_buffer_local.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "components/mus/gles2/command_buffer_driver.h" 12 #include "components/mus/gles2/command_buffer_driver.h"
13 #include "components/mus/gles2/command_buffer_local_client.h" 13 #include "components/mus/gles2/command_buffer_local_client.h"
14 #include "components/mus/gles2/command_buffer_type_conversions.h" 14 #include "components/mus/gles2/command_buffer_type_conversions.h"
15 #include "components/mus/gles2/gpu_memory_tracker.h" 15 #include "components/mus/gles2/gpu_memory_tracker.h"
16 #include "components/mus/gles2/gpu_state.h" 16 #include "components/mus/gles2/gpu_state.h"
17 #include "components/mus/gles2/mojo_buffer_backing.h" 17 #include "components/mus/gles2/mojo_buffer_backing.h"
18 #include "components/mus/gles2/mojo_gpu_memory_buffer.h" 18 #include "components/mus/gles2/mojo_gpu_memory_buffer.h"
19 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
19 #include "gpu/command_buffer/common/sync_token.h" 20 #include "gpu/command_buffer/common/sync_token.h"
20 #include "gpu/command_buffer/service/command_buffer_service.h" 21 #include "gpu/command_buffer/service/command_buffer_service.h"
21 #include "gpu/command_buffer/service/context_group.h" 22 #include "gpu/command_buffer/service/context_group.h"
22 #include "gpu/command_buffer/service/image_factory.h"
23 #include "gpu/command_buffer/service/image_manager.h" 23 #include "gpu/command_buffer/service/image_manager.h"
24 #include "gpu/command_buffer/service/memory_tracking.h" 24 #include "gpu/command_buffer/service/memory_tracking.h"
25 #include "gpu/command_buffer/service/shader_translator_cache.h" 25 #include "gpu/command_buffer/service/shader_translator_cache.h"
26 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 26 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
27 #include "gpu/command_buffer/service/valuebuffer_manager.h" 27 #include "gpu/command_buffer/service/valuebuffer_manager.h"
28 #include "mojo/platform_handle/platform_handle_functions.h" 28 #include "mojo/platform_handle/platform_handle_functions.h"
29 #include "ui/gfx/buffer_format_util.h" 29 #include "ui/gfx/buffer_format_util.h"
30 #include "ui/gfx/vsync_provider.h" 30 #include "ui/gfx/vsync_provider.h"
31 #include "ui/gl/gl_context.h" 31 #include "ui/gl/gl_context.h"
32 #include "ui/gl/gl_image_shared_memory.h" 32 #include "ui/gl/gl_image_shared_memory.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 289
290 int32_t CommandBufferLocal::CreateGpuMemoryBufferImage(size_t width, 290 int32_t CommandBufferLocal::CreateGpuMemoryBufferImage(size_t width,
291 size_t height, 291 size_t height,
292 unsigned internal_format, 292 unsigned internal_format,
293 unsigned usage) { 293 unsigned usage) {
294 DCHECK(CalledOnValidThread()); 294 DCHECK(CalledOnValidThread());
295 DCHECK_EQ(usage, static_cast<unsigned>(GL_READ_WRITE_CHROMIUM)); 295 DCHECK_EQ(usage, static_cast<unsigned>(GL_READ_WRITE_CHROMIUM));
296 scoped_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create( 296 scoped_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create(
297 gfx::Size(static_cast<int>(width), static_cast<int>(height)), 297 gfx::Size(static_cast<int>(width), static_cast<int>(height)),
298 gpu::ImageFactory::DefaultBufferFormatForImageFormat(internal_format), 298 gpu::DefaultBufferFormatForImageFormat(internal_format),
299 gfx::BufferUsage::SCANOUT)); 299 gfx::BufferUsage::SCANOUT));
300 if (!buffer) 300 if (!buffer)
301 return -1; 301 return -1;
302 return CreateImage(buffer->AsClientBuffer(), width, height, internal_format); 302 return CreateImage(buffer->AsClientBuffer(), width, height, internal_format);
303 } 303 }
304 304
305 void CommandBufferLocal::SignalQuery(uint32_t query_id, 305 void CommandBufferLocal::SignalQuery(uint32_t query_id,
306 const base::Closure& callback) { 306 const base::Closure& callback) {
307 DCHECK(CalledOnValidThread()); 307 DCHECK(CalledOnValidThread());
308 308
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 client_->UpdateVSyncParameters(timebase, interval); 551 client_->UpdateVSyncParameters(timebase, interval);
552 } 552 }
553 553
554 void CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread( 554 void CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread(
555 gfx::SwapResult result) { 555 gfx::SwapResult result) {
556 if (client_) 556 if (client_)
557 client_->GpuCompletedSwapBuffers(result); 557 client_->GpuCompletedSwapBuffers(result);
558 } 558 }
559 559
560 } // namespace mus 560 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_driver.cc ('k') | content/browser/compositor/buffer_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698