[Mesa-dev] [PATCH 5/9] i965: Replace open-coded gen6 queryobj offsets with simple helpers

Ian Romanick idr at freedesktop.org
Thu Jun 15 00:13:51 UTC 2017


On 06/09/2017 06:01 AM, Chris Wilson wrote:
> Lots of places open-coded the assumed layout of the predicate/results
> within the query object, replace those with simple helpers.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Cc: Matt Turner <mattst88 at gmail.com>
> ---
>  src/mesa/drivers/dri/i965/brw_conditional_render.c |  4 ++--
>  src/mesa/drivers/dri/i965/brw_context.h            | 14 ++++++++++++++
>  src/mesa/drivers/dri/i965/gen6_queryobj.c          |  6 +++---
>  src/mesa/drivers/dri/i965/hsw_queryobj.c           | 18 +++++++++---------
>  4 files changed, 28 insertions(+), 14 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_conditional_render.c b/src/mesa/drivers/dri/i965/brw_conditional_render.c
> index 046a42b5f5..197c35efe2 100644
> --- a/src/mesa/drivers/dri/i965/brw_conditional_render.c
> +++ b/src/mesa/drivers/dri/i965/brw_conditional_render.c
> @@ -66,13 +66,13 @@ set_predicate_for_occlusion_query(struct brw_context *brw,
>                             query->bo,
>                             I915_GEM_DOMAIN_INSTRUCTION,
>                             0, /* write domain */
> -                           0 /* offset */);
> +                           gen6_query_results_offset(query, 0));
>     brw_load_register_mem64(brw,
>                             MI_PREDICATE_SRC1,
>                             query->bo,
>                             I915_GEM_DOMAIN_INSTRUCTION,
>                             0, /* write domain */
> -                           8 /* offset */);
> +                           gen6_query_results_offset(query, 1));
>  }
>  
>  static void
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index d1503312d4..c5acb83ad0 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -427,6 +427,20 @@ struct brw_query_object {
>     bool flushed;
>  };
>  
> +#define GEN6_QUERY_PREDICATE (2)
> +#define GEN6_QUERY_RESULTS (0)
> +
> +static inline unsigned gen6_query_predicate_offset(const struct brw_query_object *query)

static inline unsigned
gen6_query_predicate_offset(const struct brw_query_object *query)

> +{
> +   return GEN6_QUERY_PREDICATE * sizeof(uint64_t);
> +}
> +
> +static inline unsigned gen6_query_results_offset(const struct brw_query_object *query,
> +                                                unsigned idx)

ditto.

> +{
> +   return (GEN6_QUERY_RESULTS + idx) * sizeof(uint64_t);
> +}
> +
>  enum brw_gpu_ring {
>     UNKNOWN_RING,
>     RENDER_RING,


More information about the mesa-dev mailing list