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

Side by Side Diff: gpu/ipc/client/command_buffer_proxy_impl.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
« no previous file with comments | « gpu/ipc/client/BUILD.gn ('k') | mojo/gles2/BUILD.gn » ('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 (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 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 5 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/thread_task_runner_handle.h" 14 #include "base/thread_task_runner_handle.h"
15 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
16 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 16 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
17 #include "gpu/command_buffer/common/cmd_buffer_common.h" 17 #include "gpu/command_buffer/common/cmd_buffer_common.h"
18 #include "gpu/command_buffer/common/command_buffer_id.h" 18 #include "gpu/command_buffer/common/command_buffer_id.h"
19 #include "gpu/command_buffer/common/command_buffer_shared.h" 19 #include "gpu/command_buffer/common/command_buffer_shared.h"
20 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 20 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
21 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
21 #include "gpu/command_buffer/common/sync_token.h" 22 #include "gpu/command_buffer/common/sync_token.h"
22 #include "gpu/command_buffer/service/image_factory.h"
23 #include "gpu/ipc/client/gpu_channel_host.h" 23 #include "gpu/ipc/client/gpu_channel_host.h"
24 #include "gpu/ipc/common/gpu_messages.h" 24 #include "gpu/ipc/common/gpu_messages.h"
25 #include "gpu/ipc/common/gpu_param_traits.h" 25 #include "gpu/ipc/common/gpu_param_traits.h"
26 #include "ui/gfx/geometry/size.h" 26 #include "ui/gfx/geometry/size.h"
27 #include "ui/gl/gl_bindings.h" 27 #include "ui/gl/gl_bindings.h"
28 28
29 namespace gpu { 29 namespace gpu {
30 30
31 namespace { 31 namespace {
32 32
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 &requires_sync_token); 423 &requires_sync_token);
424 424
425 uint64_t image_fence_sync = 0; 425 uint64_t image_fence_sync = 0;
426 if (requires_sync_token) { 426 if (requires_sync_token) {
427 image_fence_sync = GenerateFenceSyncRelease(); 427 image_fence_sync = GenerateFenceSyncRelease();
428 428
429 // Make sure fence syncs were flushed before CreateImage() was called. 429 // Make sure fence syncs were flushed before CreateImage() was called.
430 DCHECK_LE(image_fence_sync - 1, flushed_fence_sync_release_); 430 DCHECK_LE(image_fence_sync - 1, flushed_fence_sync_release_);
431 } 431 }
432 432
433 DCHECK(gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( 433 DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(),
434 gpu_memory_buffer->GetFormat(), capabilities_)); 434 capabilities_));
435 DCHECK(gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( 435 DCHECK(gpu::IsImageSizeValidForGpuMemoryBufferFormat(
436 gfx::Size(width, height), gpu_memory_buffer->GetFormat())); 436 gfx::Size(width, height), gpu_memory_buffer->GetFormat()));
437 DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( 437 DCHECK(gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
438 internal_format, gpu_memory_buffer->GetFormat())); 438 internal_format, gpu_memory_buffer->GetFormat()));
439 439
440 GpuCommandBufferMsg_CreateImage_Params params; 440 GpuCommandBufferMsg_CreateImage_Params params;
441 params.id = new_id; 441 params.id = new_id;
442 params.gpu_memory_buffer = handle; 442 params.gpu_memory_buffer = handle;
443 params.size = gfx::Size(width, height); 443 params.size = gfx::Size(width, height);
444 params.format = gpu_memory_buffer->GetFormat(); 444 params.format = gpu_memory_buffer->GetFormat();
445 params.internal_format = internal_format; 445 params.internal_format = internal_format;
446 params.image_release_count = image_fence_sync; 446 params.image_release_count = image_fence_sync;
447 447
(...skipping 24 matching lines...) Expand all
472 472
473 int32_t CommandBufferProxyImpl::CreateGpuMemoryBufferImage( 473 int32_t CommandBufferProxyImpl::CreateGpuMemoryBufferImage(
474 size_t width, 474 size_t width,
475 size_t height, 475 size_t height,
476 unsigned internal_format, 476 unsigned internal_format,
477 unsigned usage) { 477 unsigned usage) {
478 CheckLock(); 478 CheckLock();
479 scoped_ptr<gfx::GpuMemoryBuffer> buffer( 479 scoped_ptr<gfx::GpuMemoryBuffer> buffer(
480 channel_->gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer( 480 channel_->gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer(
481 gfx::Size(width, height), 481 gfx::Size(width, height),
482 gpu::ImageFactory::DefaultBufferFormatForImageFormat(internal_format), 482 gpu::DefaultBufferFormatForImageFormat(internal_format),
483 gfx::BufferUsage::SCANOUT)); 483 gfx::BufferUsage::SCANOUT));
484 if (!buffer) 484 if (!buffer)
485 return -1; 485 return -1;
486 486
487 return CreateImage(buffer->AsClientBuffer(), width, height, internal_format); 487 return CreateImage(buffer->AsClientBuffer(), width, height, internal_format);
488 } 488 }
489 489
490 uint32_t CommandBufferProxyImpl::CreateStreamTexture(uint32_t texture_id) { 490 uint32_t CommandBufferProxyImpl::CreateStreamTexture(uint32_t texture_id) {
491 CheckLock(); 491 CheckLock();
492 if (last_state_.error != gpu::error::kNoError) 492 if (last_state_.error != gpu::error::kNoError)
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 } 726 }
727 727
728 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() { 728 void CommandBufferProxyImpl::InvalidGpuReplyOnClientThread() {
729 scoped_ptr<base::AutoLock> lock; 729 scoped_ptr<base::AutoLock> lock;
730 if (lock_) 730 if (lock_)
731 lock.reset(new base::AutoLock(*lock_)); 731 lock.reset(new base::AutoLock(*lock_));
732 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext); 732 OnDestroyed(gpu::error::kInvalidGpuMessage, gpu::error::kLostContext);
733 } 733 }
734 734
735 } // namespace gpu 735 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/BUILD.gn ('k') | mojo/gles2/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698