nouveau: Stop using hex for SM numbers

There's no indication that NVIDIA considers this to be anything other
than a decimal number.  Much to the contrary, the number of 5s and 9s in
the SM number table implies they very much are base 10.  Given that
Lovelace is SM90, we'll likely be hitting 100 fairly soon at which point
this will stop fitting in a uint8_t.  Switch to decimal to compress it
down a bit.

Also, rename the field to SM which beter matches the NVIDIA docs and
ensures that there are no users of this which are likely to be confused.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand
2023-01-30 20:53:17 -06:00
committed by Marge Bot
parent 9846c4e13e
commit 56ccada087
2 changed files with 27 additions and 27 deletions

View File

@@ -19,58 +19,58 @@ static uint8_t
sm_for_chipset(uint16_t chipset)
{
if (chipset >= 0x190)
return 0x89;
return 89;
// GH100 is older than AD10X, but is SM90
else if (chipset >= 0x180)
return 0x90;
return 90;
else if (chipset == 0x17b)
return 0x87;
return 87;
else if (chipset >= 0x172)
return 0x86;
return 86;
else if (chipset >= 0x170)
return 0x80;
return 80;
else if (chipset >= 0x160)
return 0x75;
return 75;
else if (chipset >= 0x14b)
return 0x72;
return 72;
else if (chipset >= 0x140)
return 0x70;
return 70;
else if (chipset >= 0x13b)
return 0x62;
return 62;
else if (chipset >= 0x132)
return 0x61;
return 61;
else if (chipset >= 0x130)
return 0x60;
return 60;
else if (chipset >= 0x12b)
return 0x53;
return 53;
else if (chipset >= 0x120)
return 0x52;
return 52;
else if (chipset >= 0x110)
return 0x50;
// TODO: 0x37
return 50;
// TODO: 37
else if (chipset >= 0x0f0)
return 0x35;
return 35;
else if (chipset >= 0x0ea)
return 0x32;
return 32;
else if (chipset >= 0x0e0)
return 0x30;
return 30;
// GF110 is SM20
else if (chipset == 0x0c8)
return 0x20;
return 20;
else if (chipset >= 0x0c1)
return 0x21;
return 21;
else if (chipset >= 0x0c0)
return 0x20;
return 20;
else if (chipset >= 0x0a3)
return 0x12;
return 12;
// GT200 is SM13
else if (chipset >= 0x0a0)
return 0x13;
return 13;
else if (chipset >= 0x080)
return 0x11;
return 11;
// this has to be == because 0x63 is older than 0x50 and has no compute
else if (chipset == 0x050)
return 0x10;
return 10;
// no compute
return 0x00;
}
@@ -246,7 +246,7 @@ nouveau_ws_device_new(drmDevicePtr drm_device)
device->fd = fd;
device->vendor_id = 0x10de;
device->cm = sm_for_chipset(device->chipset);
device->sm = sm_for_chipset(device->chipset);
device->is_integrated = device->vram_size == 0;
if (device->vram_size == 0)

View File

@@ -43,7 +43,7 @@ struct nouveau_ws_device {
char *device_name;
/* maps to CUDAs Compute capability version */
uint8_t cm;
uint8_t sm;
uint64_t vram_size;
uint64_t gart_size;