nouveau: Move gart_size to nv_device_info

This is more complicated than the others since it is a calculated value.
For nv_device_info struct, we want the raw version that raw query from
the chip.  We move the calculation into nvk_create_drm_physical_device().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand 2023-07-20 12:16:08 -05:00 committed by Marge Bot
parent 372c884b4a
commit 1756e4601a
4 changed files with 12 additions and 5 deletions

View file

@ -38,6 +38,7 @@ struct nv_device_info {
uint16_t cls_compute;
uint64_t vram_size_B;
uint64_t gart_size_B;
};
#endif /* NV_DEVINFO_H */

View file

@ -668,12 +668,20 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
pdev->mem_types[0].propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
pdev->mem_types[0].heapIndex = 0;
uint64_t sysmem_size_B = 0;
if (!os_get_available_system_memory(&sysmem_size_B)) {
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
"Failed to query available system memory");
goto fail_init;
}
sysmem_size_B = MIN2(sysmem_size_B, pdev->info.gart_size_B);
if (pdev->info.vram_size_B) {
pdev->mem_type_cnt = 2;
pdev->mem_heap_cnt = 2;
pdev->mem_heaps[0].size = pdev->info.vram_size_B;
pdev->mem_heaps[1].size = ndev->gart_size;
pdev->mem_heaps[1].size = sysmem_size_B;
pdev->mem_heaps[1].flags = 0;
pdev->mem_types[1].heapIndex = 1;
pdev->mem_types[1].propertyFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
@ -682,7 +690,7 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
pdev->mem_type_cnt = 1;
pdev->mem_heap_cnt = 1;
pdev->mem_heaps[0].size = ndev->gart_size;
pdev->mem_heaps[0].size = sysmem_size_B;
pdev->mem_types[0].propertyFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
}

View file

@ -245,8 +245,7 @@ nouveau_ws_device_new(drmDevicePtr drm_device)
if (nouveau_ws_param(fd, NOUVEAU_GETPARAM_AGP_SIZE, &value))
goto out_err;
os_get_available_system_memory(&device->gart_size);
device->gart_size = MIN2(device->gart_size, value);
device->info.gart_size_B = value;
device->fd = fd;

View file

@ -35,7 +35,6 @@ struct nouveau_ws_device {
struct nv_device_info info;
uint64_t gart_size;
uint32_t local_mem_domain;
uint8_t gpc_count;