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

Side by Side Diff: ui/gfx/mac/io_surface.cc

Issue 2786103003: Add half-float IOSurface GpuMemoryBuffer support (Closed)
Patch Set: Review feedback Created 3 years, 8 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 | « ui/gfx/buffer_types.h ('k') | ui/gfx/mojo/buffer_types.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gfx/mac/io_surface.h" 5 #include "ui/gfx/mac/io_surface.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 19 matching lines...) Expand all
30 int32_t BytesPerElement(gfx::BufferFormat format, int plane) { 30 int32_t BytesPerElement(gfx::BufferFormat format, int plane) {
31 switch (format) { 31 switch (format) {
32 case gfx::BufferFormat::R_8: 32 case gfx::BufferFormat::R_8:
33 DCHECK_EQ(plane, 0); 33 DCHECK_EQ(plane, 0);
34 return 1; 34 return 1;
35 case gfx::BufferFormat::BGRA_8888: 35 case gfx::BufferFormat::BGRA_8888:
36 case gfx::BufferFormat::BGRX_8888: 36 case gfx::BufferFormat::BGRX_8888:
37 case gfx::BufferFormat::RGBA_8888: 37 case gfx::BufferFormat::RGBA_8888:
38 DCHECK_EQ(plane, 0); 38 DCHECK_EQ(plane, 0);
39 return 4; 39 return 4;
40 case gfx::BufferFormat::RGBA_F16:
41 DCHECK_EQ(plane, 0);
42 return 8;
40 case gfx::BufferFormat::YUV_420_BIPLANAR: 43 case gfx::BufferFormat::YUV_420_BIPLANAR:
41 static int32_t bytes_per_element[] = {1, 2}; 44 static int32_t bytes_per_element[] = {1, 2};
42 DCHECK_LT(static_cast<size_t>(plane), arraysize(bytes_per_element)); 45 DCHECK_LT(static_cast<size_t>(plane), arraysize(bytes_per_element));
43 return bytes_per_element[plane]; 46 return bytes_per_element[plane];
44 case gfx::BufferFormat::RG_88: 47 case gfx::BufferFormat::RG_88:
45 case gfx::BufferFormat::UYVY_422: 48 case gfx::BufferFormat::UYVY_422:
46 DCHECK_EQ(plane, 0); 49 DCHECK_EQ(plane, 0);
47 return 2; 50 return 2;
48 case gfx::BufferFormat::ATC: 51 case gfx::BufferFormat::ATC:
49 case gfx::BufferFormat::ATCIA: 52 case gfx::BufferFormat::ATCIA:
(...skipping 13 matching lines...) Expand all
63 } 66 }
64 67
65 int32_t PixelFormat(gfx::BufferFormat format) { 68 int32_t PixelFormat(gfx::BufferFormat format) {
66 switch (format) { 69 switch (format) {
67 case gfx::BufferFormat::R_8: 70 case gfx::BufferFormat::R_8:
68 return 'L008'; 71 return 'L008';
69 case gfx::BufferFormat::BGRA_8888: 72 case gfx::BufferFormat::BGRA_8888:
70 case gfx::BufferFormat::BGRX_8888: 73 case gfx::BufferFormat::BGRX_8888:
71 case gfx::BufferFormat::RGBA_8888: 74 case gfx::BufferFormat::RGBA_8888:
72 return 'BGRA'; 75 return 'BGRA';
76 case gfx::BufferFormat::RGBA_F16:
77 return 'RGhA';
73 case gfx::BufferFormat::YUV_420_BIPLANAR: 78 case gfx::BufferFormat::YUV_420_BIPLANAR:
74 return '420v'; 79 return '420v';
75 case gfx::BufferFormat::UYVY_422: 80 case gfx::BufferFormat::UYVY_422:
76 return '2vuy'; 81 return '2vuy';
77 case gfx::BufferFormat::RG_88: 82 case gfx::BufferFormat::RG_88:
78 case gfx::BufferFormat::ATC: 83 case gfx::BufferFormat::ATC:
79 case gfx::BufferFormat::ATCIA: 84 case gfx::BufferFormat::ATCIA:
80 case gfx::BufferFormat::DXT1: 85 case gfx::BufferFormat::DXT1:
81 case gfx::BufferFormat::DXT5: 86 case gfx::BufferFormat::DXT5:
82 case gfx::BufferFormat::ETC1: 87 case gfx::BufferFormat::ETC1:
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Note that nullptr is an acceptable input to IOSurfaceSetValue. 209 // Note that nullptr is an acceptable input to IOSurfaceSetValue.
205 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc); 210 IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"), color_space_icc);
206 } 211 }
207 212
208 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime", 213 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CreateTime",
209 base::TimeTicks::Now() - start_time); 214 base::TimeTicks::Now() - start_time);
210 return surface; 215 return surface;
211 } 216 }
212 217
213 } // namespace gfx 218 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/buffer_types.h ('k') | ui/gfx/mojo/buffer_types.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698