Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: cc/raster/one_copy_tile_task_worker_pool.cc

Issue 1197423003: Remaining code for basic tile compression functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable tile compression for one copy Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 task->WillComplete(); 290 task->WillComplete();
291 task->CompleteOnOriginThread(this); 291 task->CompleteOnOriginThread(this);
292 task->DidComplete(); 292 task->DidComplete();
293 293
294 task->RunReplyOnOriginThread(); 294 task->RunReplyOnOriginThread();
295 } 295 }
296 completed_tasks_.clear(); 296 completed_tasks_.clear();
297 } 297 }
298 298
299 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat() const { 299 ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat(
300 return resource_provider_->best_texture_format(); 300 bool must_be_noncompressed,
301 bool must_support_alpha) const {
302 return resource_provider_->memory_efficient_texture_format(
303 must_be_noncompressed, must_support_alpha);
301 } 304 }
302 305
303 bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle() const { 306 bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle(
304 return !PlatformColor::SameComponentOrder(GetResourceFormat()); 307 bool must_be_noncompressed,
308 bool must_support_alpha) const {
309 return !PlatformColor::SameComponentOrder(
310 GetResourceFormat(must_be_noncompressed, must_support_alpha));
305 } 311 }
306 312
307 scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster( 313 scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster(
308 const Resource* resource, 314 const Resource* resource,
309 uint64_t resource_content_id, 315 uint64_t resource_content_id,
310 uint64_t previous_content_id) { 316 uint64_t previous_content_id) {
311 // TODO(danakj): If resource_content_id != 0, we only need to copy/upload 317 // TODO(danakj): If resource_content_id != 0, we only need to copy/upload
312 // the dirty rect. 318 // the dirty rect.
313 DCHECK_EQ(resource->format(), resource_provider_->best_texture_format());
314 return make_scoped_ptr<RasterBuffer>( 319 return make_scoped_ptr<RasterBuffer>(
315 new RasterBufferImpl(this, resource_provider_, resource_pool_, 320 new RasterBufferImpl(this, resource_provider_, resource_pool_,
316 resource_provider_->best_texture_format(), resource, 321 resource->format(), resource, previous_content_id));
317 previous_content_id));
318 } 322 }
319 323
320 void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster( 324 void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster(
321 scoped_ptr<RasterBuffer> buffer) { 325 scoped_ptr<RasterBuffer> buffer) {
322 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. 326 // Nothing to do here. RasterBufferImpl destructor cleans up after itself.
323 } 327 }
324 328
325 CopySequenceNumber 329 CopySequenceNumber
326 OneCopyTileTaskWorkerPool::PlaybackAndScheduleCopyOnWorkerThread( 330 OneCopyTileTaskWorkerPool::PlaybackAndScheduleCopyOnWorkerThread(
327 bool reusing_raster_resource, 331 bool reusing_raster_resource,
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 "pending_copy_count", 585 "pending_copy_count",
582 static_cast<int>(resource_pool_->total_resource_count() - 586 static_cast<int>(resource_pool_->total_resource_count() -
583 resource_pool_->acquired_resource_count())); 587 resource_pool_->acquired_resource_count()));
584 staging_state->SetInteger( 588 staging_state->SetInteger(
585 "bytes_pending_copy", 589 "bytes_pending_copy",
586 static_cast<int>(resource_pool_->total_memory_usage_bytes() - 590 static_cast<int>(resource_pool_->total_memory_usage_bytes() -
587 resource_pool_->acquired_memory_usage_bytes())); 591 resource_pool_->acquired_memory_usage_bytes()));
588 } 592 }
589 593
590 } // namespace cc 594 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698