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

Robert Bragg robert at sixbynine.org
Fri Feb 24 16:25:19 UTC 2017


Ah, oops, I think the id types iterated a few times over the lifetime
of the original patch. E.g. until pretty much the last moment before
landing it pass a signed int id to the backend.

I suppose it can be return queryid != 0 && queryid_to_index(queryid) <
numQueries

I'll also look to update the local piglit tests I have to try and
catch this case, they currently check for an invalid queryid searching
from UINT_MAX down until it finds one not matching the id of any
discovered query.

I can send out a fix if you don't beat me to it,
Thanks,
- Robert


On Fri, Feb 24, 2017 at 1:21 PM, Juha-Pekka Heikkila
<juhapekka.heikkila at gmail.com> wrote:
> Oops. Original code can never fail on zero id but my patch is also wrong.
> Please ignore this patch.
>
> /Juha-Pekka
>
>
> On 24.02.2017 15:10, Juha-Pekka Heikkila 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.
>>
>> CC: Robert Bragg <robert at sixbynine.org>
>> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
>> ---
>>  src/mesa/main/performance_query.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/performance_query.c
>> b/src/mesa/main/performance_query.c
>> index aa10351..079d3c8 100644
>> --- a/src/mesa/main/performance_query.c
>> +++ b/src/mesa/main/performance_query.c
>> @@ -91,7 +91,7 @@ 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;
>> +   return index != 0 && index < numQueries;
>>  }
>>
>>  static inline GLuint
>>
>


More information about the mesa-dev mailing list