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/gl/gl_image_ozone_native_pixmap.h" | 5 #include "ui/gl/gl_image_ozone_native_pixmap.h" |
6 | 6 |
7 #define FOURCC(a, b, c, d) \ | 7 #define FOURCC(a, b, c, d) \ |
8 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ | 8 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ |
9 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) | 9 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) |
10 | 10 |
| 11 #define DRM_FORMAT_R8 FOURCC('R', '8', ' ', ' ') |
11 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') | 12 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') |
12 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4') | 13 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4') |
13 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') | 14 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') |
14 #define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4') | 15 #define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4') |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 namespace { | 18 namespace { |
18 | 19 |
19 bool ValidInternalFormat(unsigned internalformat) { | 20 bool ValidInternalFormat(unsigned internalformat) { |
20 switch (internalformat) { | 21 switch (internalformat) { |
21 case GL_RGB: | 22 case GL_RGB: |
22 case GL_RGBA: | 23 case GL_RGBA: |
23 case GL_BGRA_EXT: | 24 case GL_BGRA_EXT: |
| 25 case GL_RED_EXT: |
24 return true; | 26 return true; |
25 default: | 27 default: |
26 return false; | 28 return false; |
27 } | 29 } |
28 } | 30 } |
29 | 31 |
30 bool ValidFormat(BufferFormat format) { | 32 bool ValidFormat(BufferFormat format) { |
31 switch (format) { | 33 switch (format) { |
| 34 case BufferFormat::R_8: |
32 case BufferFormat::RGBA_8888: | 35 case BufferFormat::RGBA_8888: |
33 case BufferFormat::RGBX_8888: | 36 case BufferFormat::RGBX_8888: |
34 case BufferFormat::BGRA_8888: | 37 case BufferFormat::BGRA_8888: |
35 case BufferFormat::BGRX_8888: | 38 case BufferFormat::BGRX_8888: |
36 return true; | 39 return true; |
37 case BufferFormat::ATC: | 40 case BufferFormat::ATC: |
38 case BufferFormat::ATCIA: | 41 case BufferFormat::ATCIA: |
39 case BufferFormat::DXT1: | 42 case BufferFormat::DXT1: |
40 case BufferFormat::DXT5: | 43 case BufferFormat::DXT5: |
41 case BufferFormat::ETC1: | 44 case BufferFormat::ETC1: |
42 case BufferFormat::R_8: | |
43 case BufferFormat::RGBA_4444: | 45 case BufferFormat::RGBA_4444: |
44 case BufferFormat::YUV_420: | 46 case BufferFormat::YUV_420: |
45 case BufferFormat::YUV_420_BIPLANAR: | 47 case BufferFormat::YUV_420_BIPLANAR: |
46 case BufferFormat::UYVY_422: | 48 case BufferFormat::UYVY_422: |
47 return false; | 49 return false; |
48 } | 50 } |
49 | 51 |
50 NOTREACHED(); | 52 NOTREACHED(); |
51 return false; | 53 return false; |
52 } | 54 } |
53 | 55 |
54 EGLint FourCC(BufferFormat format) { | 56 EGLint FourCC(BufferFormat format) { |
55 switch (format) { | 57 switch (format) { |
| 58 case BufferFormat::R_8: |
| 59 return DRM_FORMAT_R8; |
56 case BufferFormat::RGBA_8888: | 60 case BufferFormat::RGBA_8888: |
57 return DRM_FORMAT_ABGR8888; | 61 return DRM_FORMAT_ABGR8888; |
58 case BufferFormat::RGBX_8888: | 62 case BufferFormat::RGBX_8888: |
59 return DRM_FORMAT_XBGR8888; | 63 return DRM_FORMAT_XBGR8888; |
60 case BufferFormat::BGRA_8888: | 64 case BufferFormat::BGRA_8888: |
61 return DRM_FORMAT_ARGB8888; | 65 return DRM_FORMAT_ARGB8888; |
62 case BufferFormat::BGRX_8888: | 66 case BufferFormat::BGRX_8888: |
63 return DRM_FORMAT_XRGB8888; | 67 return DRM_FORMAT_XRGB8888; |
64 case BufferFormat::ATC: | 68 case BufferFormat::ATC: |
65 case BufferFormat::ATCIA: | 69 case BufferFormat::ATCIA: |
66 case BufferFormat::DXT1: | 70 case BufferFormat::DXT1: |
67 case BufferFormat::DXT5: | 71 case BufferFormat::DXT5: |
68 case BufferFormat::ETC1: | 72 case BufferFormat::ETC1: |
69 case BufferFormat::R_8: | |
70 case BufferFormat::RGBA_4444: | 73 case BufferFormat::RGBA_4444: |
71 case BufferFormat::YUV_420: | 74 case BufferFormat::YUV_420: |
72 case BufferFormat::YUV_420_BIPLANAR: | 75 case BufferFormat::YUV_420_BIPLANAR: |
73 case BufferFormat::UYVY_422: | 76 case BufferFormat::UYVY_422: |
74 NOTREACHED(); | 77 NOTREACHED(); |
75 return 0; | 78 return 0; |
76 } | 79 } |
77 | 80 |
78 NOTREACHED(); | 81 NOTREACHED(); |
79 return 0; | 82 return 0; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 169 } |
167 | 170 |
168 void GLImageOzoneNativePixmap::OnMemoryDump( | 171 void GLImageOzoneNativePixmap::OnMemoryDump( |
169 base::trace_event::ProcessMemoryDump* pmd, | 172 base::trace_event::ProcessMemoryDump* pmd, |
170 uint64_t process_tracing_id, | 173 uint64_t process_tracing_id, |
171 const std::string& dump_name) { | 174 const std::string& dump_name) { |
172 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 | 175 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 |
173 } | 176 } |
174 | 177 |
175 } // namespace gfx | 178 } // namespace gfx |
OLD | NEW |