vtest: make vtest_renderer_create_fence internal

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Chia-I Wu 4 years ago
parent a3e1ce9a91
commit 76b87509b2
  1. 1
      vtest/vtest.h
  2. 5
      vtest/vtest_fuzzer.c
  3. 30
      vtest/vtest_renderer.c
  4. 5
      vtest/vtest_server.c

@ -75,7 +75,6 @@ int vtest_buf_read(struct vtest_input *input, void *buf, int size);
int vtest_resource_busy_wait(uint32_t length_dw); int vtest_resource_busy_wait(uint32_t length_dw);
int vtest_resource_busy_wait_nop(uint32_t length_dw); int vtest_resource_busy_wait_nop(uint32_t length_dw);
int vtest_renderer_create_fence(void);
int vtest_poll(void); int vtest_poll(void);
int vtest_ping_protocol_version(uint32_t length_dw); int vtest_ping_protocol_version(uint32_t length_dw);

@ -136,11 +136,6 @@ static void vtest_fuzzer_run_renderer(int out_fd, struct vtest_input *input,
if (ret < 0) { if (ret < 0) {
break; break;
} }
/* GL draws are fenced, while possible fence creations are too */
if ((header[1] == VCMD_SUBMIT_CMD || header[1] == VCMD_RESOURCE_CREATE ||
header[1] == VCMD_RESOURCE_CREATE2))
vtest_renderer_create_fence();
} while (1); } while (1);
if (context) { if (context) {

@ -93,6 +93,20 @@ struct vtest_renderer {
struct vtest_context *current_context; struct vtest_context *current_context;
}; };
/*
* A fence is created after
*
* - VCMD_RESOURCE_CREATE
* - VCMD_RESOURCE_CREATE2
* - VCMD_SUBMIT_CMD
*
* for VCMD_RESOURCE_BUSY_WAIT to wait on.
*/
static void vtest_renderer_create_fence(struct vtest_renderer *renderer)
{
virgl_renderer_create_fence(renderer->fence_id++, 0);
}
static void vtest_write_fence(UNUSED void *cookie, uint32_t fence_id_in) static void vtest_write_fence(UNUSED void *cookie, uint32_t fence_id_in)
{ {
struct vtest_renderer *renderer = (struct vtest_renderer*)cookie; struct vtest_renderer *renderer = (struct vtest_renderer*)cookie;
@ -886,6 +900,9 @@ static int vtest_create_resource_internal(struct vtest_context *ctx,
util_hash_table_set(ctx->resource_table, intptr_to_pointer(res->res_id), res); util_hash_table_set(ctx->resource_table, intptr_to_pointer(res->res_id), res);
if (cmd_id == VCMD_RESOURCE_CREATE || cmd_id == VCMD_RESOURCE_CREATE2)
vtest_renderer_create_fence(&renderer);
return 0; return 0;
} }
@ -1060,7 +1077,11 @@ int vtest_submit_cmd(uint32_t length_dw)
ret = virgl_renderer_submit_cmd(cbuf, ctx->ctx_id, length_dw); ret = virgl_renderer_submit_cmd(cbuf, ctx->ctx_id, length_dw);
free(cbuf); free(cbuf);
return ret ? -1 : 0; if (ret)
return -1;
vtest_renderer_create_fence(&renderer);
return 0;
} }
struct vtest_transfer_args { struct vtest_transfer_args {
@ -1438,13 +1459,6 @@ int vtest_resource_busy_wait_nop(UNUSED uint32_t length_dw)
return 0; return 0;
} }
int vtest_renderer_create_fence(void)
{
struct vtest_context *ctx = vtest_get_current_context();
virgl_renderer_create_fence(renderer.fence_id++, ctx->ctx_id);
return 0;
}
int vtest_poll(void) int vtest_poll(void)
{ {
virgl_renderer_poll(); virgl_renderer_poll();

@ -666,11 +666,6 @@ static int vtest_client_dispatch_commands(struct vtest_client *client)
return VTEST_CLIENT_ERROR_COMMAND_DISPATCH; return VTEST_CLIENT_ERROR_COMMAND_DISPATCH;
} }
/* GL draws are fenced, while possible fence creations are too */
if (header[1] == VCMD_SUBMIT_CMD || header[1] == VCMD_RESOURCE_CREATE ||
header[1] == VCMD_RESOURCE_CREATE2)
vtest_renderer_create_fence();
return 0; return 0;
} }

Loading…
Cancel
Save