diff options
-rw-r--r-- | src/gallium/drivers/virgl/virgl_context.c | 19 | ||||
-rw-r--r-- | src/gallium/drivers/virgl/virgl_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/virgl/virgl_screen.h | 1 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 987cdc38be2..3421c71a43d 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -869,6 +869,22 @@ static void virgl_draw_vbo(struct pipe_context *ctx, } +static void virgl_submit_cmd(struct virgl_winsys *vws, + struct virgl_cmd_buf *cbuf, + struct pipe_fence_handle **fence) +{ + if (unlikely(virgl_debug & VIRGL_DEBUG_SYNC)) { + struct pipe_fence_handle *sync_fence = NULL; + + vws->submit_cmd(vws, cbuf, &sync_fence); + + vws->fence_wait(vws, sync_fence, PIPE_TIMEOUT_INFINITE); + vws->fence_reference(vws, &sync_fence, NULL); + } else { + vws->submit_cmd(vws, cbuf, fence); + } +} + static void virgl_flush_eq(struct virgl_context *ctx, void *closure, struct pipe_fence_handle **fence) { @@ -887,7 +903,8 @@ static void virgl_flush_eq(struct virgl_context *ctx, void *closure, ctx->num_draws = ctx->num_compute = 0; virgl_transfer_queue_clear(&ctx->queue, ctx->cbuf); - rs->vws->submit_cmd(rs->vws, ctx->cbuf, fence); + + virgl_submit_cmd(rs->vws, ctx->cbuf, fence); /* Reserve some space for transfers. */ if (ctx->encoded_transfers) diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 684a2f98546..08e7fbe8b54 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -45,6 +45,7 @@ static const struct debug_named_value debug_options[] = { { "tgsi", VIRGL_DEBUG_TGSI, NULL }, { "emubgra", VIRGL_DEBUG_EMULATE_BGRA, "Enable tweak to emulate BGRA as RGBA on GLES hosts"}, { "bgraswz", VIRGL_DEBUG_BGRA_DEST_SWIZZLE, "Enable tweak to swizzle emulated BGRA on GLES hosts" }, + { "sync", VIRGL_DEBUG_SYNC, "Sync after every flush" }, DEBUG_NAMED_VALUE_END }; DEBUG_GET_ONCE_FLAGS_OPTION(virgl_debug, "VIRGL_DEBUG", debug_options, 0) diff --git a/src/gallium/drivers/virgl/virgl_screen.h b/src/gallium/drivers/virgl/virgl_screen.h index e27ceee7bda..b466c632136 100644 --- a/src/gallium/drivers/virgl/virgl_screen.h +++ b/src/gallium/drivers/virgl/virgl_screen.h @@ -32,6 +32,7 @@ enum virgl_debug_flags { VIRGL_DEBUG_TGSI = 1 << 1, VIRGL_DEBUG_EMULATE_BGRA = 1 << 2, VIRGL_DEBUG_BGRA_DEST_SWIZZLE = 1 << 3, + VIRGL_DEBUG_SYNC = 1 << 4, }; extern int virgl_debug; |