| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 resource->read_lock_fences_enabled = true; | 1311 resource->read_lock_fences_enabled = true; |
| 1312 } | 1312 } |
| 1313 resource->SetSynchronized(); | 1313 resource->SetSynchronized(); |
| 1314 resource_provider_->UnlockForWrite(resource); | 1314 resource_provider_->UnlockForWrite(resource); |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 gfx::GpuMemoryBuffer* | 1317 gfx::GpuMemoryBuffer* |
| 1318 ResourceProvider::ScopedWriteLockGpuMemoryBuffer::GetGpuMemoryBuffer() { | 1318 ResourceProvider::ScopedWriteLockGpuMemoryBuffer::GetGpuMemoryBuffer() { |
| 1319 if (!gpu_memory_buffer_) { | 1319 if (!gpu_memory_buffer_) { |
| 1320 gpu_memory_buffer_ = | 1320 gpu_memory_buffer_ = |
| 1321 resource_provider_->gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( | 1321 resource_provider_->gpu_memory_buffer_manager_->CreateGpuMemoryBuffer( |
| 1322 size_, BufferFormat(format_), usage_, gpu::kNullSurfaceHandle); | 1322 size_, BufferFormat(format_), usage_, gpu::kNullSurfaceHandle); |
| 1323 } | 1323 } |
| 1324 return gpu_memory_buffer_.get(); | 1324 return gpu_memory_buffer_.get(); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 ResourceProvider::SynchronousFence::SynchronousFence( | 1327 ResourceProvider::SynchronousFence::SynchronousFence( |
| 1328 gpu::gles2::GLES2Interface* gl) | 1328 gpu::gles2::GLES2Interface* gl) |
| 1329 : gl_(gl), has_synchronized_(true) {} | 1329 : gl_(gl), has_synchronized_(true) {} |
| 1330 | 1330 |
| 1331 ResourceProvider::SynchronousFence::~SynchronousFence() {} | 1331 ResourceProvider::SynchronousFence::~SynchronousFence() {} |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1869 LazyCreate(resource); | 1869 LazyCreate(resource); |
| 1870 if (!resource->gl_id) | 1870 if (!resource->gl_id) |
| 1871 return; | 1871 return; |
| 1872 resource->allocated = true; | 1872 resource->allocated = true; |
| 1873 GLES2Interface* gl = ContextGL(); | 1873 GLES2Interface* gl = ContextGL(); |
| 1874 gfx::Size& size = resource->size; | 1874 gfx::Size& size = resource->size; |
| 1875 ResourceFormat format = resource->format; | 1875 ResourceFormat format = resource->format; |
| 1876 gl->BindTexture(resource->target, resource->gl_id); | 1876 gl->BindTexture(resource->target, resource->gl_id); |
| 1877 if (resource->type == RESOURCE_TYPE_GPU_MEMORY_BUFFER) { | 1877 if (resource->type == RESOURCE_TYPE_GPU_MEMORY_BUFFER) { |
| 1878 resource->gpu_memory_buffer = | 1878 resource->gpu_memory_buffer = |
| 1879 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( | 1879 gpu_memory_buffer_manager_->CreateGpuMemoryBuffer( |
| 1880 size, BufferFormat(format), resource->usage, | 1880 size, BufferFormat(format), resource->usage, |
| 1881 gpu::kNullSurfaceHandle); | 1881 gpu::kNullSurfaceHandle); |
| 1882 if (resource->gpu_memory_buffer && enable_color_correct_rendering_) { | 1882 if (resource->gpu_memory_buffer && enable_color_correct_rendering_) { |
| 1883 resource->gpu_memory_buffer->SetColorSpaceForScanout( | 1883 resource->gpu_memory_buffer->SetColorSpaceForScanout( |
| 1884 resource->color_space); | 1884 resource->color_space); |
| 1885 } | 1885 } |
| 1886 | 1886 |
| 1887 LazyCreateImage(resource); | 1887 LazyCreateImage(resource); |
| 1888 resource->dirty_image = true; | 1888 resource->dirty_image = true; |
| 1889 resource->is_overlay_candidate = true; | 1889 resource->is_overlay_candidate = true; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 | 2062 |
| 2063 const int kImportance = 2; | 2063 const int kImportance = 2; |
| 2064 pmd->CreateSharedGlobalAllocatorDump(guid); | 2064 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 2065 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 2065 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 2066 } | 2066 } |
| 2067 | 2067 |
| 2068 return true; | 2068 return true; |
| 2069 } | 2069 } |
| 2070 | 2070 |
| 2071 } // namespace cc | 2071 } // namespace cc |
| OLD | NEW |