OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/gfx/linux/client_native_pixmap_factory_dmabuf.h" | 5 #include "ui/gfx/linux/client_native_pixmap_factory_dmabuf.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // ClientNativePixmapFactory: | 52 // ClientNativePixmapFactory: |
53 bool IsConfigurationSupported(gfx::BufferFormat format, | 53 bool IsConfigurationSupported(gfx::BufferFormat format, |
54 gfx::BufferUsage usage) const override { | 54 gfx::BufferUsage usage) const override { |
55 switch (usage) { | 55 switch (usage) { |
56 case gfx::BufferUsage::GPU_READ: | 56 case gfx::BufferUsage::GPU_READ: |
57 return format == gfx::BufferFormat::BGR_565 || | 57 return format == gfx::BufferFormat::BGR_565 || |
58 format == gfx::BufferFormat::RGBA_8888 || | 58 format == gfx::BufferFormat::RGBA_8888 || |
59 format == gfx::BufferFormat::RGBX_8888 || | 59 format == gfx::BufferFormat::RGBX_8888 || |
60 format == gfx::BufferFormat::BGRA_8888 || | 60 format == gfx::BufferFormat::BGRA_8888 || |
61 format == gfx::BufferFormat::BGRX_8888 || | 61 format == gfx::BufferFormat::BGRX_8888 || |
| 62 // TODO(dshwang): add YUV_420_BIPLANAR to SCANOUT when cros |
| 63 // kernel supports NV12 overlay. crbug.com/683347 |
| 64 format == gfx::BufferFormat::YUV_420_BIPLANAR || |
62 format == gfx::BufferFormat::YVU_420; | 65 format == gfx::BufferFormat::YVU_420; |
63 case gfx::BufferUsage::SCANOUT: | 66 case gfx::BufferUsage::SCANOUT: |
64 return format == gfx::BufferFormat::BGRX_8888 || | 67 return format == gfx::BufferFormat::BGRX_8888 || |
65 format == gfx::BufferFormat::RGBX_8888; | 68 format == gfx::BufferFormat::RGBX_8888; |
66 case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE: | 69 case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE: |
67 return format == gfx::BufferFormat::BGRX_8888 || | 70 return format == gfx::BufferFormat::BGRX_8888 || |
68 format == gfx::BufferFormat::BGRA_8888 || | 71 format == gfx::BufferFormat::BGRA_8888 || |
69 format == gfx::BufferFormat::RGBX_8888 || | 72 format == gfx::BufferFormat::RGBX_8888 || |
70 format == gfx::BufferFormat::RGBA_8888; | 73 format == gfx::BufferFormat::RGBA_8888; |
71 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: | 74 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
72 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: { | 75 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: { |
73 #if defined(OS_CHROMEOS) | 76 #if defined(OS_CHROMEOS) |
74 return | 77 return |
75 #if defined(ARCH_CPU_X86_FAMILY) | 78 #if defined(ARCH_CPU_X86_FAMILY) |
76 // Currently only Intel driver (i.e. minigbm and Mesa) supports R_8 | 79 // Currently only Intel driver (i.e. minigbm and Mesa) supports R_8 |
77 // and RG_88. crbug.com/356871 | 80 // and RG_88. crbug.com/356871 |
78 format == gfx::BufferFormat::R_8 || | 81 format == gfx::BufferFormat::R_8 || |
79 format == gfx::BufferFormat::RG_88 || | 82 format == gfx::BufferFormat::RG_88 || |
80 #endif | 83 #endif |
| 84 format == gfx::BufferFormat::YUV_420_BIPLANAR || |
81 format == gfx::BufferFormat::BGRA_8888; | 85 format == gfx::BufferFormat::BGRA_8888; |
82 #else | 86 #else |
83 return false; | 87 return false; |
84 #endif | 88 #endif |
85 } | 89 } |
86 } | 90 } |
87 NOTREACHED(); | 91 NOTREACHED(); |
88 return false; | 92 return false; |
89 } | 93 } |
90 std::unique_ptr<ClientNativePixmap> ImportFromHandle( | 94 std::unique_ptr<ClientNativePixmap> ImportFromHandle( |
(...skipping 23 matching lines...) Expand all Loading... |
114 } | 118 } |
115 | 119 |
116 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryDmabuf); | 120 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryDmabuf); |
117 }; | 121 }; |
118 | 122 |
119 ClientNativePixmapFactory* CreateClientNativePixmapFactoryDmabuf() { | 123 ClientNativePixmapFactory* CreateClientNativePixmapFactoryDmabuf() { |
120 return new ClientNativePixmapFactoryDmabuf(); | 124 return new ClientNativePixmapFactoryDmabuf(); |
121 } | 125 } |
122 | 126 |
123 } // namespace gfx | 127 } // namespace gfx |
OLD | NEW |