nvk: enable a mappable bar heap when rebar is disabled.

Now that we've resolved the kernel side issues, this should be fine
to expose on non-rebar systems.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28144>
This commit is contained in:
Dave Airlie
2024-03-13 12:22:23 +10:00
committed by Marge Bot
parent 647a2d1f6b
commit 133c73da85
2 changed files with 13 additions and 4 deletions
+12 -3
View File
@@ -1170,11 +1170,21 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
if (pdev->info.vram_size_B > 0) {
uint32_t vram_heap_idx = pdev->mem_heap_count++;
uint32_t bar_heap_idx = vram_heap_idx;
pdev->mem_heaps[vram_heap_idx] = (struct nvk_memory_heap) {
.size = pdev->info.vram_size_B,
.flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT,
};
if (pdev->info.bar_size_B > 0 &&
pdev->info.bar_size_B < pdev->info.vram_size_B) {
bar_heap_idx = pdev->mem_heap_count++;
pdev->mem_heaps[bar_heap_idx] = (struct nvk_memory_heap) {
.size = pdev->info.bar_size_B,
.flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT,
};
}
/* Only set available if we have the ioctl. */
if (nouveau_ws_device_vram_used(ws_dev) > 0)
pdev->mem_heaps[vram_heap_idx].available = nvk_get_vram_heap_available;
@@ -1184,13 +1194,12 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
.heapIndex = vram_heap_idx,
};
if (pdev->info.cls_eng3d >= MAXWELL_A &&
pdev->info.bar_size_B >= pdev->info.vram_size_B) {
if (pdev->info.cls_eng3d >= MAXWELL_A) {
pdev->mem_types[pdev->mem_type_count++] = (VkMemoryType) {
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
.heapIndex = vram_heap_idx,
.heapIndex = bar_heap_idx,
};
}
}
+1 -1
View File
@@ -49,7 +49,7 @@ struct nvk_physical_device {
uint8_t device_uuid[VK_UUID_SIZE];
// TODO: add mapable VRAM heap if possible
struct nvk_memory_heap mem_heaps[2];
struct nvk_memory_heap mem_heaps[3];
VkMemoryType mem_types[3];
uint8_t mem_heap_count;
uint8_t mem_type_count;