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(int32 id, | 1110 void GpuCommandBufferStub::OnCreateImage( |
1111 gfx::GpuMemoryBufferHandle handle, | 1111 const GpuCommandBufferMsg_CreateImage_Params& params) { |
1112 gfx::Size size, | |
1113 gfx::BufferFormat format, | |
1114 uint32 internalformat) { | |
1115 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); | 1112 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; |
1116 | 1119 |
1117 if (!decoder_) | 1120 if (!decoder_) |
1118 return; | 1121 return; |
1119 | 1122 |
1120 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 1123 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
1121 DCHECK(image_manager); | 1124 DCHECK(image_manager); |
1122 if (image_manager->LookupImage(id)) { | 1125 if (image_manager->LookupImage(id)) { |
1123 LOG(ERROR) << "Image already exists with same ID."; | 1126 LOG(ERROR) << "Image already exists with same ID."; |
1124 return; | 1127 return; |
1125 } | 1128 } |
(...skipping 15 matching lines...) Expand all Loading... |
1141 LOG(ERROR) << "Incompatible image format."; | 1144 LOG(ERROR) << "Incompatible image format."; |
1142 return; | 1145 return; |
1143 } | 1146 } |
1144 | 1147 |
1145 scoped_refptr<gl::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( | 1148 scoped_refptr<gl::GLImage> image = channel()->CreateImageForGpuMemoryBuffer( |
1146 handle, size, format, internalformat); | 1149 handle, size, format, internalformat); |
1147 if (!image.get()) | 1150 if (!image.get()) |
1148 return; | 1151 return; |
1149 | 1152 |
1150 image_manager->AddImage(image.get(), id); | 1153 image_manager->AddImage(image.get(), id); |
| 1154 if (image_release_count) { |
| 1155 sync_point_client_->ReleaseFenceSync(image_release_count); |
| 1156 } |
1151 } | 1157 } |
1152 | 1158 |
1153 void GpuCommandBufferStub::OnDestroyImage(int32 id) { | 1159 void GpuCommandBufferStub::OnDestroyImage(int32 id) { |
1154 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); | 1160 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); |
1155 | 1161 |
1156 if (!decoder_) | 1162 if (!decoder_) |
1157 return; | 1163 return; |
1158 | 1164 |
1159 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); | 1165 gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); |
1160 DCHECK(image_manager); | 1166 DCHECK(image_manager); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 result)); | 1281 result)); |
1276 } | 1282 } |
1277 | 1283 |
1278 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1284 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
1279 base::TimeDelta interval) { | 1285 base::TimeDelta interval) { |
1280 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1286 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
1281 interval)); | 1287 interval)); |
1282 } | 1288 } |
1283 | 1289 |
1284 } // namespace content | 1290 } // namespace content |
OLD | NEW |