pvr: Use the suballocator for queries
Fixes: dEQP-VK.api.object_management.max_concurrent.query_pool Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23071>
This commit is contained in:
@@ -112,6 +112,7 @@
|
||||
#define PVR_SUBALLOCATOR_PDS_SIZE (128 * 1024)
|
||||
#define PVR_SUBALLOCATOR_TRANSFER_SIZE (128 * 1024)
|
||||
#define PVR_SUBALLOCATOR_USC_SIZE (128 * 1024)
|
||||
#define PVR_SUBALLOCATOR_VIS_TEST_SIZE (128 * 1024)
|
||||
|
||||
struct pvr_drm_device_info {
|
||||
const char *name;
|
||||
@@ -1823,6 +1824,10 @@ VkResult pvr_CreateDevice(VkPhysicalDevice physicalDevice,
|
||||
device->heaps.usc_heap,
|
||||
device,
|
||||
PVR_SUBALLOCATOR_USC_SIZE);
|
||||
pvr_bo_suballocator_init(&device->suballoc_vis_test,
|
||||
device->heaps.vis_test_heap,
|
||||
device,
|
||||
PVR_SUBALLOCATOR_VIS_TEST_SIZE);
|
||||
|
||||
if (p_atomic_inc_return(&instance->active_device_count) >
|
||||
PVR_SECONDARY_DEVICE_THRESHOLD) {
|
||||
@@ -1930,6 +1935,7 @@ err_pvr_free_list_destroy:
|
||||
err_dec_device_count:
|
||||
p_atomic_dec(&device->instance->active_device_count);
|
||||
|
||||
pvr_bo_suballocator_fini(&device->suballoc_vis_test);
|
||||
pvr_bo_suballocator_fini(&device->suballoc_usc);
|
||||
pvr_bo_suballocator_fini(&device->suballoc_transfer);
|
||||
pvr_bo_suballocator_fini(&device->suballoc_pds);
|
||||
@@ -1976,6 +1982,7 @@ void pvr_DestroyDevice(VkDevice _device,
|
||||
pvr_bo_suballoc_free(device->nop_program.pds.pvr_bo);
|
||||
pvr_bo_suballoc_free(device->nop_program.usc);
|
||||
pvr_free_list_destroy(device->global_free_list);
|
||||
pvr_bo_suballocator_fini(&device->suballoc_vis_test);
|
||||
pvr_bo_suballocator_fini(&device->suballoc_usc);
|
||||
pvr_bo_suballocator_fini(&device->suballoc_transfer);
|
||||
pvr_bo_suballocator_fini(&device->suballoc_pds);
|
||||
|
||||
@@ -204,6 +204,7 @@ struct pvr_device {
|
||||
struct pvr_suballocator suballoc_pds;
|
||||
struct pvr_suballocator suballoc_transfer;
|
||||
struct pvr_suballocator suballoc_usc;
|
||||
struct pvr_suballocator suballoc_vis_test;
|
||||
|
||||
struct {
|
||||
struct pvr_pds_upload pds;
|
||||
@@ -982,8 +983,8 @@ struct pvr_query_pool {
|
||||
|
||||
uint32_t query_count;
|
||||
|
||||
struct pvr_bo *result_buffer;
|
||||
struct pvr_bo *availability_buffer;
|
||||
struct pvr_suballoc_bo *result_buffer;
|
||||
struct pvr_suballoc_bo *availability_buffer;
|
||||
};
|
||||
|
||||
struct pvr_private_compute_pipeline {
|
||||
@@ -1014,7 +1015,7 @@ struct pvr_query_info {
|
||||
uint32_t num_query_indices;
|
||||
struct pvr_suballoc_bo *index_bo;
|
||||
uint32_t num_queries;
|
||||
struct pvr_bo *availability_bo;
|
||||
struct pvr_suballoc_bo *availability_bo;
|
||||
} availability_write;
|
||||
|
||||
struct {
|
||||
|
||||
@@ -77,21 +77,19 @@ VkResult pvr_CreateQueryPool(VkDevice _device,
|
||||
*/
|
||||
alloc_size = (uint64_t)pool->result_stride * core_count;
|
||||
|
||||
result = pvr_bo_alloc(device,
|
||||
device->heaps.vis_test_heap,
|
||||
alloc_size,
|
||||
PVRX(CR_ISP_OCLQRY_BASE_ADDR_ALIGNMENT),
|
||||
PVR_BO_ALLOC_FLAG_CPU_MAPPED,
|
||||
&pool->result_buffer);
|
||||
result = pvr_bo_suballoc(&device->suballoc_vis_test,
|
||||
alloc_size,
|
||||
PVRX(CR_ISP_OCLQRY_BASE_ADDR_ALIGNMENT),
|
||||
false,
|
||||
&pool->result_buffer);
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_free_pool;
|
||||
|
||||
result = pvr_bo_alloc(device,
|
||||
device->heaps.general_heap,
|
||||
query_size,
|
||||
sizeof(uint32_t),
|
||||
PVR_BO_ALLOC_FLAG_CPU_MAPPED,
|
||||
&pool->availability_buffer);
|
||||
result = pvr_bo_suballoc(&device->suballoc_general,
|
||||
query_size,
|
||||
sizeof(uint32_t),
|
||||
false,
|
||||
&pool->availability_buffer);
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_free_result_buffer;
|
||||
|
||||
@@ -100,7 +98,7 @@ VkResult pvr_CreateQueryPool(VkDevice _device,
|
||||
return VK_SUCCESS;
|
||||
|
||||
err_free_result_buffer:
|
||||
pvr_bo_free(device, pool->result_buffer);
|
||||
pvr_bo_suballoc_free(pool->result_buffer);
|
||||
|
||||
err_free_pool:
|
||||
vk_object_free(&device->vk, pAllocator, pool);
|
||||
@@ -118,8 +116,8 @@ void pvr_DestroyQueryPool(VkDevice _device,
|
||||
if (!pool)
|
||||
return;
|
||||
|
||||
pvr_bo_free(device, pool->availability_buffer);
|
||||
pvr_bo_free(device, pool->result_buffer);
|
||||
pvr_bo_suballoc_free(pool->availability_buffer);
|
||||
pvr_bo_suballoc_free(pool->result_buffer);
|
||||
|
||||
vk_object_free(&device->vk, pAllocator, pool);
|
||||
}
|
||||
@@ -133,7 +131,8 @@ void pvr_DestroyQueryPool(VkDevice _device,
|
||||
static inline bool pvr_query_is_available(const struct pvr_query_pool *pool,
|
||||
uint32_t query_idx)
|
||||
{
|
||||
volatile uint32_t *available = pool->availability_buffer->bo->map;
|
||||
volatile uint32_t *available =
|
||||
pvr_bo_suballoc_get_map_addr(pool->availability_buffer);
|
||||
return !!available[query_idx];
|
||||
}
|
||||
|
||||
@@ -199,9 +198,11 @@ VkResult pvr_GetQueryPoolResults(VkDevice _device,
|
||||
{
|
||||
PVR_FROM_HANDLE(pvr_query_pool, pool, queryPool);
|
||||
PVR_FROM_HANDLE(pvr_device, device, _device);
|
||||
VG(volatile uint32_t *available =
|
||||
pvr_bo_suballoc_get_map_addr(pool->availability_buffer));
|
||||
volatile uint32_t *query_results =
|
||||
pvr_bo_suballoc_get_map_addr(pool->result_buffer);
|
||||
const uint32_t core_count = device->pdevice->dev_runtime_info.core_count;
|
||||
VG(volatile uint32_t *available = pool->availability_buffer->bo->map);
|
||||
volatile uint32_t *query_results = pool->result_buffer->bo->map;
|
||||
uint8_t *data = (uint8_t *)pData;
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
|
||||
@@ -601,7 +601,7 @@ VkResult pvr_add_query_program(struct pvr_cmd_buffer *cmd_buffer,
|
||||
dev_info,
|
||||
&tex_info,
|
||||
query_info->availability_write.num_queries,
|
||||
query_info->availability_write.availability_bo->vma->dev_addr);
|
||||
query_info->availability_write.availability_bo->dev_addr);
|
||||
|
||||
result = pvr_pack_tex_state(device,
|
||||
&tex_info,
|
||||
@@ -657,8 +657,7 @@ VkResult pvr_add_query_program(struct pvr_cmd_buffer *cmd_buffer,
|
||||
|
||||
offset = query_info->copy_query_results.first_query * sizeof(uint32_t);
|
||||
|
||||
addr =
|
||||
PVR_DEV_ADDR_OFFSET(pool->availability_buffer->vma->dev_addr, offset);
|
||||
addr = PVR_DEV_ADDR_OFFSET(pool->availability_buffer->dev_addr, offset);
|
||||
|
||||
pvr_init_tex_info(dev_info, &tex_info, num_query_indices, addr);
|
||||
|
||||
@@ -674,7 +673,7 @@ VkResult pvr_add_query_program(struct pvr_cmd_buffer *cmd_buffer,
|
||||
image_sampler_idx++;
|
||||
|
||||
for (uint32_t i = 0; i < buffer_count; i++) {
|
||||
addr = PVR_DEV_ADDR_OFFSET(pool->result_buffer->vma->dev_addr,
|
||||
addr = PVR_DEV_ADDR_OFFSET(pool->result_buffer->dev_addr,
|
||||
offset + i * pool->result_stride);
|
||||
|
||||
pvr_init_tex_info(dev_info, &tex_info, num_query_indices, addr);
|
||||
@@ -752,7 +751,7 @@ VkResult pvr_add_query_program(struct pvr_cmd_buffer *cmd_buffer,
|
||||
offset = query_info->reset_query_pool.first_query * sizeof(uint32_t);
|
||||
|
||||
for (uint32_t i = 0; i < buffer_count; i++) {
|
||||
addr = PVR_DEV_ADDR_OFFSET(pool->result_buffer->vma->dev_addr,
|
||||
addr = PVR_DEV_ADDR_OFFSET(pool->result_buffer->dev_addr,
|
||||
offset + i * pool->result_stride);
|
||||
|
||||
pvr_init_tex_info(dev_info, &tex_info, num_query_indices, addr);
|
||||
@@ -769,8 +768,7 @@ VkResult pvr_add_query_program(struct pvr_cmd_buffer *cmd_buffer,
|
||||
image_sampler_idx++;
|
||||
}
|
||||
|
||||
addr =
|
||||
PVR_DEV_ADDR_OFFSET(pool->availability_buffer->vma->dev_addr, offset);
|
||||
addr = PVR_DEV_ADDR_OFFSET(pool->availability_buffer->dev_addr, offset);
|
||||
|
||||
pvr_init_tex_info(dev_info, &tex_info, num_query_indices, addr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user