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

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

Issue 2296433002: 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_NV21 FOURCC('N', 'V', '1', '2')
reveman 2016/08/29 21:20:25 s/DRM_FORMAT_NV21/DRM_FORMAT_NV12/
Daniele Castagna 2016/08/29 21:49:07 Done.
23 24
24 namespace ui { 25 namespace ui {
25 namespace { 26 namespace {
26 27
27 bool ValidInternalFormat(unsigned internalformat, gfx::BufferFormat format) { 28 bool ValidInternalFormat(unsigned internalformat, gfx::BufferFormat format) {
28 switch (internalformat) { 29 switch (internalformat) {
29 case GL_RGB: 30 case GL_RGB:
30 return format == gfx::BufferFormat::BGR_565 || 31 return format == gfx::BufferFormat::BGR_565 ||
31 format == gfx::BufferFormat::RGBX_8888 || 32 format == gfx::BufferFormat::RGBX_8888 ||
32 format == gfx::BufferFormat::BGRX_8888; 33 format == gfx::BufferFormat::BGRX_8888;
33 case GL_RGB_YCRCB_420_CHROMIUM: 34 case GL_RGB_YCRCB_420_CHROMIUM:
34 return format == gfx::BufferFormat::YVU_420; 35 return format == gfx::BufferFormat::YVU_420;
36 case GL_RGB_YCBCR_420V_CHROMIUM:
37 return format == gfx::BufferFormat::YUV_420_BIPLANAR;
35 case GL_RGBA: 38 case GL_RGBA:
36 return format == gfx::BufferFormat::RGBA_8888; 39 return format == gfx::BufferFormat::RGBA_8888;
37 case GL_BGRA_EXT: 40 case GL_BGRA_EXT:
38 return format == gfx::BufferFormat::BGRA_8888; 41 return format == gfx::BufferFormat::BGRA_8888;
39 case GL_RED_EXT: 42 case GL_RED_EXT:
40 return format == gfx::BufferFormat::R_8; 43 return format == gfx::BufferFormat::R_8;
41 default: 44 default:
42 return false; 45 return false;
43 } 46 }
44 } 47 }
45 48
46 bool ValidFormat(gfx::BufferFormat format) { 49 bool ValidFormat(gfx::BufferFormat format) {
47 switch (format) { 50 switch (format) {
48 case gfx::BufferFormat::R_8: 51 case gfx::BufferFormat::R_8:
49 case gfx::BufferFormat::BGR_565: 52 case gfx::BufferFormat::BGR_565:
50 case gfx::BufferFormat::RGBA_8888: 53 case gfx::BufferFormat::RGBA_8888:
51 case gfx::BufferFormat::RGBX_8888: 54 case gfx::BufferFormat::RGBX_8888:
52 case gfx::BufferFormat::BGRA_8888: 55 case gfx::BufferFormat::BGRA_8888:
53 case gfx::BufferFormat::BGRX_8888: 56 case gfx::BufferFormat::BGRX_8888:
54 case gfx::BufferFormat::YVU_420: 57 case gfx::BufferFormat::YVU_420:
58 case gfx::BufferFormat::YUV_420_BIPLANAR:
55 return true; 59 return true;
56 case gfx::BufferFormat::ATC: 60 case gfx::BufferFormat::ATC:
57 case gfx::BufferFormat::ATCIA: 61 case gfx::BufferFormat::ATCIA:
58 case gfx::BufferFormat::DXT1: 62 case gfx::BufferFormat::DXT1:
59 case gfx::BufferFormat::DXT5: 63 case gfx::BufferFormat::DXT5:
60 case gfx::BufferFormat::ETC1: 64 case gfx::BufferFormat::ETC1:
61 case gfx::BufferFormat::RGBA_4444: 65 case gfx::BufferFormat::RGBA_4444:
62 case gfx::BufferFormat::YUV_420_BIPLANAR:
63 case gfx::BufferFormat::UYVY_422: 66 case gfx::BufferFormat::UYVY_422:
64 return false; 67 return false;
65 } 68 }
66 69
67 NOTREACHED(); 70 NOTREACHED();
68 return false; 71 return false;
69 } 72 }
70 73
71 EGLint FourCC(gfx::BufferFormat format) { 74 EGLint FourCC(gfx::BufferFormat format) {
72 switch (format) { 75 switch (format) {
73 case gfx::BufferFormat::R_8: 76 case gfx::BufferFormat::R_8:
74 return DRM_FORMAT_R8; 77 return DRM_FORMAT_R8;
75 case gfx::BufferFormat::BGR_565: 78 case gfx::BufferFormat::BGR_565:
76 return DRM_FORMAT_RGB565; 79 return DRM_FORMAT_RGB565;
77 case gfx::BufferFormat::RGBA_8888: 80 case gfx::BufferFormat::RGBA_8888:
78 return DRM_FORMAT_ABGR8888; 81 return DRM_FORMAT_ABGR8888;
79 case gfx::BufferFormat::RGBX_8888: 82 case gfx::BufferFormat::RGBX_8888:
80 return DRM_FORMAT_XBGR8888; 83 return DRM_FORMAT_XBGR8888;
81 case gfx::BufferFormat::BGRA_8888: 84 case gfx::BufferFormat::BGRA_8888:
82 return DRM_FORMAT_ARGB8888; 85 return DRM_FORMAT_ARGB8888;
83 case gfx::BufferFormat::BGRX_8888: 86 case gfx::BufferFormat::BGRX_8888:
84 return DRM_FORMAT_XRGB8888; 87 return DRM_FORMAT_XRGB8888;
85 case gfx::BufferFormat::YVU_420: 88 case gfx::BufferFormat::YVU_420:
86 return DRM_FORMAT_YV12; 89 return DRM_FORMAT_YV12;
90 case gfx::BufferFormat::YUV_420_BIPLANAR:
91 return DRM_FORMAT_NV21;
87 case gfx::BufferFormat::ATC: 92 case gfx::BufferFormat::ATC:
88 case gfx::BufferFormat::ATCIA: 93 case gfx::BufferFormat::ATCIA:
89 case gfx::BufferFormat::DXT1: 94 case gfx::BufferFormat::DXT1:
90 case gfx::BufferFormat::DXT5: 95 case gfx::BufferFormat::DXT5:
91 case gfx::BufferFormat::ETC1: 96 case gfx::BufferFormat::ETC1:
92 case gfx::BufferFormat::RGBA_4444: 97 case gfx::BufferFormat::RGBA_4444:
93 case gfx::BufferFormat::YUV_420_BIPLANAR:
94 case gfx::BufferFormat::UYVY_422: 98 case gfx::BufferFormat::UYVY_422:
95 NOTREACHED(); 99 NOTREACHED();
96 return 0; 100 return 0;
97 } 101 }
98 102
99 NOTREACHED(); 103 NOTREACHED();
100 return 0; 104 return 0;
101 } 105 }
102 106
103 } // namespace 107 } // namespace
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 case gfx::BufferFormat::UYVY_422: 262 case gfx::BufferFormat::UYVY_422:
259 NOTREACHED(); 263 NOTREACHED();
260 return GL_NONE; 264 return GL_NONE;
261 } 265 }
262 266
263 NOTREACHED(); 267 NOTREACHED();
264 return GL_NONE; 268 return GL_NONE;
265 } 269 }
266 270
267 } // namespace ui 271 } // 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