| Index: cc/raster/one_copy_tile_task_worker_pool.cc | 
| diff --git a/cc/raster/one_copy_tile_task_worker_pool.cc b/cc/raster/one_copy_tile_task_worker_pool.cc | 
| index c5518e3cd88d5a1e348f22dbce8d6c5cfb70d304..0a03fbad47ec742261db4c0a5bc3efd78b056759 100644 | 
| --- a/cc/raster/one_copy_tile_task_worker_pool.cc | 
| +++ b/cc/raster/one_copy_tile_task_worker_pool.cc | 
| @@ -326,12 +326,16 @@ void OneCopyTileTaskWorkerPool::CheckForCompletedTasks() { | 
| completed_tasks_.clear(); | 
| } | 
|  | 
| -ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat() const { | 
| -  return resource_provider_->memory_efficient_texture_format(); | 
| +ResourceFormat OneCopyTileTaskWorkerPool::GetResourceFormat( | 
| +    bool must_support_alpha) const { | 
| +  return resource_provider_->memory_efficient_texture_format( | 
| +      must_support_alpha); | 
| } | 
|  | 
| -bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle() const { | 
| -  return !PlatformColor::SameComponentOrder(GetResourceFormat()); | 
| +bool OneCopyTileTaskWorkerPool::GetResourceRequiresSwizzle( | 
| +    bool must_support_alpha) const { | 
| +  return !PlatformColor::SameComponentOrder( | 
| +      GetResourceFormat(must_support_alpha)); | 
| } | 
|  | 
| scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster( | 
| @@ -340,12 +344,9 @@ scoped_ptr<RasterBuffer> OneCopyTileTaskWorkerPool::AcquireBufferForRaster( | 
| uint64_t previous_content_id) { | 
| // TODO(danakj): If resource_content_id != 0, we only need to copy/upload | 
| // the dirty rect. | 
| -  DCHECK_EQ(resource->format(), | 
| -            resource_provider_->memory_efficient_texture_format()); | 
| -  return make_scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 
| -      this, resource_provider_, | 
| -      resource_provider_->memory_efficient_texture_format(), resource, | 
| -      previous_content_id)); | 
| +  return make_scoped_ptr<RasterBuffer>( | 
| +      new RasterBufferImpl(this, resource_provider_, resource->format(), | 
| +                           resource, previous_content_id)); | 
| } | 
|  | 
| void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster( | 
| @@ -376,13 +377,11 @@ void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( | 
| if (!staging_buffer->gpu_memory_buffer) { | 
| staging_buffer->gpu_memory_buffer = | 
| resource_provider_->gpu_memory_buffer_manager() | 
| -              ->AllocateGpuMemoryBuffer( | 
| -                  staging_buffer->size, | 
| -                  BufferFormat( | 
| -                      resource_provider_->memory_efficient_texture_format()), | 
| -                  use_persistent_gpu_memory_buffers_ | 
| -                      ? gfx::BufferUsage::PERSISTENT_MAP | 
| -                      : gfx::BufferUsage::MAP); | 
| +              ->AllocateGpuMemoryBuffer(staging_buffer->size, | 
| +                                        BufferFormat(resource->format()), | 
| +                                        use_persistent_gpu_memory_buffers_ | 
| +                                            ? gfx::BufferUsage::PERSISTENT_MAP | 
| +                                            : gfx::BufferUsage::MAP); | 
| DCHECK_EQ(gfx::NumberOfPlanesForBufferFormat( | 
| staging_buffer->gpu_memory_buffer->GetFormat()), | 
| 1u); | 
| @@ -408,9 +407,9 @@ void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( | 
| DCHECK(!playback_rect.IsEmpty()) | 
| << "Why are we rastering a tile that's not dirty?"; | 
| TileTaskWorkerPool::PlaybackToMemory( | 
| -          data, resource_provider_->memory_efficient_texture_format(), | 
| -          staging_buffer->size, static_cast<size_t>(stride), raster_source, | 
| -          raster_full_rect, playback_rect, scale, include_images); | 
| +          data, resource->format(), staging_buffer->size, | 
| +          static_cast<size_t>(stride), raster_source, raster_full_rect, | 
| +          playback_rect, scale, include_images); | 
| staging_buffer->gpu_memory_buffer->Unmap(); | 
| staging_buffer->content_id = new_content_id; | 
| } | 
| @@ -426,8 +425,8 @@ void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( | 
| gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); | 
| DCHECK(gl); | 
|  | 
| -    unsigned image_target = resource_provider_->GetImageTextureTarget( | 
| -        resource_provider_->memory_efficient_texture_format()); | 
| +    unsigned image_target = | 
| +        resource_provider_->GetImageTextureTarget(resource->format()); | 
|  | 
| // Create and bind staging texture. | 
| if (!staging_buffer->texture_id) { | 
| @@ -447,8 +446,7 @@ void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( | 
| staging_buffer->image_id = gl->CreateImageCHROMIUM( | 
| staging_buffer->gpu_memory_buffer->AsClientBuffer(), | 
| staging_buffer->size.width(), staging_buffer->size.height(), | 
| -            GLInternalFormat( | 
| -                resource_provider_->memory_efficient_texture_format())); | 
| +            GLInternalFormat(resource->format())); | 
| gl->BindTexImage2DCHROMIUM(image_target, staging_buffer->image_id); | 
| } | 
| } else { | 
| @@ -475,9 +473,7 @@ void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( | 
| } | 
|  | 
| int bytes_per_row = | 
| -        (BitsPerPixel(resource_provider_->memory_efficient_texture_format()) * | 
| -         resource->size().width()) / | 
| -        8; | 
| +        (BitsPerPixel(resource->format()) * resource->size().width()) / 8; | 
| int chunk_size_in_rows = | 
| std::max(1, max_bytes_per_copy_operation_ / bytes_per_row); | 
| // Align chunk size to 4. Required to support compressed texture formats. | 
| @@ -529,24 +525,25 @@ bool OneCopyTileTaskWorkerPool::OnMemoryDump( | 
| base::AutoLock lock(lock_); | 
|  | 
| for (const auto& buffer : buffers_) { | 
| -    buffer->OnMemoryDump(pmd, | 
| -                         resource_provider_->memory_efficient_texture_format(), | 
| -                         std::find(free_buffers_.begin(), free_buffers_.end(), | 
| -                                   buffer) != free_buffers_.end()); | 
| +    buffer->OnMemoryDump( | 
| +        pmd, | 
| +        BufferFormatToResourceFormat(buffer->gpu_memory_buffer->GetFormat()), | 
| +        std::find(free_buffers_.begin(), free_buffers_.end(), buffer) != | 
| +            free_buffers_.end()); | 
| } | 
|  | 
| return true; | 
| } | 
|  | 
| void OneCopyTileTaskWorkerPool::AddStagingBuffer( | 
| -    const StagingBuffer* staging_buffer) { | 
| +    const StagingBuffer* staging_buffer, | 
| +    ResourceFormat format) { | 
| lock_.AssertAcquired(); | 
|  | 
| DCHECK(buffers_.find(staging_buffer) == buffers_.end()); | 
| buffers_.insert(staging_buffer); | 
| -  int buffer_usage_in_bytes = ResourceUtil::UncheckedSizeInBytes<int>( | 
| -      staging_buffer->size, | 
| -      resource_provider_->memory_efficient_texture_format()); | 
| +  int buffer_usage_in_bytes = | 
| +      ResourceUtil::UncheckedSizeInBytes<int>(staging_buffer->size, format); | 
| staging_buffer_usage_in_bytes_ += buffer_usage_in_bytes; | 
| } | 
|  | 
| @@ -558,7 +555,8 @@ void OneCopyTileTaskWorkerPool::RemoveStagingBuffer( | 
| buffers_.erase(staging_buffer); | 
| int buffer_usage_in_bytes = ResourceUtil::UncheckedSizeInBytes<int>( | 
| staging_buffer->size, | 
| -      resource_provider_->memory_efficient_texture_format()); | 
| +      BufferFormatToResourceFormat( | 
| +          staging_buffer->gpu_memory_buffer->GetFormat())); | 
| DCHECK_GE(staging_buffer_usage_in_bytes_, buffer_usage_in_bytes); | 
| staging_buffer_usage_in_bytes_ -= buffer_usage_in_bytes; | 
| } | 
| @@ -569,7 +567,8 @@ void OneCopyTileTaskWorkerPool::MarkStagingBufferAsFree( | 
|  | 
| int buffer_usage_in_bytes = ResourceUtil::UncheckedSizeInBytes<int>( | 
| staging_buffer->size, | 
| -      resource_provider_->memory_efficient_texture_format()); | 
| +      BufferFormatToResourceFormat( | 
| +          staging_buffer->gpu_memory_buffer->GetFormat())); | 
| free_staging_buffer_usage_in_bytes_ += buffer_usage_in_bytes; | 
| } | 
|  | 
| @@ -579,7 +578,8 @@ void OneCopyTileTaskWorkerPool::MarkStagingBufferAsBusy( | 
|  | 
| int buffer_usage_in_bytes = ResourceUtil::UncheckedSizeInBytes<int>( | 
| staging_buffer->size, | 
| -      resource_provider_->memory_efficient_texture_format()); | 
| +      BufferFormatToResourceFormat( | 
| +          staging_buffer->gpu_memory_buffer->GetFormat())); | 
| DCHECK_GE(free_staging_buffer_usage_in_bytes_, buffer_usage_in_bytes); | 
| free_staging_buffer_usage_in_bytes_ -= buffer_usage_in_bytes; | 
| } | 
| @@ -647,12 +647,15 @@ OneCopyTileTaskWorkerPool::AcquireStagingBuffer(const Resource* resource, | 
| } | 
| } | 
|  | 
| -  // Find staging buffer of correct size. | 
| +  // Find staging buffer of correct size and format. | 
| if (!staging_buffer) { | 
| StagingBufferDeque::iterator it = | 
| std::find_if(free_buffers_.begin(), free_buffers_.end(), | 
| [resource](const StagingBuffer* buffer) { | 
| -                       return buffer->size == resource->size(); | 
| +                       return buffer->size == resource->size() && | 
| +                              BufferFormatToResourceFormat( | 
| +                                  buffer->gpu_memory_buffer->GetFormat()) == | 
| +                                  resource->format(); | 
| }); | 
| if (it != free_buffers_.end()) { | 
| staging_buffer = free_buffers_.take(it); | 
| @@ -663,7 +666,7 @@ OneCopyTileTaskWorkerPool::AcquireStagingBuffer(const Resource* resource, | 
| // Create new staging buffer if necessary. | 
| if (!staging_buffer) { | 
| staging_buffer = make_scoped_ptr(new StagingBuffer(resource->size())); | 
| -    AddStagingBuffer(staging_buffer.get()); | 
| +    AddStagingBuffer(staging_buffer.get(), resource->format()); | 
| } | 
|  | 
| // Release enough free buffers to stay within the limit. | 
|  |