<div dir="ltr"><div>num_pkrs is a hardware config parameter like the number of shader engines. It's constant for each chip.<br></div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 21, 2020 at 12:39 PM Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl">bas@basnieuwenhuizen.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Oct 21, 2020 at 6:09 PM Harry Wentland <<a href="mailto:harry.wentland@amd.com" target="_blank">harry.wentland@amd.com</a>> wrote:<br>
><br>
> Even though log(0) is technically undefined our code assumes that<br>
> log_2(0) is 0. This mirrors the current behavior of our log_2<br>
> implementation on non-Linux platforms.<br>
><br>
> Signed-off-by: Harry Wentland <<a href="mailto:harry.wentland@amd.com" target="_blank">harry.wentland@amd.com</a>><br>
> ---<br>
><br>
> What's num_pkrs value is upstream Mesa providing for CHIP_VANGOGH?<br>
<br>
So mesa isn't quite providing a num_pkrs value to the HW as the render<br>
HW doesn't require you to set one, it assumes something.<br>
<br>
In practice mesa still uses num_pkrs, which is provided by a readback<br>
of the GB_ADDR_CFG(CONFIG?) register info provided by the kernel. This<br>
can be used for e.g. determining texture coordinates (like we do for<br>
the displayable DCC transform) but otherwise isn't really needed,<br>
since the tile size for texture allocation is not dependent on<br>
num_pkrs.<br>
<br>
so outside of displayable DCC I think you'd be able to get far in mesa<br>
with a wrong num_pkrs.<br>
<br>
><br>
> I saw that problem at bringup with an internal Mesa and had this fix<br>
> for it.<br>
><br>
> Harry<br>
><br>
> drivers/gpu/drm/amd/display/dc/basics/conversion.h | 6 +++++-<br>
> 1 file changed, 5 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/display/dc/basics/conversion.h b/drivers/gpu/drm/amd/display/dc/basics/conversion.h<br>
> index ade785c4fdc7..da9883ec7b1c 100644<br>
> --- a/drivers/gpu/drm/amd/display/dc/basics/conversion.h<br>
> +++ b/drivers/gpu/drm/amd/display/dc/basics/conversion.h<br>
> @@ -40,7 +40,11 @@ void convert_float_matrix(<br>
><br>
> static inline unsigned int log_2(unsigned int num)<br>
> {<br>
> - return ilog2(num);<br>
> + /*<br>
> + * Technically log(0) is undefined, but our code is structured<br>
> + * in a way that assumes log(0) = 0<br>
> + */<br>
> + return num ? ilog2(num) : num;<br>
> }<br>
><br>
> #endif<br>
> --<br>
> 2.28.0<br>
><br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</blockquote></div>