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

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.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/command_buffer/service/image_factory.cc ('k') | gpu/command_buffer_common.gypi » ('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 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
11 #include <set> 11 #include <set>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
18 #include "base/location.h" 18 #include "base/location.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/numerics/safe_conversions.h" 21 #include "base/numerics/safe_conversions.h"
22 #include "base/sequence_checker.h" 22 #include "base/sequence_checker.h"
23 #include "base/single_thread_task_runner.h" 23 #include "base/single_thread_task_runner.h"
24 #include "base/thread_task_runner_handle.h" 24 #include "base/thread_task_runner_handle.h"
25 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 25 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
26 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
26 #include "gpu/command_buffer/common/sync_token.h" 27 #include "gpu/command_buffer/common/sync_token.h"
27 #include "gpu/command_buffer/common/value_state.h" 28 #include "gpu/command_buffer/common/value_state.h"
28 #include "gpu/command_buffer/service/command_buffer_service.h" 29 #include "gpu/command_buffer/service/command_buffer_service.h"
29 #include "gpu/command_buffer/service/command_executor.h" 30 #include "gpu/command_buffer/service/command_executor.h"
30 #include "gpu/command_buffer/service/context_group.h" 31 #include "gpu/command_buffer/service/context_group.h"
31 #include "gpu/command_buffer/service/gl_context_virtual.h" 32 #include "gpu/command_buffer/service/gl_context_virtual.h"
32 #include "gpu/command_buffer/service/gpu_preferences.h" 33 #include "gpu/command_buffer/service/gpu_preferences.h"
33 #include "gpu/command_buffer/service/image_factory.h" 34 #include "gpu/command_buffer/service/image_factory.h"
34 #include "gpu/command_buffer/service/image_manager.h" 35 #include "gpu/command_buffer/service/image_manager.h"
35 #include "gpu/command_buffer/service/mailbox_manager.h" 36 #include "gpu/command_buffer/service/mailbox_manager.h"
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 unsigned internalformat) { 679 unsigned internalformat) {
679 CheckSequencedThread(); 680 CheckSequencedThread();
680 681
681 DCHECK(gpu_memory_buffer_manager_); 682 DCHECK(gpu_memory_buffer_manager_);
682 gfx::GpuMemoryBuffer* gpu_memory_buffer = 683 gfx::GpuMemoryBuffer* gpu_memory_buffer =
683 gpu_memory_buffer_manager_->GpuMemoryBufferFromClientBuffer(buffer); 684 gpu_memory_buffer_manager_->GpuMemoryBufferFromClientBuffer(buffer);
684 DCHECK(gpu_memory_buffer); 685 DCHECK(gpu_memory_buffer);
685 686
686 int32_t new_id = next_image_id_.GetNext(); 687 int32_t new_id = next_image_id_.GetNext();
687 688
688 DCHECK(gpu::ImageFactory::IsGpuMemoryBufferFormatSupported( 689 DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(),
689 gpu_memory_buffer->GetFormat(), capabilities_)); 690 capabilities_));
690 DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat( 691 DCHECK(gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
691 internalformat, gpu_memory_buffer->GetFormat())); 692 internalformat, gpu_memory_buffer->GetFormat()));
692 693
693 // This handle is owned by the GPU thread and must be passed to it or it 694 // This handle is owned by the GPU thread and must be passed to it or it
694 // will leak. In otherwords, do not early out on error between here and the 695 // will leak. In otherwords, do not early out on error between here and the
695 // queuing of the CreateImage task below. 696 // queuing of the CreateImage task below.
696 bool requires_sync_point = false; 697 bool requires_sync_point = false;
697 gfx::GpuMemoryBufferHandle handle = 698 gfx::GpuMemoryBufferHandle handle =
698 ShareGpuMemoryBufferToGpuThread(gpu_memory_buffer->GetHandle(), 699 ShareGpuMemoryBufferToGpuThread(gpu_memory_buffer->GetHandle(),
699 &requires_sync_point); 700 &requires_sync_point);
700 701
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 size_t width, 818 size_t width,
818 size_t height, 819 size_t height,
819 unsigned internalformat, 820 unsigned internalformat,
820 unsigned usage) { 821 unsigned usage) {
821 CheckSequencedThread(); 822 CheckSequencedThread();
822 823
823 DCHECK(gpu_memory_buffer_manager_); 824 DCHECK(gpu_memory_buffer_manager_);
824 scoped_ptr<gfx::GpuMemoryBuffer> buffer( 825 scoped_ptr<gfx::GpuMemoryBuffer> buffer(
825 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( 826 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer(
826 gfx::Size(width, height), 827 gfx::Size(width, height),
827 gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat), 828 gpu::DefaultBufferFormatForImageFormat(internalformat),
828 gfx::BufferUsage::SCANOUT)); 829 gfx::BufferUsage::SCANOUT));
829 if (!buffer) 830 if (!buffer)
830 return -1; 831 return -1;
831 832
832 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); 833 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat);
833 } 834 }
834 835
835 void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) { 836 void InProcessCommandBuffer::FenceSyncReleaseOnGpuThread(uint64_t release) {
836 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release)); 837 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release));
837 gles2::MailboxManager* mailbox_manager = 838 gles2::MailboxManager* mailbox_manager =
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 framebuffer_completeness_cache_ = 1092 framebuffer_completeness_cache_ =
1092 new gpu::gles2::FramebufferCompletenessCache; 1093 new gpu::gles2::FramebufferCompletenessCache;
1093 return framebuffer_completeness_cache_; 1094 return framebuffer_completeness_cache_;
1094 } 1095 }
1095 1096
1096 SyncPointManager* GpuInProcessThread::sync_point_manager() { 1097 SyncPointManager* GpuInProcessThread::sync_point_manager() {
1097 return sync_point_manager_; 1098 return sync_point_manager_;
1098 } 1099 }
1099 1100
1100 } // namespace gpu 1101 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/image_factory.cc ('k') | gpu/command_buffer_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698