| 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 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 DCHECK(resource->gl_id); | 1905 DCHECK(resource->gl_id); |
| 1906 DCHECK(resource->allocated); | 1906 DCHECK(resource->allocated); |
| 1907 // Avoid crashing in release builds if GpuMemoryBuffer allocation fails. | 1907 // Avoid crashing in release builds if GpuMemoryBuffer allocation fails. |
| 1908 // http://crbug.com/554541 | 1908 // http://crbug.com/554541 |
| 1909 if (!resource->gpu_memory_buffer) | 1909 if (!resource->gpu_memory_buffer) |
| 1910 return; | 1910 return; |
| 1911 if (!resource->image_id) { | 1911 if (!resource->image_id) { |
| 1912 GLES2Interface* gl = ContextGL(); | 1912 GLES2Interface* gl = ContextGL(); |
| 1913 DCHECK(gl); | 1913 DCHECK(gl); |
| 1914 | 1914 |
| 1915 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) | |
| 1916 // TODO(reveman): This avoids a performance problem on ARM ChromeOS | |
| 1917 // devices. This only works with shared memory backed buffers. | |
| 1918 // crbug.com/580166 | |
| 1919 DCHECK_EQ(resource->gpu_memory_buffer->GetHandle().type, | |
| 1920 gfx::SHARED_MEMORY_BUFFER); | |
| 1921 #endif | |
| 1922 resource->image_id = gl->CreateImageCHROMIUM( | 1915 resource->image_id = gl->CreateImageCHROMIUM( |
| 1923 resource->gpu_memory_buffer->AsClientBuffer(), resource->size.width(), | 1916 resource->gpu_memory_buffer->AsClientBuffer(), resource->size.width(), |
| 1924 resource->size.height(), GLInternalFormat(resource->format)); | 1917 resource->size.height(), GLInternalFormat(resource->format)); |
| 1925 DCHECK(resource->image_id || IsGLContextLost()); | 1918 DCHECK(resource->image_id || IsGLContextLost()); |
| 1926 | 1919 |
| 1927 resource->SetLocallyUsed(); | 1920 resource->SetLocallyUsed(); |
| 1928 } | 1921 } |
| 1929 } | 1922 } |
| 1930 | 1923 |
| 1931 void ResourceProvider::BindImageForSampling(Resource* resource) { | 1924 void ResourceProvider::BindImageForSampling(Resource* resource) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 | 2048 |
| 2056 const int kImportance = 2; | 2049 const int kImportance = 2; |
| 2057 pmd->CreateSharedGlobalAllocatorDump(guid); | 2050 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 2058 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 2051 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 2059 } | 2052 } |
| 2060 | 2053 |
| 2061 return true; | 2054 return true; |
| 2062 } | 2055 } |
| 2063 | 2056 |
| 2064 } // namespace cc | 2057 } // namespace cc |
| OLD | NEW |