diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2015-02-26 21:19:30 +0100 |
---|---|---|
committer | Dave Airlie <airlied@gmail.com> | 2015-02-27 13:20:24 +1000 |
commit | 0d033a1380adbc9de5233d329750c2e35abb8f2d (patch) | |
tree | a546461ebc87b7e7b5e76292604385f4cc368a6d /tests | |
parent | b76bbe4f22859d3b2b0a5a1b287d58ef9133154b (diff) |
tests: add testvirgl_create_backed_simple_1d_res
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testvirgl.c | 26 | ||||
-rw-r--r-- | tests/testvirgl.h | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/testvirgl.c b/tests/testvirgl.c index f0d44eb..e1c30b9 100644 --- a/tests/testvirgl.c +++ b/tests/testvirgl.c @@ -189,6 +189,32 @@ int testvirgl_create_backed_simple_2d_res(struct virgl_resource *res, return 0; } +int testvirgl_create_backed_simple_1d_res(struct virgl_resource *res, + int handle) +{ + struct virgl_renderer_resource_create_args args; + uint32_t backing_size; + int ret; + + testvirgl_init_simple_1d_resource(&args, handle); + ret = virgl_renderer_resource_create(&args, NULL, 0); + ck_assert_int_eq(ret, 0); + + res->handle = handle; + res->base.target = args.target; + res->base.format = args.format; + + backing_size = args.width * util_format_get_blocksize(res->base.format); + res->iovs = malloc(sizeof(struct iovec)); + + res->iovs[0].iov_base = malloc(backing_size); + res->iovs[0].iov_len = backing_size; + res->niovs = 1; + + virgl_renderer_resource_attach_iov(res->handle, res->iovs, res->niovs); + return 0; +} + void testvirgl_destroy_backed_res(struct virgl_resource *res) { struct iovec *iovs; diff --git a/tests/testvirgl.h b/tests/testvirgl.h index 1b0b3b0..497957e 100644 --- a/tests/testvirgl.h +++ b/tests/testvirgl.h @@ -68,6 +68,8 @@ uint32_t testvirgl_get_last_fence(void); int testvirgl_init_ctx_cmdbuf(struct virgl_context *ctx); void testvirgl_fini_ctx_cmdbuf(struct virgl_context *ctx); +int testvirgl_create_backed_simple_1d_res(struct virgl_resource *res, + int handle); int testvirgl_create_backed_simple_2d_res(struct virgl_resource *res, int handle, int w, int h); int testvirgl_create_backed_simple_buffer(struct virgl_resource *res, |