panfrost: Import render condition check from fd

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8292>
This commit is contained in:
Alyssa Rosenzweig 2020-12-31 23:44:32 -05:00
parent 7ba4c5450c
commit f2b6c49b33
2 changed files with 22 additions and 0 deletions

View file

@ -344,6 +344,9 @@ panfrost_flush(
struct pipe_fence_handle **fence,
unsigned flags);
bool
pan_render_condition_check(struct pipe_context *pctx);
mali_ptr panfrost_sfbd_fragment(struct panfrost_batch *batch, bool has_draws);
mali_ptr panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws);

View file

@ -52,6 +52,25 @@
#include "decode.h"
#include "panfrost-quirks.h"
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,