[Mesa-dev] [PATCH v2 4/5] i965: perf: add support for raw queries

Kenneth Graunke kenneth at whitecape.org
Tue Apr 17 07:07:31 UTC 2018


On Tuesday, April 3, 2018 7:48:12 AM PDT Lionel Landwerlin wrote:
> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c

These changes look good.

> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c b/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c
> new file mode 100644
> index 00000000000..cc315ceb4f8
> --- /dev/null
> +++ b/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c

I'm not going to review any of the MD-API stuff, as it isn't something I
can check with hardware docs and I don't really care to delve into
MD-API internals...

> +int
> +brw_perf_query_get_mdapi_oa_data(struct brw_context *brw,
> +                                 struct brw_perf_query_object *obj,
> +                                 size_t data_size,
> +                                 uint8_t *data)
> +{
> +   const struct gen_device_info *devinfo = &brw->screen->devinfo;
> +
> +   switch (devinfo->gen) {
> +   case 7: {
> +      struct mdapi_gen7_metrics *mdapi_data = (struct mdapi_gen7_metrics *) data;
> +
> +      if (data_size < sizeof(*mdapi_data))
> +         return 0;
> +
> +      assert(devinfo->is_haswell || devinfo->is_cherryview);

I hope not, Cherryview is Gen8. :)  Did you mean is_baytrail?  If so,
you could actually just do assert(!devinfo->is_ivybridge) if you wanted.

> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.h b/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.h
> new file mode 100644
> index 00000000000..e6da3a279e6
> --- /dev/null
> +++ b/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.h
> @@ -0,0 +1,39 @@
> +/*
> + * Copyright © 2018 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#ifndef BRW_PERFORMANCE_QUERY_MDAPI_H
> +#define BRW_PERFORMANCE_QUERY_MDAPI_H
> +
> +#include <stdint.h>
> +
> +struct brw_context;
> +
> +int brw_perf_query_get_mdapi_oa_data(struct brw_context *brw,
> +                                     struct brw_perf_query_object *obj,
> +                                     size_t data_size,
> +                                     uint8_t *data);
> +
> +void brw_perf_query_register_mdapi_oa_query(struct brw_context *brw);
> +
> +
> +#endif /* BRW_PERFORMANCE_QUERY_MDAPI_H */

Personally I'd just add these to brw_performance_query.h, not sure it's
worth adding a whole new header file for 2-3 prototypes... Up to you
though.

With the cherryview thing fixed,
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> diff --git a/src/mesa/drivers/dri/i965/meson.build b/src/mesa/drivers/dri/i965/meson.build
> index a73ca7807fe..249c9ddd755 100644
> --- a/src/mesa/drivers/dri/i965/meson.build
> +++ b/src/mesa/drivers/dri/i965/meson.build
> @@ -56,6 +56,8 @@ files_i965 = files(
>    'brw_pipe_control.c',
>    'brw_performance_query.h',
>    'brw_performance_query.c',
> +  'brw_performance_query_mdapi.h',
> +  'brw_performance_query_mdapi.c',
>    'brw_performance_query_metrics.h',
>    'brw_program.c',
>    'brw_program.h',
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180417/8f0590a6/attachment.sig>


More information about the mesa-dev mailing list