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" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 gfx::Rect playback_rect = raster_full_rect; | 400 gfx::Rect playback_rect = raster_full_rect; |
401 if (use_partial_raster_ && previous_content_id) { | 401 if (use_partial_raster_ && previous_content_id) { |
402 // Reduce playback rect to dirty region if the content id of the staging | 402 // Reduce playback rect to dirty region if the content id of the staging |
403 // buffer matches the prevous content id. | 403 // buffer matches the prevous content id. |
404 if (previous_content_id == staging_buffer->content_id) | 404 if (previous_content_id == staging_buffer->content_id) |
405 playback_rect.Intersect(raster_dirty_rect); | 405 playback_rect.Intersect(raster_dirty_rect); |
406 } | 406 } |
407 | 407 |
408 if (staging_buffer->gpu_memory_buffer) { | 408 if (staging_buffer->gpu_memory_buffer) { |
409 void* data = nullptr; | 409 gfx::GpuMemoryBuffer* buffer = staging_buffer->gpu_memory_buffer.get(); |
410 bool rv = staging_buffer->gpu_memory_buffer->Map(&data); | 410 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat())); |
| 411 bool rv = buffer->Map(); |
411 DCHECK(rv); | 412 DCHECK(rv); |
412 int stride; | 413 DCHECK(buffer->memory(0)); |
413 staging_buffer->gpu_memory_buffer->GetStride(&stride); | |
414 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. | 414 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. |
415 DCHECK_GE(stride, 0); | 415 DCHECK_GE(buffer->stride(0), 0); |
416 | 416 |
417 DCHECK(!playback_rect.IsEmpty()) | 417 DCHECK(!playback_rect.IsEmpty()) |
418 << "Why are we rastering a tile that's not dirty?"; | 418 << "Why are we rastering a tile that's not dirty?"; |
419 TileTaskWorkerPool::PlaybackToMemory( | 419 TileTaskWorkerPool::PlaybackToMemory( |
420 data, resource->format(), staging_buffer->size, | 420 buffer->memory(0), resource->format(), staging_buffer->size, |
421 static_cast<size_t>(stride), raster_source, raster_full_rect, | 421 buffer->stride(0), raster_source, raster_full_rect, playback_rect, |
422 playback_rect, scale, include_images); | 422 scale, include_images); |
423 staging_buffer->gpu_memory_buffer->Unmap(); | 423 buffer->Unmap(); |
424 staging_buffer->content_id = new_content_id; | 424 staging_buffer->content_id = new_content_id; |
425 } | 425 } |
426 } | 426 } |
427 | 427 |
428 ContextProvider* context_provider = | 428 ContextProvider* context_provider = |
429 resource_provider_->output_surface()->worker_context_provider(); | 429 resource_provider_->output_surface()->worker_context_provider(); |
430 DCHECK(context_provider); | 430 DCHECK(context_provider); |
431 | 431 |
432 { | 432 { |
433 ContextProvider::ScopedContextLock scoped_context(context_provider); | 433 ContextProvider::ScopedContextLock scoped_context(context_provider); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 811 |
812 staging_state->SetInteger("staging_buffer_count", | 812 staging_state->SetInteger("staging_buffer_count", |
813 static_cast<int>(buffers_.size())); | 813 static_cast<int>(buffers_.size())); |
814 staging_state->SetInteger("busy_count", | 814 staging_state->SetInteger("busy_count", |
815 static_cast<int>(busy_buffers_.size())); | 815 static_cast<int>(busy_buffers_.size())); |
816 staging_state->SetInteger("free_count", | 816 staging_state->SetInteger("free_count", |
817 static_cast<int>(free_buffers_.size())); | 817 static_cast<int>(free_buffers_.size())); |
818 } | 818 } |
819 | 819 |
820 } // namespace cc | 820 } // namespace cc |
OLD | NEW |