aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/amdgpu/amdgpu_test.h')
-rw-r--r--tests/amdgpu/amdgpu_test.h144
1 files changed, 144 insertions, 0 deletions
diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h
index e30e2312..62875736 100644
--- a/tests/amdgpu/amdgpu_test.h
+++ b/tests/amdgpu/amdgpu_test.h
@@ -85,6 +85,11 @@ int suite_cs_tests_init();
85int suite_cs_tests_clean(); 85int suite_cs_tests_clean();
86 86
87/** 87/**
88 * Decide if the suite is enabled by default or not.
89 */
90CU_BOOL suite_cs_tests_enable(void);
91
92/**
88 * Tests in cs test suite 93 * Tests in cs test suite
89 */ 94 */
90extern CU_TestInfo cs_tests[]; 95extern CU_TestInfo cs_tests[];
@@ -100,11 +105,96 @@ int suite_vce_tests_init();
100int suite_vce_tests_clean(); 105int suite_vce_tests_clean();
101 106
102/** 107/**
108 * Decide if the suite is enabled by default or not.
109 */
110CU_BOOL suite_vce_tests_enable(void);
111
112/**
103 * Tests in vce test suite 113 * Tests in vce test suite
104 */ 114 */
105extern CU_TestInfo vce_tests[]; 115extern CU_TestInfo vce_tests[];
106 116
107/** 117/**
118+ * Initialize vcn test suite
119+ */
120int suite_vcn_tests_init();
121
122/**
123+ * Deinitialize vcn test suite
124+ */
125int suite_vcn_tests_clean();
126
127/**
128 * Decide if the suite is enabled by default or not.
129 */
130CU_BOOL suite_vcn_tests_enable(void);
131
132/**
133+ * Tests in vcn test suite
134+ */
135extern CU_TestInfo vcn_tests[];
136
137/**
138 * Initialize uvd enc test suite
139 */
140int suite_uvd_enc_tests_init();
141
142/**
143 * Deinitialize uvd enc test suite
144 */
145int suite_uvd_enc_tests_clean();
146
147/**
148 * Decide if the suite is enabled by default or not.
149 */
150CU_BOOL suite_uvd_enc_tests_enable(void);
151
152/**
153 * Tests in uvd enc test suite
154 */
155extern CU_TestInfo uvd_enc_tests[];
156
157/**
158 * Initialize deadlock test suite
159 */
160int suite_deadlock_tests_init();
161
162/**
163 * Deinitialize deadlock test suite
164 */
165int suite_deadlock_tests_clean();
166
167/**
168 * Decide if the suite is enabled by default or not.
169 */
170CU_BOOL suite_deadlock_tests_enable(void);
171
172/**
173 * Tests in uvd enc test suite
174 */
175extern CU_TestInfo deadlock_tests[];
176
177/**
178 * Initialize vm test suite
179 */
180int suite_vm_tests_init();
181
182/**
183 * Deinitialize deadlock test suite
184 */
185int suite_vm_tests_clean();
186
187/**
188 * Decide if the suite is enabled by default or not.
189 */
190CU_BOOL suite_vm_tests_enable(void);
191
192/**
193 * Tests in vm test suite
194 */
195extern CU_TestInfo vm_tests[];
196
197/**
108 * Helper functions 198 * Helper functions
109 */ 199 */
110static inline amdgpu_bo_handle gpu_mem_alloc( 200static inline amdgpu_bo_handle gpu_mem_alloc(
@@ -162,6 +252,29 @@ static inline int gpu_mem_free(amdgpu_bo_handle bo,
162} 252}
163 253
164static inline int 254static inline int
255amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size,
256 unsigned alignment, unsigned heap, uint64_t flags,
257 amdgpu_bo_handle *bo)
258{
259 struct amdgpu_bo_alloc_request request = {};
260 amdgpu_bo_handle buf_handle;
261 int r;
262
263 request.alloc_size = size;
264 request.phys_alignment = alignment;
265 request.preferred_heap = heap;
266 request.flags = flags;
267
268 r = amdgpu_bo_alloc(dev, &request, &buf_handle);
269 if (r)
270 return r;
271
272 *bo = buf_handle;
273
274 return 0;
275}
276
277static inline int
165amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size, 278amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size,
166 unsigned alignment, unsigned heap, uint64_t flags, 279 unsigned alignment, unsigned heap, uint64_t flags,
167 amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address, 280 amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address,
@@ -236,4 +349,35 @@ amdgpu_get_bo_list(amdgpu_device_handle dev, amdgpu_bo_handle bo1,
236 return amdgpu_bo_list_create(dev, bo2 ? 2 : 1, resources, NULL, list); 349 return amdgpu_bo_list_create(dev, bo2 ? 2 : 1, resources, NULL, list);
237} 350}
238 351
352
353static inline CU_ErrorCode amdgpu_set_suite_active(const char *suite_name,
354 CU_BOOL active)
355{
356 CU_ErrorCode r = CU_set_suite_active(CU_get_suite(suite_name), active);
357
358 if (r != CUE_SUCCESS)
359 fprintf(stderr, "Failed to obtain suite %s\n", suite_name);
360
361 return r;
362}
363
364static inline CU_ErrorCode amdgpu_set_test_active(const char *suite_name,
365 const char *test_name, CU_BOOL active)
366{
367 CU_ErrorCode r;
368 CU_pSuite pSuite = CU_get_suite(suite_name);
369
370 if (!pSuite) {
371 fprintf(stderr, "Failed to obtain suite %s\n",
372 suite_name);
373 return CUE_NOSUITE;
374 }
375
376 r = CU_set_test_active(CU_get_test(pSuite, test_name), active);
377 if (r != CUE_SUCCESS)
378 fprintf(stderr, "Failed to obtain test %s\n", test_name);
379
380 return r;
381}
382
239#endif /* #ifdef _AMDGPU_TEST_H_ */ 383#endif /* #ifdef _AMDGPU_TEST_H_ */