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

Side by Side Diff: cc/test/test_gpu_memory_buffer_manager.cc

Issue 1051503003: Add R_8 GPU memory buffers format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged on master. Created 5 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 | « no previous file | content/common/gpu/client/gpu_memory_buffer_impl.cc » ('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 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 "cc/test/test_gpu_memory_buffer_manager.h" 5 #include "cc/test/test_gpu_memory_buffer_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/gpu_memory_buffer.h" 8 #include "ui/gfx/gpu_memory_buffer.h"
9 9
10 namespace cc { 10 namespace cc {
11 namespace { 11 namespace {
12 12
13 size_t NumberOfPlanesForGpuMemoryBufferFormat( 13 size_t NumberOfPlanesForGpuMemoryBufferFormat(
14 gfx::GpuMemoryBuffer::Format format) { 14 gfx::GpuMemoryBuffer::Format format) {
15 switch (format) { 15 switch (format) {
16 case gfx::GpuMemoryBuffer::Format::ATC: 16 case gfx::GpuMemoryBuffer::Format::ATC:
17 case gfx::GpuMemoryBuffer::Format::ATCIA: 17 case gfx::GpuMemoryBuffer::Format::ATCIA:
18 case gfx::GpuMemoryBuffer::Format::DXT1: 18 case gfx::GpuMemoryBuffer::Format::DXT1:
19 case gfx::GpuMemoryBuffer::Format::DXT5: 19 case gfx::GpuMemoryBuffer::Format::DXT5:
20 case gfx::GpuMemoryBuffer::Format::ETC1: 20 case gfx::GpuMemoryBuffer::Format::ETC1:
21 case gfx::GpuMemoryBuffer::Format::R_8:
21 case gfx::GpuMemoryBuffer::Format::RGBA_8888: 22 case gfx::GpuMemoryBuffer::Format::RGBA_8888:
22 case gfx::GpuMemoryBuffer::Format::RGBX_8888: 23 case gfx::GpuMemoryBuffer::Format::RGBX_8888:
23 case gfx::GpuMemoryBuffer::Format::BGRA_8888: 24 case gfx::GpuMemoryBuffer::Format::BGRA_8888:
24 return 1; 25 return 1;
25 case gfx::GpuMemoryBuffer::Format::YUV_420: 26 case gfx::GpuMemoryBuffer::Format::YUV_420:
26 return 3; 27 return 3;
27 } 28 }
28 NOTREACHED(); 29 NOTREACHED();
29 return 0; 30 return 0;
30 } 31 }
31 32
32 size_t SubsamplingFactor(gfx::GpuMemoryBuffer::Format format, int plane) { 33 size_t SubsamplingFactor(gfx::GpuMemoryBuffer::Format format, int plane) {
33 switch (format) { 34 switch (format) {
34 case gfx::GpuMemoryBuffer::ATC: 35 case gfx::GpuMemoryBuffer::ATC:
35 case gfx::GpuMemoryBuffer::ATCIA: 36 case gfx::GpuMemoryBuffer::ATCIA:
36 case gfx::GpuMemoryBuffer::DXT1: 37 case gfx::GpuMemoryBuffer::DXT1:
37 case gfx::GpuMemoryBuffer::DXT5: 38 case gfx::GpuMemoryBuffer::DXT5:
38 case gfx::GpuMemoryBuffer::ETC1: 39 case gfx::GpuMemoryBuffer::ETC1:
40 case gfx::GpuMemoryBuffer::R_8:
39 case gfx::GpuMemoryBuffer::RGBA_8888: 41 case gfx::GpuMemoryBuffer::RGBA_8888:
40 case gfx::GpuMemoryBuffer::RGBX_8888: 42 case gfx::GpuMemoryBuffer::RGBX_8888:
41 case gfx::GpuMemoryBuffer::BGRA_8888: 43 case gfx::GpuMemoryBuffer::BGRA_8888:
42 return 1; 44 return 1;
43 case gfx::GpuMemoryBuffer::YUV_420: { 45 case gfx::GpuMemoryBuffer::YUV_420: {
44 static size_t factor[] = {1, 2, 2}; 46 static size_t factor[] = {1, 2, 2};
45 DCHECK_LT(static_cast<size_t>(plane), arraysize(factor)); 47 DCHECK_LT(static_cast<size_t>(plane), arraysize(factor));
46 return factor[plane]; 48 return factor[plane];
47 } 49 }
48 } 50 }
49 NOTREACHED(); 51 NOTREACHED();
50 return 0; 52 return 0;
51 } 53 }
52 54
53 size_t StrideInBytes(size_t width, 55 size_t StrideInBytes(size_t width,
54 gfx::GpuMemoryBuffer::Format format, 56 gfx::GpuMemoryBuffer::Format format,
55 int plane) { 57 int plane) {
56 switch (format) { 58 switch (format) {
57 case gfx::GpuMemoryBuffer::ATCIA: 59 case gfx::GpuMemoryBuffer::ATCIA:
58 case gfx::GpuMemoryBuffer::DXT5: 60 case gfx::GpuMemoryBuffer::DXT5:
59 DCHECK_EQ(plane, 0); 61 DCHECK_EQ(plane, 0);
60 return width; 62 return width;
61 case gfx::GpuMemoryBuffer::ATC: 63 case gfx::GpuMemoryBuffer::ATC:
62 case gfx::GpuMemoryBuffer::DXT1: 64 case gfx::GpuMemoryBuffer::DXT1:
63 case gfx::GpuMemoryBuffer::ETC1: 65 case gfx::GpuMemoryBuffer::ETC1:
64 DCHECK_EQ(plane, 0); 66 DCHECK_EQ(plane, 0);
65 DCHECK_EQ(width % 2, 0U); 67 DCHECK_EQ(width % 2, 0U);
66 return width / 2; 68 return width / 2;
69 case gfx::GpuMemoryBuffer::R_8:
70 return (width + 3) & ~0x3;
67 case gfx::GpuMemoryBuffer::RGBA_8888: 71 case gfx::GpuMemoryBuffer::RGBA_8888:
68 case gfx::GpuMemoryBuffer::RGBX_8888: 72 case gfx::GpuMemoryBuffer::RGBX_8888:
69 case gfx::GpuMemoryBuffer::BGRA_8888: 73 case gfx::GpuMemoryBuffer::BGRA_8888:
70 DCHECK_EQ(plane, 0); 74 DCHECK_EQ(plane, 0);
71 return width * 4; 75 return width * 4;
72 case gfx::GpuMemoryBuffer::YUV_420: 76 case gfx::GpuMemoryBuffer::YUV_420:
73 return width / SubsamplingFactor(format, plane); 77 return width / SubsamplingFactor(format, plane);
74 } 78 }
75 NOTREACHED(); 79 NOTREACHED();
76 return 0; 80 return 0;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ClientBuffer buffer) { 171 ClientBuffer buffer) {
168 return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer); 172 return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer);
169 } 173 }
170 174
171 void TestGpuMemoryBufferManager::SetDestructionSyncPoint( 175 void TestGpuMemoryBufferManager::SetDestructionSyncPoint(
172 gfx::GpuMemoryBuffer* buffer, 176 gfx::GpuMemoryBuffer* buffer,
173 uint32 sync_point) { 177 uint32 sync_point) {
174 } 178 }
175 179
176 } // namespace cc 180 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/client/gpu_memory_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698