[Mesa-dev] [PATCH] mesa: Fix performance query id check

Manolova, Plamena plamena.manolova at intel.com
Sun Feb 26 23:55:05 UTC 2017


Looks good to me :)

Reviewed-by: Plamena Manolova <plamena.manolova at intel.com>

On Fri, Feb 24, 2017 at 6:46 PM, Robert Bragg <robert at sixbynine.org> wrote:

> In queryid_valid() index is unsigned so checking if it is less
> than zero is useless. On queryid_to_index() is comment
> saying 0 is reserved to be invalid thus rule it out.
>
> This is a v2 of a fix for an issue identified by Juha-Pekka (thanks)
> and the commit message is gratuitously stolen.
>
> Cc: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> Signed-off-by: Robert Bragg <robert at sixbynine.org>
> ---
>  src/mesa/main/performance_query.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/performance_query.c
> b/src/mesa/main/performance_query.c
> index aa103516a5..56f6a7da8b 100644
> --- a/src/mesa/main/performance_query.c
> +++ b/src/mesa/main/performance_query.c
> @@ -90,8 +90,12 @@ index_to_queryid(unsigned index)
>  static inline bool
>  queryid_valid(const struct gl_context *ctx, unsigned numQueries, GLuint
> queryid)
>  {
> -   GLuint index = queryid_to_index(queryid);
> -   return index >= 0 && index < numQueries;
> +   /* The GL_INTEL_performance_query spec says:
> +    *
> +    *  "Performance counter ids values start with 1. Performance counter
> id 0
> +    *  is reserved as an invalid counter."
> +    */
> +   return queryid != 0 && queryid_to_index(queryid) < numQueries;
>  }
>
>  static inline GLuint
> --
> 2.11.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170227/9c980820/attachment-0001.html>


More information about the mesa-dev mailing list