aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrey Grodzovsky2017-11-09 22:30:02 -0600
committerChristian König2017-11-13 11:20:27 -0600
commit818a0d4245801edd9a85ea95429bac4eb6ec2ef8 (patch)
tree77a0742af3553c967fa0cf6c7db586753088b1e5 /tests
parent806d0803600000faecb4025d8e9c7490cb097c25 (diff)
downloadexternal-libdrm-818a0d4245801edd9a85ea95429bac4eb6ec2ef8.tar.gz
external-libdrm-818a0d4245801edd9a85ea95429bac4eb6ec2ef8.tar.xz
external-libdrm-818a0d4245801edd9a85ea95429bac4eb6ec2ef8.zip
amdgpu: Move memory alloc tests in bo suite.
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/amdgpu/basic_tests.c49
-rw-r--r--tests/amdgpu/bo_tests.c49
2 files changed, 49 insertions, 49 deletions
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index 18bcf919..e7f48e39 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -44,7 +44,6 @@ static uint32_t minor_version;
44static uint32_t family_id; 44static uint32_t family_id;
45 45
46static void amdgpu_query_info_test(void); 46static void amdgpu_query_info_test(void);
47static void amdgpu_memory_alloc(void);
48static void amdgpu_command_submission_gfx(void); 47static void amdgpu_command_submission_gfx(void);
49static void amdgpu_command_submission_compute(void); 48static void amdgpu_command_submission_compute(void);
50static void amdgpu_command_submission_multi_fence(void); 49static void amdgpu_command_submission_multi_fence(void);
@@ -58,7 +57,6 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type);
58 57
59CU_TestInfo basic_tests[] = { 58CU_TestInfo basic_tests[] = {
60 { "Query Info Test", amdgpu_query_info_test }, 59 { "Query Info Test", amdgpu_query_info_test },
61 { "Memory alloc Test", amdgpu_memory_alloc },
62 { "Userptr Test", amdgpu_userptr_test }, 60 { "Userptr Test", amdgpu_userptr_test },
63 { "Command submission Test (GFX)", amdgpu_command_submission_gfx }, 61 { "Command submission Test (GFX)", amdgpu_command_submission_gfx },
64 { "Command submission Test (Compute)", amdgpu_command_submission_compute }, 62 { "Command submission Test (Compute)", amdgpu_command_submission_compute },
@@ -277,53 +275,6 @@ static void amdgpu_query_info_test(void)
277 CU_ASSERT_EQUAL(r, 0); 275 CU_ASSERT_EQUAL(r, 0);
278} 276}
279 277
280static void amdgpu_memory_alloc(void)
281{
282 amdgpu_bo_handle bo;
283 amdgpu_va_handle va_handle;
284 uint64_t bo_mc;
285 int r;
286
287 /* Test visible VRAM */
288 bo = gpu_mem_alloc(device_handle,
289 4096, 4096,
290 AMDGPU_GEM_DOMAIN_VRAM,
291 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
292 &bo_mc, &va_handle);
293
294 r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
295 CU_ASSERT_EQUAL(r, 0);
296
297 /* Test invisible VRAM */
298 bo = gpu_mem_alloc(device_handle,
299 4096, 4096,
300 AMDGPU_GEM_DOMAIN_VRAM,
301 AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
302 &bo_mc, &va_handle);
303
304 r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
305 CU_ASSERT_EQUAL(r, 0);
306
307 /* Test GART Cacheable */
308 bo = gpu_mem_alloc(device_handle,
309 4096, 4096,
310 AMDGPU_GEM_DOMAIN_GTT,
311 0, &bo_mc, &va_handle);
312
313 r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
314 CU_ASSERT_EQUAL(r, 0);
315
316 /* Test GART USWC */
317 bo = gpu_mem_alloc(device_handle,
318 4096, 4096,
319 AMDGPU_GEM_DOMAIN_GTT,
320 AMDGPU_GEM_CREATE_CPU_GTT_USWC,
321 &bo_mc, &va_handle);
322
323 r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
324 CU_ASSERT_EQUAL(r, 0);
325}
326
327static void amdgpu_command_submission_gfx_separate_ibs(void) 278static void amdgpu_command_submission_gfx_separate_ibs(void)
328{ 279{
329 amdgpu_context_handle context_handle; 280 amdgpu_context_handle context_handle;
diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c
index 74b5e77b..45451960 100644
--- a/tests/amdgpu/bo_tests.c
+++ b/tests/amdgpu/bo_tests.c
@@ -46,6 +46,7 @@ static amdgpu_va_handle va_handle;
46static void amdgpu_bo_export_import(void); 46static void amdgpu_bo_export_import(void);
47static void amdgpu_bo_metadata(void); 47static void amdgpu_bo_metadata(void);
48static void amdgpu_bo_map_unmap(void); 48static void amdgpu_bo_map_unmap(void);
49static void amdgpu_memory_alloc(void);
49 50
50CU_TestInfo bo_tests[] = { 51CU_TestInfo bo_tests[] = {
51 { "Export/Import", amdgpu_bo_export_import }, 52 { "Export/Import", amdgpu_bo_export_import },
@@ -53,6 +54,7 @@ CU_TestInfo bo_tests[] = {
53 { "Metadata", amdgpu_bo_metadata }, 54 { "Metadata", amdgpu_bo_metadata },
54#endif 55#endif
55 { "CPU map/unmap", amdgpu_bo_map_unmap }, 56 { "CPU map/unmap", amdgpu_bo_map_unmap },
57 { "Memory alloc Test", amdgpu_memory_alloc },
56 CU_TEST_INFO_NULL, 58 CU_TEST_INFO_NULL,
57}; 59};
58 60
@@ -195,3 +197,50 @@ static void amdgpu_bo_map_unmap(void)
195 r = amdgpu_bo_cpu_unmap(buffer_handle); 197 r = amdgpu_bo_cpu_unmap(buffer_handle);
196 CU_ASSERT_EQUAL(r, 0); 198 CU_ASSERT_EQUAL(r, 0);
197} 199}
200
201static void amdgpu_memory_alloc(void)
202{
203 amdgpu_bo_handle bo;
204 amdgpu_va_handle va_handle;
205 uint64_t bo_mc;
206 int r;
207
208 /* Test visible VRAM */
209 bo = gpu_mem_alloc(device_handle,
210 4096, 4096,
211 AMDGPU_GEM_DOMAIN_VRAM,
212 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
213 &bo_mc, &va_handle);
214
215 r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
216 CU_ASSERT_EQUAL(r, 0);
217
218 /* Test invisible VRAM */
219 bo = gpu_mem_alloc(device_handle,
220 4096, 4096,
221 AMDGPU_GEM_DOMAIN_VRAM,
222 AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
223 &bo_mc, &va_handle);
224
225 r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
226 CU_ASSERT_EQUAL(r, 0);
227
228 /* Test GART Cacheable */
229 bo = gpu_mem_alloc(device_handle,
230 4096, 4096,
231 AMDGPU_GEM_DOMAIN_GTT,
232 0, &bo_mc, &va_handle);
233
234 r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
235 CU_ASSERT_EQUAL(r, 0);
236
237 /* Test GART USWC */
238 bo = gpu_mem_alloc(device_handle,
239 4096, 4096,
240 AMDGPU_GEM_DOMAIN_GTT,
241 AMDGPU_GEM_CREATE_CPU_GTT_USWC,
242 &bo_mc, &va_handle);
243
244 r = gpu_mem_free(bo, va_handle, bo_mc, 4096);
245 CU_ASSERT_EQUAL(r, 0);
246}