Chromium Code Reviews

Side by Side Diff: ui/gl/gl_image_ozone_native_pixmap.cc

Issue 1483633002: ozone: support gfx::BufferFormat::RGBX_8888 as a native pixmap format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gl_image_ozone_native_pixmap also, which gl_unittests check Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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>(a)) | (static_cast<uint32>(b) << 8) | \ 8 ((static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \
9 (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24)) 9 (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24))
10 10
11 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') 11 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4')
12 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4') 12 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4')
13 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') 13 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4')
14 #define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4')
14 15
15 namespace gfx { 16 namespace gfx {
16 namespace { 17 namespace {
17 18
18 bool ValidInternalFormat(unsigned internalformat) { 19 bool ValidInternalFormat(unsigned internalformat) {
19 switch (internalformat) { 20 switch (internalformat) {
20 case GL_RGB: 21 case GL_RGB:
21 case GL_RGBA: 22 case GL_RGBA:
22 case GL_BGRA_EXT: 23 case GL_BGRA_EXT:
23 return true; 24 return true;
24 default: 25 default:
25 return false; 26 return false;
26 } 27 }
27 } 28 }
28 29
29 bool ValidFormat(BufferFormat format) { 30 bool ValidFormat(BufferFormat format) {
30 switch (format) { 31 switch (format) {
31 case BufferFormat::RGBA_8888: 32 case BufferFormat::RGBA_8888:
33 case BufferFormat::RGBX_8888:
32 case BufferFormat::BGRA_8888: 34 case BufferFormat::BGRA_8888:
33 case BufferFormat::BGRX_8888: 35 case BufferFormat::BGRX_8888:
34 return true; 36 return true;
35 case BufferFormat::ATC: 37 case BufferFormat::ATC:
36 case BufferFormat::ATCIA: 38 case BufferFormat::ATCIA:
37 case BufferFormat::DXT1: 39 case BufferFormat::DXT1:
38 case BufferFormat::DXT5: 40 case BufferFormat::DXT5:
39 case BufferFormat::ETC1: 41 case BufferFormat::ETC1:
40 case BufferFormat::R_8: 42 case BufferFormat::R_8:
41 case BufferFormat::RGBA_4444: 43 case BufferFormat::RGBA_4444:
42 case BufferFormat::RGBX_8888:
43 case BufferFormat::YUV_420: 44 case BufferFormat::YUV_420:
44 case BufferFormat::YUV_420_BIPLANAR: 45 case BufferFormat::YUV_420_BIPLANAR:
45 case BufferFormat::UYVY_422: 46 case BufferFormat::UYVY_422:
46 return false; 47 return false;
47 } 48 }
48 49
49 NOTREACHED(); 50 NOTREACHED();
50 return false; 51 return false;
51 } 52 }
52 53
53 EGLint FourCC(BufferFormat format) { 54 EGLint FourCC(BufferFormat format) {
54 switch (format) { 55 switch (format) {
55 case BufferFormat::RGBA_8888: 56 case BufferFormat::RGBA_8888:
56 return DRM_FORMAT_ABGR8888; 57 return DRM_FORMAT_ABGR8888;
58 case BufferFormat::RGBX_8888:
59 return DRM_FORMAT_XBGR8888;
57 case BufferFormat::BGRA_8888: 60 case BufferFormat::BGRA_8888:
58 return DRM_FORMAT_ARGB8888; 61 return DRM_FORMAT_ARGB8888;
59 case BufferFormat::BGRX_8888: 62 case BufferFormat::BGRX_8888:
60 return DRM_FORMAT_XRGB8888; 63 return DRM_FORMAT_XRGB8888;
61 case BufferFormat::ATC: 64 case BufferFormat::ATC:
62 case BufferFormat::ATCIA: 65 case BufferFormat::ATCIA:
63 case BufferFormat::DXT1: 66 case BufferFormat::DXT1:
64 case BufferFormat::DXT5: 67 case BufferFormat::DXT5:
65 case BufferFormat::ETC1: 68 case BufferFormat::ETC1:
66 case BufferFormat::R_8: 69 case BufferFormat::R_8:
67 case BufferFormat::RGBA_4444: 70 case BufferFormat::RGBA_4444:
68 case BufferFormat::RGBX_8888:
69 case BufferFormat::YUV_420: 71 case BufferFormat::YUV_420:
70 case BufferFormat::YUV_420_BIPLANAR: 72 case BufferFormat::YUV_420_BIPLANAR:
71 case BufferFormat::UYVY_422: 73 case BufferFormat::UYVY_422:
72 NOTREACHED(); 74 NOTREACHED();
73 return 0; 75 return 0;
74 } 76 }
75 77
76 NOTREACHED(); 78 NOTREACHED();
77 return 0; 79 return 0;
78 } 80 }
(...skipping 72 matching lines...)
151 } 153 }
152 154
153 void GLImageOzoneNativePixmap::OnMemoryDump( 155 void GLImageOzoneNativePixmap::OnMemoryDump(
154 base::trace_event::ProcessMemoryDump* pmd, 156 base::trace_event::ProcessMemoryDump* pmd,
155 uint64_t process_tracing_id, 157 uint64_t process_tracing_id,
156 const std::string& dump_name) { 158 const std::string& dump_name) {
157 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 159 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914
158 } 160 }
159 161
160 } // namespace gfx 162 } // namespace gfx
OLDNEW

Powered by Google App Engine