| OLD | NEW |
| 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 "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h" | 5 #include "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h" |
| 6 | 6 |
| 7 #include "ui/gfx/client_native_pixmap.h" | 7 #include "ui/gfx/client_native_pixmap.h" |
| 8 #include "ui/gfx/native_pixmap.h" | 8 #include "ui/gfx/native_pixmap.h" |
| 9 #include "ui/gl/gl_image_native_pixmap.h" | 9 #include "ui/gl/gl_image_native_pixmap.h" |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 void GpuMemoryBufferFactoryNativePixmap::DestroyGpuMemoryBuffer( | 62 void GpuMemoryBufferFactoryNativePixmap::DestroyGpuMemoryBuffer( |
| 63 gfx::GpuMemoryBufferId id, | 63 gfx::GpuMemoryBufferId id, |
| 64 int client_id) { | 64 int client_id) { |
| 65 base::AutoLock lock(native_pixmaps_lock_); | 65 base::AutoLock lock(native_pixmaps_lock_); |
| 66 NativePixmapMapKey key(id.id, client_id); | 66 NativePixmapMapKey key(id.id, client_id); |
| 67 native_pixmaps_.erase(key); | 67 native_pixmaps_.erase(key); |
| 68 } | 68 } |
| 69 | 69 |
| 70 gfx::GpuMemoryBufferAttribVector GpuMemoryBufferFactoryNativePixmap:: |
| 71 GetGpuMemoryBufferAttribsForUsage(gfx::BufferUsage usage) { |
| 72 switch (usage) { |
| 73 case gfx::BufferUsage::SCANOUT: |
| 74 case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE: |
| 75 return ui::OzonePlatform::GetInstance() |
| 76 ->GetSurfaceFactoryOzone() |
| 77 ->GetScanoutFormatsWithModifiers(gfx::kNullAcceleratedWidget); |
| 78 case gfx::BufferUsage::GPU_READ: |
| 79 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
| 80 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: |
| 81 return gl::GLImageNativePixmap::QueryDmaBufFormatsAndModifiers(); |
| 82 default: |
| 83 return gfx::GpuMemoryBufferAttribVector(); |
| 84 } |
| 85 } |
| 86 |
| 70 ImageFactory* GpuMemoryBufferFactoryNativePixmap::AsImageFactory() { | 87 ImageFactory* GpuMemoryBufferFactoryNativePixmap::AsImageFactory() { |
| 71 return this; | 88 return this; |
| 72 } | 89 } |
| 73 | 90 |
| 74 scoped_refptr<gl::GLImage> | 91 scoped_refptr<gl::GLImage> |
| 75 GpuMemoryBufferFactoryNativePixmap::CreateImageForGpuMemoryBuffer( | 92 GpuMemoryBufferFactoryNativePixmap::CreateImageForGpuMemoryBuffer( |
| 76 const gfx::GpuMemoryBufferHandle& handle, | 93 const gfx::GpuMemoryBufferHandle& handle, |
| 77 const gfx::Size& size, | 94 const gfx::Size& size, |
| 78 gfx::BufferFormat format, | 95 gfx::BufferFormat format, |
| 79 unsigned internalformat, | 96 unsigned internalformat, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return nullptr; | 171 return nullptr; |
| 155 } | 172 } |
| 156 return image; | 173 return image; |
| 157 } | 174 } |
| 158 | 175 |
| 159 unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() { | 176 unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() { |
| 160 return GL_TEXTURE_EXTERNAL_OES; | 177 return GL_TEXTURE_EXTERNAL_OES; |
| 161 } | 178 } |
| 162 | 179 |
| 163 } // namespace gpu | 180 } // namespace gpu |
| OLD | NEW |