tests: Check if multisample is available before running tests

Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Elie Tournier 7 years ago committed by Dave Airlie
parent a4fbf0d8a5
commit 8007cc0b12
  1. 7
      tests/test_virgl_resource.c
  2. 23
      tests/testvirgl.c
  3. 1
      tests/testvirgl.h

@ -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);

@ -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;
}

@ -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

Loading…
Cancel
Save