mesa/src/virtio/vulkan/vn_device.h
Yiwei Zhang c97f9193ef venus: drop internal memory pools
This exists due to historical limitations which have long gone obsolete.
This persists longer due to hostorical perf issues that have recently
gone obsolete on the platforms shipping Venus. Meanwhile, clients like
skiavk and ANGLE nowadays do a better job managing suballocations. The
tiny perf win from having this giant internal pool has been beaten by
the memory waste, longer one-shot jank due to largier alloc, allocations
no need to be mapped but only because host-visible is advertised across
mem types and varies workarounds and markups needed to make alignment
work and make VVL happy. Dropping it also reduces the maintenance cost.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29362>
2024-05-24 02:34:45 +00:00

84 lines
2.4 KiB
C

/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#ifndef VN_DEVICE_H
#define VN_DEVICE_H
#include "vn_common.h"
#include "vn_buffer.h"
#include "vn_device_memory.h"
#include "vn_feedback.h"
#include "vn_image.h"
struct vn_device_memory_report {
PFN_vkDeviceMemoryReportCallbackEXT callback;
void *data;
};
struct vn_device {
struct vn_device_base base;
struct vn_instance *instance;
struct vn_physical_device *physical_device;
uint32_t device_mask;
struct vn_renderer *renderer;
struct vn_ring *primary_ring;
struct vn_device_memory_report *memory_reports;
uint32_t memory_report_count;
/* unique queue family indices in which to create the device queues */
uint32_t *queue_families;
uint32_t queue_family_count;
struct vn_feedback_pool feedback_pool;
/* feedback cmd pool per queue family used by the device
* - length matches queue_family_count
* - order matches queue_families
*/
struct vn_feedback_cmd_pool *fb_cmd_pools;
struct vn_queue *queues;
uint32_t queue_count;
struct vn_buffer_reqs_cache buffer_reqs_cache;
struct vn_image_reqs_cache image_reqs_cache;
};
VK_DEFINE_HANDLE_CASTS(vn_device,
base.base.base,
VkDevice,
VK_OBJECT_TYPE_DEVICE)
static inline void
vn_device_emit_device_memory_report(struct vn_device *dev,
VkDeviceMemoryReportEventTypeEXT type,
uint64_t mem_obj_id,
VkDeviceSize size,
VkObjectType obj_type,
uint64_t obj_handle,
uint32_t heap_index)
{
assert(dev->memory_reports);
const VkDeviceMemoryReportCallbackDataEXT report = {
.sType = VK_STRUCTURE_TYPE_DEVICE_MEMORY_REPORT_CALLBACK_DATA_EXT,
.type = type,
.memoryObjectId = mem_obj_id,
.size = size,
.objectType = obj_type,
.objectHandle = obj_handle,
.heapIndex = heap_index,
};
for (uint32_t i = 0; i < dev->memory_report_count; i++)
dev->memory_reports[i].callback(&report, dev->memory_reports[i].data);
}
#endif /* VN_DEVICE_H */