panfrost: Fix TLS sizing if cores are missing

I have no idea if there are any implementations we care about that have
missing shader cores (a mask of 1101 or something like that), but if one
crops up, this would be a royal pain to debug so let's just get it
right...

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
This commit is contained in:
Alyssa Rosenzweig 2021-01-07 18:22:54 -05:00 committed by Marge Bot
parent 26b009b054
commit a5780cdb9b
1 changed files with 7 additions and 1 deletions

View File

@ -91,7 +91,13 @@ panfrost_query_core_count(int fd)
unsigned mask = panfrost_query_raw(fd,
DRM_PANFROST_PARAM_SHADER_PRESENT, false, 0xffff);
return util_bitcount(mask);
/* Some cores might be absent. For TLS computation purposes, we care
* about the greatest ID + 1, which equals the core count if all cores
* are present, but allocates space for absent cores if needed.
* util_last_bit is defined to return the greatest bit set + 1, which
* is exactly what we need. */
return util_last_bit(mask);
}
/* Architectural maximums, since this register may be not implemented