tests: add flush callback to test large transfers

macos/master
Dave Airlie 10 years ago
parent 052835544f
commit c6fd7d55ac
  1. 7
      tests/testvirgl.c
  2. 1
      tests/testvirgl.h
  3. 10
      tests/testvirgl_encode.c

@ -131,6 +131,12 @@ void testvirgl_fini_single_ctx(void)
virgl_renderer_cleanup(&mystruct);
}
static void testvirgl_flush(struct virgl_context *ctx)
{
virgl_renderer_submit_cmd(ctx->cbuf->buf, ctx->ctx_id, ctx->cbuf->cdw);
ctx->cbuf->cdw = 0;
}
int testvirgl_init_ctx_cmdbuf(struct virgl_context *ctx)
{
int ret;
@ -138,6 +144,7 @@ int testvirgl_init_ctx_cmdbuf(struct virgl_context *ctx)
if (ret)
return ret;
ctx->flush = testvirgl_flush;
ctx->ctx_id = 1;
ctx->cbuf = CALLOC_STRUCT(virgl_cmd_buf);
if (!ctx->cbuf) {

@ -36,6 +36,7 @@ struct virgl_cmd_buf {
};
struct virgl_context {
void (*flush)(struct virgl_context *ctx);
struct virgl_cmd_buf *cbuf;
int ctx_id;
};

@ -13,10 +13,10 @@
static int virgl_encoder_write_cmd_dword(struct virgl_context *ctx,
uint32_t dword)
{
// int len = (dword >> 16);
int len = (dword >> 16);
// if ((ctx->cbuf->cdw + len + 1) > VIRGL_MAX_CMDBUF_DWORDS)
// ctx->base.flush(&ctx->base, NULL, 0);
if ((ctx->cbuf->cdw + len + 1) > VIRGL_MAX_CMDBUF_DWORDS)
ctx->flush(ctx);
virgl_encoder_write_dword(ctx->cbuf, dword);
return 0;
@ -426,8 +426,8 @@ int virgl_encoder_inline_write(struct virgl_context *ctx,
left_bytes = size;
while (left_bytes) {
// if (ctx->cbuf->cdw + 12 > VIRGL_MAX_CMDBUF_DWORDS)
// ctx->base.flush(&ctx->base, NULL, 0);
if (ctx->cbuf->cdw + 12 > VIRGL_MAX_CMDBUF_DWORDS)
ctx->flush(ctx);
thispass = (VIRGL_MAX_CMDBUF_DWORDS - ctx->cbuf->cdw - 12) * 4;

Loading…
Cancel
Save