drm: Branch 'master' - 2 commits

[email protected] (Andrey Grodzovsky) Wed, 29 Nov 2017 15:38:20 +0000 (UTC)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 tests/amdgpu/amdgpu_test.c |    5 ++-
 tests/amdgpu/amdgpu_test.h |    5 +++
 tests/amdgpu/bo_tests.c    |    2 -
 tests/amdgpu/cs_tests.c    |   64 ++++++++++++++++++++++-----------------------
 4 files changed, 41 insertions(+), 35 deletions(-)

New commits:
commit aeab24aa9e074043965cf911f60a3736c4f6455d
Author: Andrey Grodzovsky <[email protected]>
Date:   Mon Nov 27 07:26:13 2017 -0500

    amdgpu: Dynamicly disable BO suite "Metadata" test.
    
    Disable the test instead of doing  #ifdef 0
    
    Signed-off-by: Andrey Grodzovsky <[email protected]>
    Reviewed-by: Christian König <[email protected]>

diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c
index e611276d..50da17ca 100644
--- a/tests/amdgpu/amdgpu_test.c
+++ b/tests/amdgpu/amdgpu_test.c
@@ -417,6 +417,9 @@ static void amdgpu_disable_suits()
 	*/
 	if (amdgpu_set_test_active(DEADLOCK_TESTS_STR, "compute ring block test", CU_FALSE))
 		fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
+
+	if (amdgpu_set_test_active(BO_TESTS_STR, "Metadata", CU_FALSE))
+		fprintf(stderr, "test deactivation failed - %s\n", CU_get_error_msg());
 }
 
 /* The main() function for setting up and running the tests.
diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c
index 53e76c1b..24698bcb 100644
--- a/tests/amdgpu/bo_tests.c
+++ b/tests/amdgpu/bo_tests.c
@@ -51,9 +51,7 @@ static void amdgpu_mem_fail_alloc(void);
 
 CU_TestInfo bo_tests[] = {
 	{ "Export/Import",  amdgpu_bo_export_import },
-#if 0
 	{ "Metadata",  amdgpu_bo_metadata },
-#endif
 	{ "CPU map/unmap",  amdgpu_bo_map_unmap },
 	{ "Memory alloc Test",  amdgpu_memory_alloc },
 	{ "Memory fail alloc Test",  amdgpu_mem_fail_alloc },
commit 1a129004a82d557695fad1a7b9c37fe18b00c79f
Author: Andrey Grodzovsky <[email protected]>
Date:   Fri Nov 24 15:50:51 2017 -0500

    amdgpu: Switch amdgpu CS tests enabling to the new way.
    
    Signed-off-by: Andrey Grodzovsky <[email protected]>
    Reviewed-by: Christian König <[email protected]>

diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c
index ee64152e..e611276d 100644
--- a/tests/amdgpu/amdgpu_test.c
+++ b/tests/amdgpu/amdgpu_test.c
@@ -146,7 +146,7 @@ static Suites_Active_Status suites_active_stat[] = {
 		},
 		{
 			.pName = CS_TESTS_STR,
-			.pActive = always_active,
+			.pActive = suite_cs_tests_enable,
 		},
 		{
 			.pName = VCE_TESTS_STR,
diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h
index 414fcb81..3238e05f 100644
--- a/tests/amdgpu/amdgpu_test.h
+++ b/tests/amdgpu/amdgpu_test.h
@@ -85,6 +85,11 @@ int suite_cs_tests_init();
 int suite_cs_tests_clean();
 
 /**
+ * Decide if the suite is enabled by default or not.
+ */
+CU_BOOL suite_cs_tests_enable(void);
+
+/**
  * Tests in cs test suite
  */
 extern CU_TestInfo cs_tests[];
diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c
index 3b2f17db..4880b74f 100644
--- a/tests/amdgpu/cs_tests.c
+++ b/tests/amdgpu/cs_tests.c
@@ -66,6 +66,26 @@ CU_TestInfo cs_tests[] = {
 	CU_TEST_INFO_NULL,
 };
 
+CU_BOOL suite_cs_tests_enable(void)
+{
+	if (amdgpu_device_initialize(drm_amdgpu[0], &major_version,
+					     &minor_version, &device_handle))
+		return CU_FALSE;
+
+	family_id = device_handle->info.family_id;
+
+	if (amdgpu_device_deinitialize(device_handle))
+		return CU_FALSE;
+
+
+	if (family_id >= AMDGPU_FAMILY_RV || family_id == AMDGPU_FAMILY_SI) {
+		printf("\n\nThe ASIC NOT support UVD, suite disabled\n");
+		return CU_FALSE;
+	}
+
+	return CU_TRUE;
+}
+
 int suite_cs_tests_init(void)
 {
 	amdgpu_bo_handle ib_result_handle;
@@ -90,11 +110,6 @@ int suite_cs_tests_init(void)
 	chip_rev = device_handle->info.chip_rev;
 	chip_id = device_handle->info.chip_external_rev;
 
-	if (family_id >= AMDGPU_FAMILY_RV || family_id == AMDGPU_FAMILY_SI) {
-		printf("\n\nThe ASIC NOT support UVD, all sub-tests will pass\n");
-		return CUE_SUCCESS;
-	}
-
 	r = amdgpu_cs_ctx_create(device_handle, &context_handle);
 	if (r)
 		return CUE_SINIT_FAILED;
@@ -119,24 +134,18 @@ int suite_cs_tests_clean(void)
 {
 	int r;
 
-	if (family_id >= AMDGPU_FAMILY_RV || family_id == AMDGPU_FAMILY_SI) {
-		r = amdgpu_device_deinitialize(device_handle);
-		if (r)
-			return CUE_SCLEAN_FAILED;
-	} else {
-		r = amdgpu_bo_unmap_and_free(ib_handle, ib_va_handle,
-					     ib_mc_address, IB_SIZE);
-		if (r)
-			return CUE_SCLEAN_FAILED;
-
-		r = amdgpu_cs_ctx_free(context_handle);
-		if (r)
-			return CUE_SCLEAN_FAILED;
-
-		r = amdgpu_device_deinitialize(device_handle);
-		if (r)
-			return CUE_SCLEAN_FAILED;
-	}
+	r = amdgpu_bo_unmap_and_free(ib_handle, ib_va_handle,
+				     ib_mc_address, IB_SIZE);
+	if (r)
+		return CUE_SCLEAN_FAILED;
+
+	r = amdgpu_cs_ctx_free(context_handle);
+	if (r)
+		return CUE_SCLEAN_FAILED;
+
+	r = amdgpu_device_deinitialize(device_handle);
+	if (r)
+		return CUE_SCLEAN_FAILED;
 
 	return CUE_SUCCESS;
 }
@@ -203,9 +212,6 @@ static void amdgpu_cs_uvd_create(void)
 	void *msg;
 	int i, r;
 
-	if (family_id >= AMDGPU_FAMILY_RV || family_id == AMDGPU_FAMILY_SI)
-		return;
-
 	req.alloc_size = 4*1024;
 	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
 
@@ -277,9 +283,6 @@ static void amdgpu_cs_uvd_decode(void)
 	uint8_t *ptr;
 	int i, r;
 
-	if (family_id >= AMDGPU_FAMILY_RV || family_id == AMDGPU_FAMILY_SI)
-                return;
-
 	req.alloc_size = 4*1024; /* msg */
 	req.alloc_size += 4*1024; /* fb */
 	if (family_id >= AMDGPU_FAMILY_VI)
@@ -419,9 +422,6 @@ static void amdgpu_cs_uvd_destroy(void)
 	void *msg;
 	int i, r;
 
-	if (family_id >= AMDGPU_FAMILY_RV || family_id == AMDGPU_FAMILY_SI)
-                return;
-
 	req.alloc_size = 4*1024;
 	req.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

--
_______________________________________________
Dri-patches mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-patches