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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_io_surface.cc

Issue 1316493004: Add support for converting I420 software frames into NV12 hardware frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snapshot
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" 5 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 int32 BytesPerElement(gfx::BufferFormat format, int plane) { 27 int32 BytesPerElement(gfx::BufferFormat format, int plane) {
28 switch (format) { 28 switch (format) {
29 case gfx::BufferFormat::R_8: 29 case gfx::BufferFormat::R_8:
30 DCHECK_EQ(plane, 0); 30 DCHECK_EQ(plane, 0);
31 return 1; 31 return 1;
32 case gfx::BufferFormat::BGRA_8888: 32 case gfx::BufferFormat::BGRA_8888:
33 DCHECK_EQ(plane, 0); 33 DCHECK_EQ(plane, 0);
34 return 4; 34 return 4;
35 case gfx::BufferFormat::YUV_420_BIPLANAR:
36 static int32 bytes_per_element[] = {1, 2};
37 DCHECK_LT(static_cast<size_t>(plane), arraysize(bytes_per_element));
38 return bytes_per_element[plane];
35 case gfx::BufferFormat::UYVY_422: 39 case gfx::BufferFormat::UYVY_422:
36 DCHECK_EQ(plane, 0); 40 DCHECK_EQ(plane, 0);
37 return 2; 41 return 2;
38 case gfx::BufferFormat::ATC: 42 case gfx::BufferFormat::ATC:
39 case gfx::BufferFormat::ATCIA: 43 case gfx::BufferFormat::ATCIA:
40 case gfx::BufferFormat::DXT1: 44 case gfx::BufferFormat::DXT1:
41 case gfx::BufferFormat::DXT5: 45 case gfx::BufferFormat::DXT5:
42 case gfx::BufferFormat::ETC1: 46 case gfx::BufferFormat::ETC1:
43 case gfx::BufferFormat::RGBA_4444: 47 case gfx::BufferFormat::RGBA_4444:
44 case gfx::BufferFormat::RGBA_8888: 48 case gfx::BufferFormat::RGBA_8888:
45 case gfx::BufferFormat::BGRX_8888: 49 case gfx::BufferFormat::BGRX_8888:
46 case gfx::BufferFormat::YUV_420: 50 case gfx::BufferFormat::YUV_420:
47 NOTREACHED(); 51 NOTREACHED();
48 return 0; 52 return 0;
49 } 53 }
50 54
51 NOTREACHED(); 55 NOTREACHED();
52 return 0; 56 return 0;
53 } 57 }
54 58
55 int32 PixelFormat(gfx::BufferFormat format) { 59 int32 PixelFormat(gfx::BufferFormat format) {
56 switch (format) { 60 switch (format) {
57 case gfx::BufferFormat::R_8: 61 case gfx::BufferFormat::R_8:
58 return 'L008'; 62 return 'L008';
59 case gfx::BufferFormat::BGRA_8888: 63 case gfx::BufferFormat::BGRA_8888:
60 return 'BGRA'; 64 return 'BGRA';
65 case gfx::BufferFormat::YUV_420_BIPLANAR:
66 return '420v';
61 case gfx::BufferFormat::UYVY_422: 67 case gfx::BufferFormat::UYVY_422:
62 return '2vuy'; 68 return '2vuy';
63 case gfx::BufferFormat::ATC: 69 case gfx::BufferFormat::ATC:
64 case gfx::BufferFormat::ATCIA: 70 case gfx::BufferFormat::ATCIA:
65 case gfx::BufferFormat::DXT1: 71 case gfx::BufferFormat::DXT1:
66 case gfx::BufferFormat::DXT5: 72 case gfx::BufferFormat::DXT5:
67 case gfx::BufferFormat::ETC1: 73 case gfx::BufferFormat::ETC1:
68 case gfx::BufferFormat::RGBA_4444: 74 case gfx::BufferFormat::RGBA_4444:
69 case gfx::BufferFormat::RGBA_8888: 75 case gfx::BufferFormat::RGBA_8888:
70 case gfx::BufferFormat::BGRX_8888: 76 case gfx::BufferFormat::BGRX_8888:
71 case gfx::BufferFormat::YUV_420: 77 case gfx::BufferFormat::YUV_420:
72 NOTREACHED(); 78 NOTREACHED();
73 return 0; 79 return 0;
74 } 80 }
75 81
76 NOTREACHED(); 82 NOTREACHED();
77 return 0; 83 return 0;
78 } 84 }
79 85
80 const GpuMemoryBufferFactory::Configuration kSupportedConfigurations[] = { 86 const GpuMemoryBufferFactory::Configuration kSupportedConfigurations[] = {
81 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::SCANOUT}, 87 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::SCANOUT},
82 {gfx::BufferFormat::R_8, gfx::BufferUsage::PERSISTENT_MAP}, 88 {gfx::BufferFormat::R_8, gfx::BufferUsage::PERSISTENT_MAP},
83 {gfx::BufferFormat::R_8, gfx::BufferUsage::MAP}, 89 {gfx::BufferFormat::R_8, gfx::BufferUsage::MAP},
84 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::PERSISTENT_MAP}, 90 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::PERSISTENT_MAP},
85 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP}, 91 {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP},
86 {gfx::BufferFormat::UYVY_422, gfx::BufferUsage::MAP}, 92 {gfx::BufferFormat::UYVY_422, gfx::BufferUsage::MAP},
87 {gfx::BufferFormat::UYVY_422, gfx::BufferUsage::PERSISTENT_MAP}, 93 {gfx::BufferFormat::UYVY_422, gfx::BufferUsage::PERSISTENT_MAP},
94 {gfx::BufferFormat::YUV_420_BIPLANAR, gfx::BufferUsage::MAP},
95 {gfx::BufferFormat::YUV_420_BIPLANAR, gfx::BufferUsage::PERSISTENT_MAP},
88 }; 96 };
89 97
90 } // namespace 98 } // namespace
91 99
92 GpuMemoryBufferFactoryIOSurface::GpuMemoryBufferFactoryIOSurface() { 100 GpuMemoryBufferFactoryIOSurface::GpuMemoryBufferFactoryIOSurface() {
93 } 101 }
94 102
95 GpuMemoryBufferFactoryIOSurface::~GpuMemoryBufferFactoryIOSurface() { 103 GpuMemoryBufferFactoryIOSurface::~GpuMemoryBufferFactoryIOSurface() {
96 } 104 }
97 105
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 216
209 scoped_refptr<gfx::GLImageIOSurface> image( 217 scoped_refptr<gfx::GLImageIOSurface> image(
210 new gfx::GLImageIOSurface(handle.id, size, internalformat)); 218 new gfx::GLImageIOSurface(handle.id, size, internalformat));
211 if (!image->Initialize(it->second.get(), format)) 219 if (!image->Initialize(it->second.get(), format))
212 return scoped_refptr<gfx::GLImage>(); 220 return scoped_refptr<gfx::GLImage>();
213 221
214 return image; 222 return image;
215 } 223 }
216 224
217 } // namespace content 225 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc ('k') | gpu/command_buffer/service/image_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698