tests: Make it possible to run the unit tests with EGL_SURFACELESS

For some reason it is not possible to create a normal EGL context when
a mesa software renderer is used as a backend, and hence the unit tests
will all fail. Make it possible to force a surfaceless EGL context by
specifying the environment variable

   VRENDTEST_USE_EGL_SURFACELESS=1

Reviewed-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
macos/master
Gert Wollny 6 years ago committed by Jakob Bornecrantz
parent 1905b38207
commit 5a472049a3
  1. 3
      tests/test_virgl_cmd.c
  2. 19
      tests/test_virgl_init.c
  3. 3
      tests/test_virgl_resource.c
  4. 3
      tests/test_virgl_transfer.c
  5. 4
      tests/testvirgl.c
  6. 2
      tests/testvirgl.h

@ -1040,6 +1040,9 @@ int main(void)
SRunner *sr; SRunner *sr;
int number_failed; int number_failed;
if (getenv("VRENDTEST_USE_EGL_SURFACELESS"))
context_flags |= VIRGL_RENDERER_USE_SURFACELESS;
s = virgl_init_suite(); s = virgl_init_suite();
sr = srunner_create(s); sr = srunner_create(s);

@ -74,7 +74,7 @@ START_TEST(virgl_init_egl)
{ {
int ret; int ret;
test_cbs.version = 1; test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs); ret = virgl_renderer_init(&mystruct, context_flags, &test_cbs);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
virgl_renderer_cleanup(&mystruct); virgl_renderer_cleanup(&mystruct);
} }
@ -85,7 +85,7 @@ START_TEST(virgl_init_egl_create_ctx)
{ {
int ret; int ret;
test_cbs.version = 1; test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs); ret = virgl_renderer_init(&mystruct, context_flags, &test_cbs);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
ret = virgl_renderer_context_create(1, strlen("test1"), "test1"); ret = virgl_renderer_context_create(1, strlen("test1"), "test1");
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
@ -100,7 +100,7 @@ START_TEST(virgl_init_egl_create_ctx_0)
int ret; int ret;
test_cbs.version = 1; test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs); ret = virgl_renderer_init(&mystruct, context_flags, &test_cbs);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
ret = virgl_renderer_context_create(0, strlen("test1"), "test1"); ret = virgl_renderer_context_create(0, strlen("test1"), "test1");
ck_assert_int_eq(ret, EINVAL); ck_assert_int_eq(ret, EINVAL);
@ -113,7 +113,7 @@ START_TEST(virgl_init_egl_destroy_ctx_illegal)
{ {
int ret; int ret;
test_cbs.version = 1; test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs); ret = virgl_renderer_init(&mystruct, context_flags, &test_cbs);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
virgl_renderer_context_destroy(1); virgl_renderer_context_destroy(1);
@ -259,7 +259,7 @@ START_TEST(virgl_init_get_caps_set0)
uint32_t max_ver, max_size; uint32_t max_ver, max_size;
test_cbs.version = 1; test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs); ret = virgl_renderer_init(&mystruct, context_flags, &test_cbs);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
virgl_renderer_get_cap_set(0, &max_ver, &max_size); virgl_renderer_get_cap_set(0, &max_ver, &max_size);
@ -276,7 +276,7 @@ START_TEST(virgl_init_get_caps_set1)
uint32_t max_ver, max_size; uint32_t max_ver, max_size;
void *caps; void *caps;
test_cbs.version = 1; test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs); ret = virgl_renderer_init(&mystruct, context_flags, &test_cbs);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
virgl_renderer_get_cap_set(1, &max_ver, &max_size); virgl_renderer_get_cap_set(1, &max_ver, &max_size);
@ -299,7 +299,7 @@ START_TEST(virgl_init_get_caps_null)
uint32_t max_ver, max_size; uint32_t max_ver, max_size;
test_cbs.version = 1; test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs); ret = virgl_renderer_init(&mystruct, context_flags, &test_cbs);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
virgl_renderer_get_cap_set(1, &max_ver, &max_size); virgl_renderer_get_cap_set(1, &max_ver, &max_size);
@ -432,7 +432,7 @@ START_TEST(virgl_init_egl_create_ctx_create_attach_res_illegal_res)
struct iovec iovs[1]; struct iovec iovs[1];
test_cbs.version = 1; test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs); ret = virgl_renderer_init(&mystruct, context_flags, &test_cbs);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
ret = virgl_renderer_resource_attach_iov(1, iovs, 1); ret = virgl_renderer_resource_attach_iov(1, iovs, 1);
@ -495,6 +495,9 @@ int main(void)
SRunner *sr; SRunner *sr;
int number_failed; int number_failed;
if (getenv("VRENDTEST_USE_EGL_SURFACELESS"))
context_flags |= VIRGL_RENDERER_USE_SURFACELESS;
s = virgl_init_suite(); s = virgl_init_suite();
sr = srunner_create(s); sr = srunner_create(s);

@ -309,6 +309,9 @@ int main(void)
SRunner *sr; SRunner *sr;
int number_failed; int number_failed;
if (getenv("VRENDTEST_USE_EGL_SURFACELESS"))
context_flags |= VIRGL_RENDERER_USE_SURFACELESS;
s = virgl_init_suite(); s = virgl_init_suite();
sr = srunner_create(s); sr = srunner_create(s);

@ -781,6 +781,9 @@ int main(void)
SRunner *sr; SRunner *sr;
int number_failed; int number_failed;
if (getenv("VRENDTEST_USE_EGL_SURFACELESS"))
context_flags |= VIRGL_RENDERER_USE_SURFACELESS;
s = virgl_init_suite(); s = virgl_init_suite();
sr = srunner_create(s); sr = srunner_create(s);

@ -35,6 +35,8 @@
#include "virgl_hw.h" #include "virgl_hw.h"
#include "virglrenderer.h" #include "virglrenderer.h"
int context_flags = VIRGL_RENDERER_USE_EGL;
void testvirgl_init_simple_1d_resource(struct virgl_renderer_resource_create_args *res, int handle) void testvirgl_init_simple_1d_resource(struct virgl_renderer_resource_create_args *res, int handle)
{ {
res->handle = handle; res->handle = handle;
@ -116,7 +118,7 @@ int testvirgl_init_single_ctx(void)
test_cbs.version = 1; test_cbs.version = 1;
test_cbs.write_fence = testvirgl_write_fence; test_cbs.write_fence = testvirgl_write_fence;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs); ret = virgl_renderer_init(&mystruct, context_flags, &test_cbs);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
if (ret) if (ret)
return ret; return ret;

@ -30,6 +30,8 @@
#define VIRGL_MAX_CMDBUF_DWORDS (16*1024) #define VIRGL_MAX_CMDBUF_DWORDS (16*1024)
extern int context_flags;
struct virgl_cmd_buf { struct virgl_cmd_buf {
unsigned cdw; unsigned cdw;
uint32_t *buf; uint32_t *buf;

Loading…
Cancel
Save