summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjqdeng <Emily.Deng@amd.com>2016-07-05 15:45:33 +0800
committerQiang Yu <Qiang.Yu@amd.com>2017-05-17 11:10:47 +0800
commita76591320ae15e695086290e86ee8851871a9720 (patch)
tree7180a26a3a0a4dfd58885f982605707c3e292b77
parentf55770906f308f5033e5b1f82922a9910d7bf46f (diff)
amdgpu/tests: Add the test case for amdgpu_get_fb_id and amdgpu_get_bo_from_fb_id v2
v2: 502c3f21127b5253c46ae23bdd563dbce4fb57ae [Flora Cui] stop fb_id test for ASIC without output Signed-off-by: jqdeng <Emily.Deng@amd.com> Reviewed-by: Chunming Zhou <David1.Zhou@amd.com> Signed-off-by: Flora Cui <Flora.Cui@amd.com>
-rw-r--r--tests/amdgpu/bo_tests.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c
index 74b5e77b..83f42a9c 100644
--- a/tests/amdgpu/bo_tests.c
+++ b/tests/amdgpu/bo_tests.c
@@ -46,6 +46,8 @@ static amdgpu_va_handle va_handle;
static void amdgpu_bo_export_import(void);
static void amdgpu_bo_metadata(void);
static void amdgpu_bo_map_unmap(void);
+static void amdgpu_get_fb_id_and_handle(void);
+
CU_TestInfo bo_tests[] = {
{ "Export/Import", amdgpu_bo_export_import },
@@ -53,6 +55,7 @@ CU_TestInfo bo_tests[] = {
{ "Metadata", amdgpu_bo_metadata },
#endif
{ "CPU map/unmap", amdgpu_bo_map_unmap },
+ { "GET FB_ID AND FB_HANDLE", amdgpu_get_fb_id_and_handle },
CU_TEST_INFO_NULL,
};
@@ -195,3 +198,22 @@ static void amdgpu_bo_map_unmap(void)
r = amdgpu_bo_cpu_unmap(buffer_handle);
CU_ASSERT_EQUAL(r, 0);
}
+
+static void amdgpu_get_fb_id_and_handle(void)
+{
+ uint32_t *ptr;
+ int i, r;
+ unsigned int fb_id;
+ struct amdgpu_bo_import_result output;
+
+ r = amdgpu_get_fb_id(device_handle, &fb_id);
+ CU_ASSERT_EQUAL(r, 0);
+ if (fb_id == 0) {
+ fprintf(stderr, "\nSkipping amdgpu_get_fb_id_and_handle test: no monitor connected\n");
+ return;
+ }
+
+ r = amdgpu_get_bo_from_fb_id(device_handle, fb_id, &output);
+ CU_ASSERT_EQUAL(r, 0);
+ CU_ASSERT_NOT_EQUAL(output.buf_handle, 0);
+}