| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/hash.h" | 8 #include "base/hash.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 uint64_t release) { | 1100 uint64_t release) { |
| 1101 DCHECK(waiting_for_sync_point_); | 1101 DCHECK(waiting_for_sync_point_); |
| 1102 DCHECK(!scheduler_->scheduled()); | 1102 DCHECK(!scheduler_->scheduled()); |
| 1103 TRACE_EVENT_ASYNC_END1("gpu", "WaitFenceSync", this, "GpuCommandBufferStub", | 1103 TRACE_EVENT_ASYNC_END1("gpu", "WaitFenceSync", this, "GpuCommandBufferStub", |
| 1104 this); | 1104 this); |
| 1105 PullTextureUpdates(namespace_id, command_buffer_id, release); | 1105 PullTextureUpdates(namespace_id, command_buffer_id, release); |
| 1106 waiting_for_sync_point_ = false; | 1106 waiting_for_sync_point_ = false; |
| 1107 scheduler_->SetScheduled(true); | 1107 scheduler_->SetScheduled(true); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 void GpuCommandBufferStub::OnCreateImage( | 1110 void GpuCommandBufferStub::OnCreateImage(int32 id, |
| 1111 const GpuCommandBufferMsg_CreateImage_Params& params) { | 1111 gfx::GpuMemoryBufferHandle handle, |
| 1112 gfx::Size size, |
| 1113 gfx::BufferFormat format, |
| 1114 uint32 internalformat) { |
| 1112 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); | 1115 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); |
| 1113 const int32_t id = params.id; | |
| 1114 const gfx::GpuMemoryBufferHandle& handle = params.gpu_memory_buffer; | |
| 1115 const gfx::Size& size = params.size; | |
| 1116 const gfx::BufferFormat& format = params.format; | |
| 1117 const uint32_t internalformat = params.internal_format; | |
| 1118 const uint64_t image_release_count = params.image_release_count; | |
| 1119 | 1116 |
| 1120 if (!decoder_) | 1117 if (!decoder_) |
| 1121 return; | 1118 return; |
| 1122 | 1119 |
| 1123 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 1120 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
| 1124 DCHECK(image_manager); | 1121 DCHECK(image_manager); |
| 1125 if (image_manager->LookupImage(id)) { | 1122 if (image_manager->LookupImage(id)) { |
| 1126 LOG(ERROR) << "Image already exists with same ID."; | 1123 LOG(ERROR) << "Image already exists with same ID."; |
| 1127 return; | 1124 return; |
| 1128 } | 1125 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1144 LOG(ERROR) << "Incompatible image format."; | 1141 LOG(ERROR) << "Incompatible image format."; |
| 1145 return; | 1142 return; |
| 1146 } | 1143 } |
| 1147 | 1144 |
| 1148 scoped_refptr<gl::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( | 1145 scoped_refptr<gl::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( |
| 1149 handle, size, format, internalformat); | 1146 handle, size, format, internalformat); |
| 1150 if (!image.get()) | 1147 if (!image.get()) |
| 1151 return; | 1148 return; |
| 1152 | 1149 |
| 1153 image_manager->AddImage(image.get(), id); | 1150 image_manager->AddImage(image.get(), id); |
| 1154 if (image_release_count) { | |
| 1155 sync_point_client_->ReleaseFenceSync(image_release_count); | |
| 1156 } | |
| 1157 } | 1151 } |
| 1158 | 1152 |
| 1159 void GpuCommandBufferStub::OnDestroyImage(int32 id) { | 1153 void GpuCommandBufferStub::OnDestroyImage(int32 id) { |
| 1160 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); | 1154 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); |
| 1161 | 1155 |
| 1162 if (!decoder_) | 1156 if (!decoder_) |
| 1163 return; | 1157 return; |
| 1164 | 1158 |
| 1165 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 1159 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
| 1166 DCHECK(image_manager); | 1160 DCHECK(image_manager); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 result)); | 1275 result)); |
| 1282 } | 1276 } |
| 1283 | 1277 |
| 1284 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1278 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1285 base::TimeDelta interval) { | 1279 base::TimeDelta interval) { |
| 1286 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1280 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1287 interval)); | 1281 interval)); |
| 1288 } | 1282 } |
| 1289 | 1283 |
| 1290 } // namespace content | 1284 } // namespace content |
| OLD | NEW |