summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-04-18 15:34:46 -0700
committerChia-I Wu <[email protected]>2019-04-23 19:07:48 +0000
commitcc53815ae10dc39c7e56a3801568794a6ad8b539 (patch)
tree101c9b44e073d24ab5efc58b1bb409f687074b75 /src/gallium/drivers/virgl
parentec686a66dbf2180631564a3877884b1e4d0c8ea4 (diff)
virgl: skip empty cmdbufs
Several empty cmdbufs are submitted by app/xserver per frame, from glamor_block_handler for example. Let's skip them. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl')
-rw-r--r--src/gallium/drivers/virgl/virgl_context.c8
-rw-r--r--src/gallium/drivers/virgl/virgl_context.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index 69b56bfd036..b3119ee95cc 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -756,6 +756,12 @@ static void virgl_flush_eq(struct virgl_context *ctx, void *closure,
{
struct virgl_screen *rs = virgl_screen(ctx->base.screen);
+ /* skip empty cbuf */
+ if (ctx->cbuf->cdw == ctx->cbuf_initial_cdw &&
+ ctx->queue.num_dwords == 0 &&
+ !fence)
+ return;
+
if (ctx->num_draws)
u_upload_unmap(ctx->uploader);
@@ -773,6 +779,8 @@ static void virgl_flush_eq(struct virgl_context *ctx, void *closure,
/* add back current framebuffer resources to reference list? */
virgl_reemit_res(ctx);
+
+ ctx->cbuf_initial_cdw = ctx->cbuf->cdw;
}
static void virgl_flush_from_st(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/virgl/virgl_context.h b/src/gallium/drivers/virgl/virgl_context.h
index 1ac4ddb0541..828e72514a4 100644
--- a/src/gallium/drivers/virgl/virgl_context.h
+++ b/src/gallium/drivers/virgl/virgl_context.h
@@ -59,6 +59,7 @@ struct virgl_rasterizer_state {
struct virgl_context {
struct pipe_context base;
struct virgl_cmd_buf *cbuf;
+ unsigned cbuf_initial_cdw;
struct virgl_textures_info samplers[PIPE_SHADER_TYPES];
struct virgl_vertex_elements_state *vertex_elements;