nvc0: fix a warning -Wconstant-conversion

I do not understand the code here well enough to tell what the correct
behavior is. prog->num_gprs is a unit8_t, so my guess is that the MIN
is there to make sure we stay within the limit of that. However the
current logic is a bit strange. If info_out.bin.maxGPR + 5 is bellow
256 we use that. If not then we write 256 which converts to 0 in a
uint8_t...

The patch changes the upper value to 255.

Fixes a warning with clang

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14304>
This commit is contained in:
Thomas H.P. Andersen
2021-12-26 01:58:50 +01:00
committed by Marge Bot
parent 5f66a927ec
commit d3642a0e02

View File

@@ -686,7 +686,7 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset,
prog->relocs = info_out.bin.relocData;
prog->fixups = info_out.bin.fixupData;
if (info_out.target >= NVISA_GV100_CHIPSET)
prog->num_gprs = MIN2(info_out.bin.maxGPR + 5, 256); //XXX: why?
prog->num_gprs = MIN2(info_out.bin.maxGPR + 5, 255); //XXX: why?
else
prog->num_gprs = MAX2(4, (info_out.bin.maxGPR + 1));
prog->cp.smem_size = info_out.bin.smemSize;