Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

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

Issue 2360453003: Revert of Add NV12 buffer scanout support from exo to ozone. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ozone/gl/gl_image_ozone_native_pixmap.h" 5 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ui/gfx/buffer_format_util.h" 9 #include "ui/gfx/buffer_format_util.h"
10 #include "ui/gl/gl_surface_egl.h" 10 #include "ui/gl/gl_surface_egl.h"
11 11
12 #define FOURCC(a, b, c, d) \ 12 #define FOURCC(a, b, c, d) \
13 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ 13 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \
14 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) 14 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24))
15 15
16 #define DRM_FORMAT_R8 FOURCC('R', '8', ' ', ' ') 16 #define DRM_FORMAT_R8 FOURCC('R', '8', ' ', ' ')
17 #define DRM_FORMAT_RGB565 FOURCC('R', 'G', '1', '6') 17 #define DRM_FORMAT_RGB565 FOURCC('R', 'G', '1', '6')
18 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') 18 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4')
19 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4') 19 #define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4')
20 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4') 20 #define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4')
21 #define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4') 21 #define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4')
22 #define DRM_FORMAT_YV12 FOURCC('Y', 'V', '1', '2') 22 #define DRM_FORMAT_YV12 FOURCC('Y', 'V', '1', '2')
23 #define DRM_FORMAT_NV12 FOURCC('N', 'V', '1', '2')
24 23
25 namespace ui { 24 namespace ui {
26 namespace { 25 namespace {
27 26
28 bool ValidInternalFormat(unsigned internalformat, gfx::BufferFormat format) { 27 bool ValidInternalFormat(unsigned internalformat, gfx::BufferFormat format) {
29 switch (internalformat) { 28 switch (internalformat) {
30 case GL_RGB: 29 case GL_RGB:
31 return format == gfx::BufferFormat::BGR_565 || 30 return format == gfx::BufferFormat::BGR_565 ||
32 format == gfx::BufferFormat::RGBX_8888 || 31 format == gfx::BufferFormat::RGBX_8888 ||
33 format == gfx::BufferFormat::BGRX_8888; 32 format == gfx::BufferFormat::BGRX_8888;
34 case GL_RGB_YCRCB_420_CHROMIUM: 33 case GL_RGB_YCRCB_420_CHROMIUM:
35 return format == gfx::BufferFormat::YVU_420; 34 return format == gfx::BufferFormat::YVU_420;
36 case GL_RGB_YCBCR_420V_CHROMIUM:
37 return format == gfx::BufferFormat::YUV_420_BIPLANAR;
38 case GL_RGBA: 35 case GL_RGBA:
39 return format == gfx::BufferFormat::RGBA_8888; 36 return format == gfx::BufferFormat::RGBA_8888;
40 case GL_BGRA_EXT: 37 case GL_BGRA_EXT:
41 return format == gfx::BufferFormat::BGRA_8888; 38 return format == gfx::BufferFormat::BGRA_8888;
42 case GL_RED_EXT: 39 case GL_RED_EXT:
43 return format == gfx::BufferFormat::R_8; 40 return format == gfx::BufferFormat::R_8;
44 default: 41 default:
45 return false; 42 return false;
46 } 43 }
47 } 44 }
48 45
49 bool ValidFormat(gfx::BufferFormat format) { 46 bool ValidFormat(gfx::BufferFormat format) {
50 switch (format) { 47 switch (format) {
51 case gfx::BufferFormat::R_8: 48 case gfx::BufferFormat::R_8:
52 case gfx::BufferFormat::BGR_565: 49 case gfx::BufferFormat::BGR_565:
53 case gfx::BufferFormat::RGBA_8888: 50 case gfx::BufferFormat::RGBA_8888:
54 case gfx::BufferFormat::RGBX_8888: 51 case gfx::BufferFormat::RGBX_8888:
55 case gfx::BufferFormat::BGRA_8888: 52 case gfx::BufferFormat::BGRA_8888:
56 case gfx::BufferFormat::BGRX_8888: 53 case gfx::BufferFormat::BGRX_8888:
57 case gfx::BufferFormat::YVU_420: 54 case gfx::BufferFormat::YVU_420:
58 case gfx::BufferFormat::YUV_420_BIPLANAR:
59 return true; 55 return true;
60 case gfx::BufferFormat::ATC: 56 case gfx::BufferFormat::ATC:
61 case gfx::BufferFormat::ATCIA: 57 case gfx::BufferFormat::ATCIA:
62 case gfx::BufferFormat::DXT1: 58 case gfx::BufferFormat::DXT1:
63 case gfx::BufferFormat::DXT5: 59 case gfx::BufferFormat::DXT5:
64 case gfx::BufferFormat::ETC1: 60 case gfx::BufferFormat::ETC1:
65 case gfx::BufferFormat::RGBA_4444: 61 case gfx::BufferFormat::RGBA_4444:
62 case gfx::BufferFormat::YUV_420_BIPLANAR:
66 case gfx::BufferFormat::UYVY_422: 63 case gfx::BufferFormat::UYVY_422:
67 return false; 64 return false;
68 } 65 }
69 66
70 NOTREACHED(); 67 NOTREACHED();
71 return false; 68 return false;
72 } 69 }
73 70
74 EGLint FourCC(gfx::BufferFormat format) { 71 EGLint FourCC(gfx::BufferFormat format) {
75 switch (format) { 72 switch (format) {
76 case gfx::BufferFormat::R_8: 73 case gfx::BufferFormat::R_8:
77 return DRM_FORMAT_R8; 74 return DRM_FORMAT_R8;
78 case gfx::BufferFormat::BGR_565: 75 case gfx::BufferFormat::BGR_565:
79 return DRM_FORMAT_RGB565; 76 return DRM_FORMAT_RGB565;
80 case gfx::BufferFormat::RGBA_8888: 77 case gfx::BufferFormat::RGBA_8888:
81 return DRM_FORMAT_ABGR8888; 78 return DRM_FORMAT_ABGR8888;
82 case gfx::BufferFormat::RGBX_8888: 79 case gfx::BufferFormat::RGBX_8888:
83 return DRM_FORMAT_XBGR8888; 80 return DRM_FORMAT_XBGR8888;
84 case gfx::BufferFormat::BGRA_8888: 81 case gfx::BufferFormat::BGRA_8888:
85 return DRM_FORMAT_ARGB8888; 82 return DRM_FORMAT_ARGB8888;
86 case gfx::BufferFormat::BGRX_8888: 83 case gfx::BufferFormat::BGRX_8888:
87 return DRM_FORMAT_XRGB8888; 84 return DRM_FORMAT_XRGB8888;
88 case gfx::BufferFormat::YVU_420: 85 case gfx::BufferFormat::YVU_420:
89 return DRM_FORMAT_YV12; 86 return DRM_FORMAT_YV12;
90 case gfx::BufferFormat::YUV_420_BIPLANAR:
91 return DRM_FORMAT_NV12;
92 case gfx::BufferFormat::ATC: 87 case gfx::BufferFormat::ATC:
93 case gfx::BufferFormat::ATCIA: 88 case gfx::BufferFormat::ATCIA:
94 case gfx::BufferFormat::DXT1: 89 case gfx::BufferFormat::DXT1:
95 case gfx::BufferFormat::DXT5: 90 case gfx::BufferFormat::DXT5:
96 case gfx::BufferFormat::ETC1: 91 case gfx::BufferFormat::ETC1:
97 case gfx::BufferFormat::RGBA_4444: 92 case gfx::BufferFormat::RGBA_4444:
93 case gfx::BufferFormat::YUV_420_BIPLANAR:
98 case gfx::BufferFormat::UYVY_422: 94 case gfx::BufferFormat::UYVY_422:
99 NOTREACHED(); 95 NOTREACHED();
100 return 0; 96 return 0;
101 } 97 }
102 98
103 NOTREACHED(); 99 NOTREACHED();
104 return 0; 100 return 0;
105 } 101 }
106 102
107 } // namespace 103 } // namespace
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 case gfx::BufferFormat::UYVY_422: 258 case gfx::BufferFormat::UYVY_422:
263 NOTREACHED(); 259 NOTREACHED();
264 return GL_NONE; 260 return GL_NONE;
265 } 261 }
266 262
267 NOTREACHED(); 263 NOTREACHED();
268 return GL_NONE; 264 return GL_NONE;
269 } 265 }
270 266
271 } // namespace ui 267 } // namespace ui
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698