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 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 DCHECK(resource->gl_id); | 1583 DCHECK(resource->gl_id); |
1584 DCHECK(resource->allocated); | 1584 DCHECK(resource->allocated); |
1585 // Avoid crashing in release builds if GpuMemoryBuffer allocation fails. | 1585 // Avoid crashing in release builds if GpuMemoryBuffer allocation fails. |
1586 // http://crbug.com/554541 | 1586 // http://crbug.com/554541 |
1587 if (!resource->gpu_memory_buffer) | 1587 if (!resource->gpu_memory_buffer) |
1588 return; | 1588 return; |
1589 if (!resource->image_id) { | 1589 if (!resource->image_id) { |
1590 GLES2Interface* gl = ContextGL(); | 1590 GLES2Interface* gl = ContextGL(); |
1591 DCHECK(gl); | 1591 DCHECK(gl); |
1592 | 1592 |
1593 #if defined(OS_CHROMEOS) | 1593 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
1594 // TODO(reveman): GL_COMMANDS_ISSUED_CHROMIUM is used for synchronization | 1594 // TODO(reveman): This avoids a performance problem on ARM ChromeOS |
1595 // on ChromeOS to avoid some performance issues. This only works with | 1595 // devices. This only works with shared memory backed buffers. |
1596 // shared memory backed buffers. crbug.com/436314 | 1596 // crbug.com/580166 |
1597 DCHECK_EQ(resource->gpu_memory_buffer->GetHandle().type, | 1597 DCHECK_EQ(resource->gpu_memory_buffer->GetHandle().type, |
1598 gfx::SHARED_MEMORY_BUFFER); | 1598 gfx::SHARED_MEMORY_BUFFER); |
1599 #endif | 1599 #endif |
1600 resource->image_id = gl->CreateImageCHROMIUM( | 1600 resource->image_id = gl->CreateImageCHROMIUM( |
1601 resource->gpu_memory_buffer->AsClientBuffer(), resource->size.width(), | 1601 resource->gpu_memory_buffer->AsClientBuffer(), resource->size.width(), |
1602 resource->size.height(), GLInternalFormat(resource->format)); | 1602 resource->size.height(), GLInternalFormat(resource->format)); |
1603 } | 1603 } |
1604 } | 1604 } |
1605 | 1605 |
1606 void ResourceProvider::BindImageForSampling(Resource* resource) { | 1606 void ResourceProvider::BindImageForSampling(Resource* resource) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 | 1733 |
1734 const int kImportance = 2; | 1734 const int kImportance = 2; |
1735 pmd->CreateSharedGlobalAllocatorDump(guid); | 1735 pmd->CreateSharedGlobalAllocatorDump(guid); |
1736 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1736 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
1737 } | 1737 } |
1738 | 1738 |
1739 return true; | 1739 return true; |
1740 } | 1740 } |
1741 | 1741 |
1742 } // namespace cc | 1742 } // namespace cc |
OLD | NEW |