Chromium Code Reviews| 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 "cc/raster/one_copy_tile_task_worker_pool.h" | 5 #include "cc/raster/one_copy_tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we | 334 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we |
| 335 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT. | 335 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT. |
| 336 if (!staging_buffer->gpu_memory_buffer) { | 336 if (!staging_buffer->gpu_memory_buffer) { |
| 337 staging_buffer->gpu_memory_buffer = | 337 staging_buffer->gpu_memory_buffer = |
| 338 resource_provider_->gpu_memory_buffer_manager() | 338 resource_provider_->gpu_memory_buffer_manager() |
| 339 ->AllocateGpuMemoryBuffer( | 339 ->AllocateGpuMemoryBuffer( |
| 340 staging_buffer->size, BufferFormat(resource->format()), | 340 staging_buffer->size, BufferFormat(resource->format()), |
| 341 use_partial_raster_ | 341 use_partial_raster_ |
| 342 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT | 342 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT |
| 343 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE); | 343 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE); |
| 344 DCHECK_EQ(gfx::NumberOfPlanesForBufferFormat( | |
| 345 staging_buffer->gpu_memory_buffer->GetFormat()), | |
| 346 1u); | |
| 347 } | 344 } |
| 348 | 345 |
| 349 gfx::Rect playback_rect = raster_full_rect; | 346 gfx::Rect playback_rect = raster_full_rect; |
| 350 if (use_partial_raster_ && previous_content_id) { | 347 if (use_partial_raster_ && previous_content_id) { |
| 351 // Reduce playback rect to dirty region if the content id of the staging | 348 // Reduce playback rect to dirty region if the content id of the staging |
| 352 // buffer matches the prevous content id. | 349 // buffer matches the prevous content id. |
| 353 if (previous_content_id == staging_buffer->content_id) | 350 if (previous_content_id == staging_buffer->content_id) |
| 354 playback_rect.Intersect(raster_dirty_rect); | 351 playback_rect.Intersect(raster_dirty_rect); |
| 355 } | 352 } |
| 356 | 353 |
| 357 if (staging_buffer->gpu_memory_buffer) { | 354 if (staging_buffer->gpu_memory_buffer) { |
| 358 gfx::GpuMemoryBuffer* buffer = staging_buffer->gpu_memory_buffer.get(); | 355 gfx::GpuMemoryBuffer* buffer = staging_buffer->gpu_memory_buffer.get(); |
| 359 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat())); | 356 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat())); |
|
ncarter (slow)
2016/02/05 22:05:28
This assertion is the same as the one I'm removing
ericrk
2016/02/05 23:30:42
I agree that the above was redundant... I'm a bit
| |
| 360 bool rv = buffer->Map(); | 357 bool rv = buffer->Map(); |
| 361 DCHECK(rv); | 358 DCHECK(rv); |
| 362 DCHECK(buffer->memory(0)); | 359 DCHECK(buffer->memory(0)); |
| 363 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. | 360 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. |
| 364 DCHECK_GE(buffer->stride(0), 0); | 361 DCHECK_GE(buffer->stride(0), 0); |
| 365 | 362 |
| 366 DCHECK(!playback_rect.IsEmpty()) | 363 DCHECK(!playback_rect.IsEmpty()) |
| 367 << "Why are we rastering a tile that's not dirty?"; | 364 << "Why are we rastering a tile that's not dirty?"; |
| 368 TileTaskWorkerPool::PlaybackToMemory( | 365 TileTaskWorkerPool::PlaybackToMemory( |
| 369 buffer->memory(0), resource->format(), staging_buffer->size, | 366 buffer->memory(0), resource->format(), staging_buffer->size, |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 721 return; | 718 return; |
| 722 | 719 |
| 723 busy_buffers_.front()->DestroyGLResources(gl); | 720 busy_buffers_.front()->DestroyGLResources(gl); |
| 724 RemoveStagingBuffer(busy_buffers_.front().get()); | 721 RemoveStagingBuffer(busy_buffers_.front().get()); |
| 725 busy_buffers_.pop_front(); | 722 busy_buffers_.pop_front(); |
| 726 } | 723 } |
| 727 } | 724 } |
| 728 } | 725 } |
| 729 | 726 |
| 730 } // namespace cc | 727 } // namespace cc |
| OLD | NEW |