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

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 1427413004: Revert of ui: Add custom stride support to GLImageMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « content/common/gpu/gpu_channel.cc ('k') | ui/gfx/gpu_memory_buffer.h » ('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 <queue> 7 #include <queue>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/numerics/safe_conversions.h"
19 #include "base/sequence_checker.h" 18 #include "base/sequence_checker.h"
20 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
21 #include "base/thread_task_runner_handle.h" 20 #include "base/thread_task_runner_handle.h"
22 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 21 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
23 #include "gpu/command_buffer/common/sync_token.h" 22 #include "gpu/command_buffer/common/sync_token.h"
24 #include "gpu/command_buffer/common/value_state.h" 23 #include "gpu/command_buffer/common/value_state.h"
25 #include "gpu/command_buffer/service/command_buffer_service.h" 24 #include "gpu/command_buffer/service/command_buffer_service.h"
26 #include "gpu/command_buffer/service/context_group.h" 25 #include "gpu/command_buffer/service/context_group.h"
27 #include "gpu/command_buffer/service/gl_context_virtual.h" 26 #include "gpu/command_buffer/service/gl_context_virtual.h"
28 #include "gpu/command_buffer/service/gpu_scheduler.h" 27 #include "gpu/command_buffer/service/gpu_scheduler.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 107
109 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuThread( 108 gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuThread(
110 const gfx::GpuMemoryBufferHandle& source_handle, 109 const gfx::GpuMemoryBufferHandle& source_handle,
111 bool* requires_sync_point) { 110 bool* requires_sync_point) {
112 switch (source_handle.type) { 111 switch (source_handle.type) {
113 case gfx::SHARED_MEMORY_BUFFER: { 112 case gfx::SHARED_MEMORY_BUFFER: {
114 gfx::GpuMemoryBufferHandle handle; 113 gfx::GpuMemoryBufferHandle handle;
115 handle.type = gfx::SHARED_MEMORY_BUFFER; 114 handle.type = gfx::SHARED_MEMORY_BUFFER;
116 handle.handle = ShareToGpuThread(source_handle.handle); 115 handle.handle = ShareToGpuThread(source_handle.handle);
117 handle.offset = source_handle.offset; 116 handle.offset = source_handle.offset;
118 handle.stride = source_handle.stride;
119 *requires_sync_point = false; 117 *requires_sync_point = false;
120 return handle; 118 return handle;
121 } 119 }
122 case gfx::IO_SURFACE_BUFFER: 120 case gfx::IO_SURFACE_BUFFER:
123 case gfx::SURFACE_TEXTURE_BUFFER: 121 case gfx::SURFACE_TEXTURE_BUFFER:
124 case gfx::OZONE_NATIVE_PIXMAP: 122 case gfx::OZONE_NATIVE_PIXMAP:
125 *requires_sync_point = true; 123 *requires_sync_point = true;
126 return source_handle; 124 return source_handle;
127 default: 125 default:
128 NOTREACHED(); 126 NOTREACHED();
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 728
731 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); 729 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
732 DCHECK(image_manager); 730 DCHECK(image_manager);
733 if (image_manager->LookupImage(id)) { 731 if (image_manager->LookupImage(id)) {
734 LOG(ERROR) << "Image already exists with same ID."; 732 LOG(ERROR) << "Image already exists with same ID.";
735 return; 733 return;
736 } 734 }
737 735
738 switch (handle.type) { 736 switch (handle.type) {
739 case gfx::SHARED_MEMORY_BUFFER: { 737 case gfx::SHARED_MEMORY_BUFFER: {
740 if (!base::IsValueInRangeForNumericType<size_t>(handle.stride)) {
741 LOG(ERROR) << "Invalid stride for image.";
742 return;
743 }
744 scoped_refptr<gl::GLImageSharedMemory> image( 738 scoped_refptr<gl::GLImageSharedMemory> image(
745 new gl::GLImageSharedMemory(size, internalformat)); 739 new gl::GLImageSharedMemory(size, internalformat));
746 if (!image->Initialize(handle.handle, handle.id, format, handle.offset, 740 if (!image->Initialize(handle.handle, handle.id, format, handle.offset)) {
747 handle.stride)) {
748 LOG(ERROR) << "Failed to initialize image."; 741 LOG(ERROR) << "Failed to initialize image.";
749 return; 742 return;
750 } 743 }
751 744
752 image_manager->AddImage(image.get(), id); 745 image_manager->AddImage(image.get(), id);
753 break; 746 break;
754 } 747 }
755 default: { 748 default: {
756 if (!image_factory_) { 749 if (!image_factory_) {
757 LOG(ERROR) << "Image factory missing but required by buffer type."; 750 LOG(ERROR) << "Image factory missing but required by buffer type.";
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 framebuffer_completeness_cache_ = 1120 framebuffer_completeness_cache_ =
1128 new gpu::gles2::FramebufferCompletenessCache; 1121 new gpu::gles2::FramebufferCompletenessCache;
1129 return framebuffer_completeness_cache_; 1122 return framebuffer_completeness_cache_;
1130 } 1123 }
1131 1124
1132 SyncPointManager* GpuInProcessThread::sync_point_manager() { 1125 SyncPointManager* GpuInProcessThread::sync_point_manager() {
1133 return sync_point_manager_; 1126 return sync_point_manager_;
1134 } 1127 }
1135 1128
1136 } // namespace gpu 1129 } // namespace gpu
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.cc ('k') | ui/gfx/gpu_memory_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698