From d78f686ad1c523f1ac3fafc01d6895f05dc303c2 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 14 Jan 2021 14:41:10 +0100 Subject: [PATCH] panfrost: Rename and move pan_render_condition_check() Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_blit.c | 3 ++- src/gallium/drivers/panfrost/pan_context.c | 23 +++++++++++++++++++-- src/gallium/drivers/panfrost/pan_context.h | 2 +- src/gallium/drivers/panfrost/pan_resource.c | 19 ----------------- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_blit.c b/src/gallium/drivers/panfrost/pan_blit.c index 610cee2e53d..9013a8c60dc 100644 --- a/src/gallium/drivers/panfrost/pan_blit.c +++ b/src/gallium/drivers/panfrost/pan_blit.c @@ -94,7 +94,8 @@ panfrost_blit(struct pipe_context *pipe, * u_blitter. We could do a little better by culling * vertex jobs, though. */ - if (info->render_condition_enable && !pan_render_condition_check(pipe)) + if (info->render_condition_enable && + !panfrost_render_condition_check(pan_context(pipe))) return; if (panfrost_u_blitter_blit(pipe, info)) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index b09a82166d7..fe3e0e4e39c 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -131,7 +131,7 @@ panfrost_clear( { struct panfrost_context *ctx = pan_context(pipe); - if (!pan_render_condition_check(pipe)) + if (!panfrost_render_condition_check(ctx)) return; /* TODO: panfrost_get_fresh_batch_for_fbo() instantiates a new batch if @@ -496,7 +496,7 @@ panfrost_draw_vbo( struct panfrost_context *ctx = pan_context(pipe); struct panfrost_device *device = pan_device(ctx->base.screen); - if (!pan_render_condition_check(pipe)) + if (!panfrost_render_condition_check(ctx)) return; /* First of all, check the scissor to see if anything is drawn at all. @@ -1561,6 +1561,25 @@ panfrost_get_query_result(struct pipe_context *pipe, return true; } +bool +panfrost_render_condition_check(struct panfrost_context *ctx) +{ + if (!ctx->cond_query) + return true; + + union pipe_query_result res = { 0 }; + bool wait = + ctx->cond_mode != PIPE_RENDER_COND_NO_WAIT && + ctx->cond_mode != PIPE_RENDER_COND_BY_REGION_NO_WAIT; + + struct pipe_query *pq = (struct pipe_query *)ctx->cond_query; + + if (panfrost_get_query_result(&ctx->base, pq, wait, &res)) + return res.u64 != ctx->cond_cond; + + return true; +} + static struct pipe_stream_output_target * panfrost_create_stream_output_target(struct pipe_context *pctx, struct pipe_resource *prsc, diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 8a0ea8fdf0c..d1512fa579b 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -351,7 +351,7 @@ panfrost_flush( unsigned flags); bool -pan_render_condition_check(struct pipe_context *pctx); +panfrost_render_condition_check(struct panfrost_context *ctx); mali_ptr panfrost_sfbd_fragment(struct panfrost_batch *batch, bool has_draws); mali_ptr panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws); diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index d4de275cd40..ec1f37a4ce8 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -55,25 +55,6 @@ static bool panfrost_should_checksum(const struct panfrost_device *dev, const struct panfrost_resource *pres); -bool -pan_render_condition_check(struct pipe_context *pctx) -{ - struct panfrost_context *ctx = pan_context(pctx); - - if (!ctx->cond_query) - return true; - - union pipe_query_result res = { 0 }; - bool wait = - ctx->cond_mode != PIPE_RENDER_COND_NO_WAIT && - ctx->cond_mode != PIPE_RENDER_COND_BY_REGION_NO_WAIT; - - if (pctx->get_query_result(pctx, (struct pipe_query *) ctx->cond_query, wait, &res)) - return (bool)res.u64 != ctx->cond_cond; - - return true; -} - static struct pipe_resource * panfrost_resource_from_handle(struct pipe_screen *pscreen, const struct pipe_resource *templat,