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

Side by Side Diff: media/gpu/video_encode_accelerator_unittest.cc

Issue 2281043002: media: gpu: vea_unittest: fix alignment on non ARM platforms (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 | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <inttypes.h> 5 #include <inttypes.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 #ifdef ARCH_CPU_ARMEL 159 #ifdef ARCH_CPU_ARMEL
160 // ARM performs CPU cache management with CPU cache line granularity. We thus 160 // ARM performs CPU cache management with CPU cache line granularity. We thus
161 // need to ensure our buffers are CPU cache line-aligned (64 byte-aligned). 161 // need to ensure our buffers are CPU cache line-aligned (64 byte-aligned).
162 // Otherwise newer kernels will refuse to accept them, and on older kernels 162 // Otherwise newer kernels will refuse to accept them, and on older kernels
163 // we'll be treating ourselves to random corruption. 163 // we'll be treating ourselves to random corruption.
164 // Moreover, some hardware codecs require 128-byte alignment for physical 164 // Moreover, some hardware codecs require 128-byte alignment for physical
165 // buffers. 165 // buffers.
166 const size_t kPlatformBufferAlignment = 128; 166 const size_t kPlatformBufferAlignment = 128;
167 #else 167 #else
168 const size_t kPlatformBufferAlignment = 1; 168 const size_t kPlatformBufferAlignment = 8;
169 #endif 169 #endif
170 170
171 inline static size_t AlignToPlatformRequirements(size_t value) { 171 inline static size_t AlignToPlatformRequirements(size_t value) {
172 return base::bits::Align(value, kPlatformBufferAlignment); 172 return base::bits::Align(value, kPlatformBufferAlignment);
173 } 173 }
174 174
175 // An aligned STL allocator. 175 // An aligned STL allocator.
176 template <typename T, size_t ByteAlignment> 176 template <typename T, size_t ByteAlignment>
177 class AlignedAllocator : public std::allocator<T> { 177 class AlignedAllocator : public std::allocator<T> {
178 public: 178 public:
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 1957
1958 media::g_env = 1958 media::g_env =
1959 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( 1959 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>(
1960 testing::AddGlobalTestEnvironment( 1960 testing::AddGlobalTestEnvironment(
1961 new media::VideoEncodeAcceleratorTestEnvironment( 1961 new media::VideoEncodeAcceleratorTestEnvironment(
1962 std::move(test_stream_data), log_path, run_at_fps, 1962 std::move(test_stream_data), log_path, run_at_fps,
1963 needs_encode_latency, verify_all_output))); 1963 needs_encode_latency, verify_all_output)));
1964 1964
1965 return RUN_ALL_TESTS(); 1965 return RUN_ALL_TESTS();
1966 } 1966 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698