lavapipe: use common tracked size and override if needed

For lavapipe, there's no need for a separate internally tracked size.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36252>
This commit is contained in:
Yiwei Zhang
2025-07-21 00:24:01 -07:00
committed by Marge Bot
parent addd65241a
commit ab6141561d
3 changed files with 3 additions and 5 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ lvp_import_ahb_memory(struct lvp_device *device, struct lvp_device_memory *mem)
if (!result)
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
mem->size = size;
mem->vk.size = size;
mem->map = device->pscreen->map_memory(device->pscreen, mem->pmem);
mem->memory_type = LVP_DEVICE_MEMORY_TYPE_DMA_BUF;
+2 -3
View File
@@ -1931,7 +1931,7 @@ set_mem_priority(struct lvp_device_memory *mem, int priority)
if (priority > 0)
advice |= MADV_WILLNEED;
if (advice)
madvise(mem->map, mem->size, advice);
madvise(mem->map, mem->vk.size, advice);
}
#endif
}
@@ -1992,7 +1992,6 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateMemory(
mem->memory_type = LVP_DEVICE_MEMORY_TYPE_DEFAULT;
mem->backed_fd = -1;
mem->size = pAllocateInfo->allocationSize;
if (mem->vk.host_ptr) {
mem->mem_alloc = (struct llvmpipe_memory_allocation) {
@@ -2032,7 +2031,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateMemory(
close(import_info->fd);
}
mem->size = size;
mem->vk.size = size;
mem->map = device->pscreen->map_memory(device->pscreen, mem->pmem);
mem->memory_type = dmabuf ? LVP_DEVICE_MEMORY_TYPE_DMA_BUF : LVP_DEVICE_MEMORY_TYPE_OPAQUE_FD;
}
@@ -244,7 +244,6 @@ struct lvp_device_memory {
struct pipe_memory_allocation *pmem;
struct llvmpipe_memory_allocation mem_alloc;
VkDeviceSize map_size;
VkDeviceSize size;
void * map;
enum lvp_device_memory_type memory_type;
int backed_fd;