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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
| 12 #include "base/trace_event/trace_event_argument.h" | 12 #include "base/trace_event/trace_event_argument.h" |
| 13 #include "cc/base/math_util.h" | 13 #include "cc/base/math_util.h" |
| 14 #include "cc/debug/traced_value.h" | 14 #include "cc/debug/traced_value.h" |
| 15 #include "cc/raster/raster_buffer.h" | 15 #include "cc/raster/raster_buffer.h" |
| 16 #include "cc/resources/platform_color.h" | 16 #include "cc/resources/platform_color.h" |
| 17 #include "cc/resources/resource_pool.h" | 17 #include "cc/resources/resource_pool.h" |
| 18 #include "cc/resources/scoped_resource.h" | 18 #include "cc/resources/scoped_resource.h" |
| 19 #include "gpu/command_buffer/client/gles2_interface.h" | 19 #include "gpu/command_buffer/client/gles2_interface.h" |
| 20 #include "ui/gfx/buffer_format_util.h" | |
| 20 #include "ui/gfx/gpu_memory_buffer.h" | 21 #include "ui/gfx/gpu_memory_buffer.h" |
| 21 | 22 |
| 22 namespace cc { | 23 namespace cc { |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 class RasterBufferImpl : public RasterBuffer { | 26 class RasterBufferImpl : public RasterBuffer { |
| 26 public: | 27 public: |
| 27 RasterBufferImpl(OneCopyTileTaskWorkerPool* worker_pool, | 28 RasterBufferImpl(OneCopyTileTaskWorkerPool* worker_pool, |
| 28 ResourceProvider* resource_provider, | 29 ResourceProvider* resource_provider, |
| 29 ResourcePool* resource_pool, | 30 ResourcePool* resource_pool, |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 const Resource* raster_resource, | 332 const Resource* raster_resource, |
| 332 const Resource* output_resource, | 333 const Resource* output_resource, |
| 333 const RasterSource* raster_source, | 334 const RasterSource* raster_source, |
| 334 const gfx::Rect& raster_full_rect, | 335 const gfx::Rect& raster_full_rect, |
| 335 const gfx::Rect& raster_dirty_rect, | 336 const gfx::Rect& raster_dirty_rect, |
| 336 float scale, | 337 float scale, |
| 337 bool include_images) { | 338 bool include_images) { |
| 338 gfx::GpuMemoryBuffer* gpu_memory_buffer = | 339 gfx::GpuMemoryBuffer* gpu_memory_buffer = |
| 339 raster_resource_write_lock->GetGpuMemoryBuffer(); | 340 raster_resource_write_lock->GetGpuMemoryBuffer(); |
| 340 if (gpu_memory_buffer) { | 341 if (gpu_memory_buffer) { |
| 342 CHECK_EQ( | |
| 343 1u, gfx::NumberOfPlanesForBufferFormat(gpu_memory_buffer->GetFormat())); | |
|
reveman
2015/08/11 18:59:11
nit: DCHECK_EQ. I don't think we should use CHECKs
Andre
2015/08/11 19:37:53
Done.
| |
| 341 void* data = NULL; | 344 void* data = NULL; |
| 342 bool rv = gpu_memory_buffer->Map(&data); | 345 bool rv = gpu_memory_buffer->Map(&data); |
| 343 DCHECK(rv); | 346 DCHECK(rv); |
| 344 int stride; | 347 int stride; |
| 345 gpu_memory_buffer->GetStride(&stride); | 348 gpu_memory_buffer->GetStride(&stride); |
| 346 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. | 349 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. |
| 347 DCHECK_GE(stride, 0); | 350 DCHECK_GE(stride, 0); |
| 348 | 351 |
| 349 gfx::Rect playback_rect = raster_full_rect; | 352 gfx::Rect playback_rect = raster_full_rect; |
| 350 if (reusing_raster_resource) { | 353 if (reusing_raster_resource) { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 "pending_copy_count", | 586 "pending_copy_count", |
| 584 static_cast<int>(resource_pool_->total_resource_count() - | 587 static_cast<int>(resource_pool_->total_resource_count() - |
| 585 resource_pool_->acquired_resource_count())); | 588 resource_pool_->acquired_resource_count())); |
| 586 staging_state->SetInteger( | 589 staging_state->SetInteger( |
| 587 "bytes_pending_copy", | 590 "bytes_pending_copy", |
| 588 static_cast<int>(resource_pool_->total_memory_usage_bytes() - | 591 static_cast<int>(resource_pool_->total_memory_usage_bytes() - |
| 589 resource_pool_->acquired_memory_usage_bytes())); | 592 resource_pool_->acquired_memory_usage_bytes())); |
| 590 } | 593 } |
| 591 | 594 |
| 592 } // namespace cc | 595 } // namespace cc |
| OLD | NEW |