panfrost: Rename and move pan_render_condition_check()
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 14 Jan 2021 13:41:10 +0000 (14:41 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 2 Feb 2021 08:04:15 +0000 (09:04 +0100)
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>

src/gallium/drivers/panfrost/pan_blit.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h
src/gallium/drivers/panfrost/pan_resource.c

index 610cee2..9013a8c 100644 (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))
index b09a821..fe3e0e4 100644 (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,
index 8a0ea8f..d1512fa 100644 (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);
index d4de275..ec1f37a 100644 (file)
 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,