diff --git a/tests/test_virgl_transfer.c b/tests/test_virgl_transfer.c index 6748e50..d185ae5 100644 --- a/tests/test_virgl_transfer.c +++ b/tests/test_virgl_transfer.c @@ -733,7 +733,7 @@ START_TEST(virgl_test_transfer_to_staging_without_iov_fails) static const unsigned bufsize = 50; struct virgl_context ctx; struct virgl_resource res; - struct pipe_box box; + struct pipe_box box = {.width = bufsize, .height = 1, .depth = 1}; int ret; ret = testvirgl_init_ctx_cmdbuf(&ctx); @@ -760,7 +760,7 @@ START_TEST(virgl_test_transfer_to_staging_with_iov_succeeds) static const unsigned bufsize = 50; struct virgl_context ctx = {0}; struct virgl_resource res = {0}; - struct pipe_box box = {0}; + struct pipe_box box = {.width = bufsize, .height = 1, .depth = 1}; int ret; ret = testvirgl_init_ctx_cmdbuf(&ctx); @@ -789,7 +789,7 @@ START_TEST(virgl_test_copy_transfer_from_staging_without_iov_fails) struct virgl_context ctx = {0}; struct virgl_resource src_res = {0}; struct virgl_resource dst_res = {0}; - struct pipe_box box = {0}; + struct pipe_box box = {.width = bufsize, .height = 1, .depth = 1}; int ret; ret = testvirgl_init_ctx_cmdbuf(&ctx); @@ -824,7 +824,7 @@ START_TEST(virgl_test_copy_transfer_from_staging_with_iov_succeeds) struct virgl_context ctx = {0}; struct virgl_resource src_res = {0}; struct virgl_resource dst_res = {0}; - struct pipe_box box = {0}; + struct pipe_box box = {.width = bufsize, .height = 1, .depth = 1}; int ret; ret = testvirgl_init_ctx_cmdbuf(&ctx); @@ -854,25 +854,25 @@ END_TEST START_TEST(virgl_test_copy_transfer_to_staging_without_iov_fails) { + static const unsigned bufsize = 50; const unsigned synchronized = 1; struct virgl_context ctx = {0}; struct virgl_resource src_res = {0}; struct virgl_resource dst_res = {0}; - struct pipe_box box = {0}; + struct pipe_box box = {.width = bufsize, .height = 1, .depth = 1}; int ret; ret = testvirgl_init_ctx_cmdbuf(&ctx); ck_assert_int_eq(ret, 0); - ret = testvirgl_create_backed_simple_buffer(&src_res, 1, 50, VIRGL_BIND_STAGING); + ret = testvirgl_create_backed_simple_buffer(&src_res, 1, bufsize, VIRGL_BIND_STAGING); ck_assert_int_eq(ret, 0); virgl_renderer_ctx_attach_resource(ctx.ctx_id, src_res.handle); - ret = testvirgl_create_unbacked_simple_buffer(&dst_res, 2, 50, VIRGL_BIND_STAGING); + ret = testvirgl_create_unbacked_simple_buffer(&dst_res, 2, bufsize, VIRGL_BIND_STAGING); ck_assert_int_eq(ret, 0); virgl_renderer_ctx_attach_resource(ctx.ctx_id, dst_res.handle); - box.width = 50; virgl_encoder_copy_transfer(&ctx, &dst_res, 0, 0, &box, &src_res, 0, synchronized); ret = virgl_renderer_submit_cmd(ctx.cbuf->buf, ctx.ctx_id, ctx.cbuf->cdw); @@ -885,27 +885,28 @@ START_TEST(virgl_test_copy_transfer_to_staging_without_iov_fails) testvirgl_fini_ctx_cmdbuf(&ctx); } END_TEST + START_TEST(virgl_test_copy_transfer_to_staging_with_iov_succeeds) { + static const unsigned bufsize = 50; const unsigned synchronized = 1; struct virgl_context ctx = {0}; struct virgl_resource src_res = {0}; struct virgl_resource dst_res = {0}; - struct pipe_box box = {0}; + struct pipe_box box = {.width = bufsize, .height = 1, .depth = 1}; int ret; ret = testvirgl_init_ctx_cmdbuf(&ctx); ck_assert_int_eq(ret, 0); - ret = testvirgl_create_backed_simple_buffer(&src_res, 1, 50, VIRGL_BIND_STAGING); + ret = testvirgl_create_backed_simple_buffer(&src_res, 1, bufsize, VIRGL_BIND_STAGING); ck_assert_int_eq(ret, 0); virgl_renderer_ctx_attach_resource(ctx.ctx_id, src_res.handle); - ret = testvirgl_create_backed_simple_buffer(&dst_res, 2, 50, VIRGL_BIND_STAGING); + ret = testvirgl_create_backed_simple_buffer(&dst_res, 2, bufsize, VIRGL_BIND_STAGING); ck_assert_int_eq(ret, 0); virgl_renderer_ctx_attach_resource(ctx.ctx_id, dst_res.handle); - box.width = 50; virgl_encoder_copy_transfer(&ctx, &dst_res, 0, 0, &box, &src_res, 0, synchronized); ret = virgl_renderer_submit_cmd(ctx.cbuf->buf, ctx.ctx_id, ctx.cbuf->cdw);