panfrost: Rename and move pan_render_condition_check()

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8808>
This commit is contained in:
Boris Brezillon
2021-01-14 14:41:10 +01:00
parent 3913089d2d
commit d78f686ad1
4 changed files with 24 additions and 23 deletions
+2 -1
View File
@@ -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))
+21 -2
View File
@@ -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,
+1 -1
View File
@@ -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);
@@ -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,