[virglrenderer-devel] [PATCH 02/16] tests: Check if multisample is available before running tests
Jakob Bornecrantz
jakob.bornecrantz at collabora.com
Fri Dec 22 18:57:42 UTC 2017
From: Elie Tournier <elie.tournier at collabora.com>
Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz at collabora.com>
---
tests/test_virgl_resource.c | 7 +++++++
tests/testvirgl.c | 23 +++++++++++++++++++++++
tests/testvirgl.h | 1 +
3 files changed, 31 insertions(+)
diff --git a/tests/test_virgl_resource.c b/tests/test_virgl_resource.c
index dd60611..007bff2 100644
--- a/tests/test_virgl_resource.c
+++ b/tests/test_virgl_resource.c
@@ -260,6 +260,13 @@ START_TEST(virgl_res_tests)
ret = testvirgl_init_single_ctx();
ck_assert_int_eq(ret, 0);
+ /* Do not test if multisample is not available */
+ unsigned multisample = testvirgl_get_multisample_from_caps();
+ if (!multisample) {
+ testvirgl_fini_single_ctx();
+ return;
+ }
+
ret = virgl_renderer_resource_create(&testlist[_i].args, NULL, 0);
ck_assert_int_eq(ret, testlist[_i].retval);
diff --git a/tests/testvirgl.c b/tests/testvirgl.c
index a7c8043..f610c33 100644
--- a/tests/testvirgl.c
+++ b/tests/testvirgl.c
@@ -288,3 +288,26 @@ uint32_t testvirgl_get_glsl_level_from_caps(void)
return glsl_level;
}
+
+unsigned testvirgl_get_multisample_from_caps(void)
+{
+ uint32_t max_ver, max_size;
+ unsigned multisample;
+ void *caps;
+
+ virgl_renderer_get_cap_set(1, &max_ver, &max_size);
+ ck_assert_int_eq(max_ver, 1);
+ ck_assert_int_ne(max_size, 0);
+ ck_assert_int_eq(max_size, sizeof(struct virgl_caps_v1));
+
+ caps = malloc(max_size);
+
+ virgl_renderer_fill_caps(0, 0, caps);
+
+ struct virgl_caps_v1 *v1 = (struct virgl_caps_v1*) caps;
+ multisample = v1->bset.texture_multisample;
+
+ free(caps);
+
+ return multisample;
+}
diff --git a/tests/testvirgl.h b/tests/testvirgl.h
index 28b15d0..3baf724 100644
--- a/tests/testvirgl.h
+++ b/tests/testvirgl.h
@@ -78,4 +78,5 @@ int testvirgl_create_backed_simple_buffer(struct virgl_resource *res,
int handle, int size, int bind);
void testvirgl_destroy_backed_res(struct virgl_resource *res);
uint32_t testvirgl_get_glsl_level_from_caps(void);
+unsigned testvirgl_get_multisample_from_caps(void);
#endif
--
2.11.0
More information about the virglrenderer-devel
mailing list