OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/display_compositor/buffer_queue.h" | 5 #include "components/display_compositor/buffer_queue.h" |
6 | 6 |
7 #include "base/containers/adapters.h" | 7 #include "base/containers/adapters.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "components/display_compositor/gl_helper.h" | 10 #include "components/display_compositor/gl_helper.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 available_surfaces_.pop_back(); | 211 available_surfaces_.pop_back(); |
212 return surface; | 212 return surface; |
213 } | 213 } |
214 | 214 |
215 GLuint texture; | 215 GLuint texture; |
216 gl_->GenTextures(1, &texture); | 216 gl_->GenTextures(1, &texture); |
217 | 217 |
218 // We don't want to allow anything more than triple buffering. | 218 // We don't want to allow anything more than triple buffering. |
219 DCHECK_LT(allocated_count_, 4U); | 219 DCHECK_LT(allocated_count_, 4U); |
220 std::unique_ptr<gfx::GpuMemoryBuffer> buffer( | 220 std::unique_ptr<gfx::GpuMemoryBuffer> buffer( |
221 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( | 221 gpu_memory_buffer_manager_->CreateGpuMemoryBuffer( |
222 size_, format_, gfx::BufferUsage::SCANOUT, surface_handle_)); | 222 size_, format_, gfx::BufferUsage::SCANOUT, surface_handle_)); |
223 if (!buffer.get()) { | 223 if (!buffer.get()) { |
224 gl_->DeleteTextures(1, &texture); | 224 gl_->DeleteTextures(1, &texture); |
225 DLOG(ERROR) << "Failed to allocate GPU memory buffer"; | 225 DLOG(ERROR) << "Failed to allocate GPU memory buffer"; |
226 return nullptr; | 226 return nullptr; |
227 } | 227 } |
228 buffer->SetColorSpaceForScanout(color_space_); | 228 buffer->SetColorSpaceForScanout(color_space_); |
229 | 229 |
230 uint32_t id = | 230 uint32_t id = |
231 gl_->CreateImageCHROMIUM(buffer->AsClientBuffer(), size_.width(), | 231 gl_->CreateImageCHROMIUM(buffer->AsClientBuffer(), size_.width(), |
(...skipping 21 matching lines...) Expand all Loading... |
253 buffer(buffer.release()), | 253 buffer(buffer.release()), |
254 texture(texture), | 254 texture(texture), |
255 image(image), | 255 image(image), |
256 damage(rect) {} | 256 damage(rect) {} |
257 | 257 |
258 BufferQueue::AllocatedSurface::~AllocatedSurface() { | 258 BufferQueue::AllocatedSurface::~AllocatedSurface() { |
259 buffer_queue->FreeSurfaceResources(this); | 259 buffer_queue->FreeSurfaceResources(this); |
260 } | 260 } |
261 | 261 |
262 } // namespace display_compositor | 262 } // namespace display_compositor |
OLD | NEW |