mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-16 13:40:29 +01:00
panfrost: Add routines to calculate stack size/shift
These implement the aforementioned formulas. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
e6f8ef93ca
commit
eac9247b2d
2 changed files with 31 additions and 0 deletions
|
|
@ -66,4 +66,15 @@ panfrost_choose_hierarchy_mask(
|
|||
unsigned width, unsigned height,
|
||||
unsigned vertex_count, bool hierarchy);
|
||||
|
||||
/* Stack sizes */
|
||||
|
||||
unsigned
|
||||
panfrost_get_stack_shift(unsigned stack_size);
|
||||
|
||||
unsigned
|
||||
panfrost_get_total_stack_size(
|
||||
unsigned stack_shift,
|
||||
unsigned threads_per_core,
|
||||
unsigned core_count);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -77,3 +77,23 @@
|
|||
* There are other valid characterisations of this formula, of course, but this
|
||||
* is computationally simple, so good enough for our purposes.
|
||||
*/
|
||||
|
||||
/* Computes log_stack_size = ceil(log2(max(s, 256))) - 4 */
|
||||
|
||||
unsigned
|
||||
panfrost_get_stack_shift(unsigned stack_size)
|
||||
{
|
||||
return util_logbase2_ceil(MAX2(stack_size, 256)) - 4;
|
||||
}
|
||||
|
||||
/* Computes the aligned stack size given the shift and thread count */
|
||||
|
||||
unsigned
|
||||
panfrost_get_total_stack_size(
|
||||
unsigned stack_shift,
|
||||
unsigned threads_per_core,
|
||||
unsigned core_count)
|
||||
{
|
||||
unsigned stack_size = 1 << (stack_shift + 4);
|
||||
return stack_size * threads_per_core * core_count;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue