tests: add testvirgl_create_backed_simple_1d_res

macos/master
Marc-André Lureau 10 years ago committed by Dave Airlie
parent b76bbe4f22
commit 0d033a1380
  1. 26
      tests/testvirgl.c
  2. 2
      tests/testvirgl.h

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

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

Loading…
Cancel
Save