summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Santivetti <luigi.santivetti@imgtec.com>2023-05-10 08:29:49 +0100
committerLuigi Santivetti <luigi.santivetti@imgtec.com>2023-05-16 11:53:09 +0100
commit983f98d85811892ccdf877ca26b312dab25b87f0 (patch)
tree7452b39503fde81ee47d826a03776bd93d4b750c
parent073bdbdea75d8f78f0e37334fde0e6b212c244aa (diff)
downloadmesa-983f98d85811892ccdf877ca26b312dab25b87f0.tar.gz
pvr: switch pvr_clear to use pvr_bo_suballoc
Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com> Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22940>
-rw-r--r--src/imagination/vulkan/pvr_blit.c4
-rw-r--r--src/imagination/vulkan/pvr_clear.c67
-rw-r--r--src/imagination/vulkan/pvr_clear.h2
-rw-r--r--src/imagination/vulkan/pvr_cmd_buffer.c4
-rw-r--r--src/imagination/vulkan/pvr_private.h4
5 files changed, 38 insertions, 43 deletions
diff --git a/src/imagination/vulkan/pvr_blit.c b/src/imagination/vulkan/pvr_blit.c
index 6a6316fe02a..d0b4b9db215 100644
--- a/src/imagination/vulkan/pvr_blit.c
+++ b/src/imagination/vulkan/pvr_blit.c
@@ -1458,10 +1458,10 @@ static VkResult pvr_clear_color_attachment_static(
struct pvr_static_clear_ppp_template template;
struct pvr_suballoc_bo *const_shareds_buffer;
uint64_t pds_texture_program_addr;
+ struct pvr_suballoc_bo *pvr_bo;
uint32_t tile_buffer_idx = 0;
uint32_t out_reg_count;
uint32_t output_offset;
- struct pvr_bo *pvr_bo;
uint32_t program_idx;
uint32_t *buffer;
VkResult result;
@@ -1871,7 +1871,7 @@ static void pvr_clear_attachments(struct pvr_cmd_buffer *cmd_buffer,
} else {
const uint32_t template_idx = attachment->aspectMask;
struct pvr_static_clear_ppp_template template;
- struct pvr_bo *pvr_bo;
+ struct pvr_suballoc_bo *pvr_bo;
assert(template_idx < PVR_STATIC_CLEAR_VARIANT_COUNT);
template =
diff --git a/src/imagination/vulkan/pvr_clear.c b/src/imagination/vulkan/pvr_clear.c
index 533db5f59a4..cd4647457cc 100644
--- a/src/imagination/vulkan/pvr_clear.c
+++ b/src/imagination/vulkan/pvr_clear.c
@@ -152,7 +152,7 @@ static void pvr_device_setup_graphics_static_clear_ppp_templates(
VkResult pvr_emit_ppp_from_template(
struct pvr_csb *const csb,
const struct pvr_static_clear_ppp_template *const template,
- struct pvr_bo **const pvr_bo_out)
+ struct pvr_suballoc_bo **const pvr_bo_out)
{
const uint32_t dword_count =
pvr_cmd_length(TA_STATE_HEADER) + pvr_cmd_length(TA_STATE_ISPCTL) +
@@ -169,22 +169,21 @@ VkResult pvr_emit_ppp_from_template(
rogue_get_slc_cache_line_size(&device->pdevice->dev_info);
const struct pvr_static_clear_ppp_base *const base =
&device->static_clear_state.ppp_base;
- struct pvr_bo *pvr_bo;
+ struct pvr_suballoc_bo *pvr_bo;
uint32_t *stream;
VkResult result;
- result = pvr_bo_alloc(device,
- device->heaps.general_heap,
- PVR_DW_TO_BYTES(dword_count),
- cache_line_size,
- PVR_BO_ALLOC_FLAG_CPU_MAPPED,
- &pvr_bo);
+ result = pvr_bo_suballoc(&device->suballoc_general,
+ PVR_DW_TO_BYTES(dword_count),
+ cache_line_size,
+ false,
+ &pvr_bo);
if (result != VK_SUCCESS) {
*pvr_bo_out = NULL;
return result;
}
- stream = (uint32_t *)pvr_bo->bo->map;
+ stream = (uint32_t *)pvr_bo_suballoc_get_map_addr(pvr_bo);
pvr_csb_write_value(stream, TA_STATE_HEADER, template->header);
pvr_csb_write_struct(stream, TA_STATE_ISPCTL, &template->config.ispctl);
@@ -212,18 +211,18 @@ VkResult pvr_emit_ppp_from_template(
pvr_csb_write_value(stream, TA_STATE_PPP_CTRL, base->ppp_ctrl);
pvr_csb_write_value(stream, TA_STATE_STREAM_OUT0, base->stream_out0);
- assert((uint64_t)(stream - (uint32_t *)pvr_bo->bo->map) == dword_count);
+ assert((uint64_t)(stream - (uint32_t *)pvr_bo_suballoc_get_map_addr(
+ pvr_bo)) == dword_count);
- pvr_bo_cpu_unmap(device, pvr_bo);
stream = NULL;
pvr_csb_emit (csb, VDMCTRL_PPP_STATE0, state) {
state.word_count = dword_count;
- state.addrmsb = pvr_bo->vma->dev_addr;
+ state.addrmsb = pvr_bo->dev_addr;
}
pvr_csb_emit (csb, VDMCTRL_PPP_STATE1, state) {
- state.addrlsb = pvr_bo->vma->dev_addr;
+ state.addrlsb = pvr_bo->dev_addr;
}
*pvr_bo_out = pvr_bo;
@@ -279,19 +278,19 @@ pvr_device_init_clear_attachment_programs(struct pvr_device *device)
offset_idx++;
}
- result = pvr_bo_alloc(device,
- device->heaps.usc_heap,
- alloc_size,
- 4,
- PVR_BO_ALLOC_FLAG_CPU_MAPPED,
- &clear_state->usc_clear_attachment_programs);
+ result = pvr_bo_suballoc(&device->suballoc_usc,
+ alloc_size,
+ 4,
+ false,
+ &clear_state->usc_clear_attachment_programs);
if (result != VK_SUCCESS)
return result;
usc_upload_offset =
- clear_state->usc_clear_attachment_programs->vma->dev_addr.addr -
+ clear_state->usc_clear_attachment_programs->dev_addr.addr -
device->heaps.usc_heap->base_addr.addr;
- ptr = (uint8_t *)clear_state->usc_clear_attachment_programs->bo->map;
+ ptr = (uint8_t *)pvr_bo_suballoc_get_map_addr(
+ clear_state->usc_clear_attachment_programs);
for (uint32_t i = 0, offset_idx = 0;
i < ARRAY_SIZE(clear_attachment_collection);
@@ -306,8 +305,6 @@ pvr_device_init_clear_attachment_programs(struct pvr_device *device)
offset_idx++;
}
- pvr_bo_cpu_unmap(device, clear_state->usc_clear_attachment_programs);
-
/* Upload PDS programs. */
alloc_size = 0;
@@ -356,21 +353,21 @@ pvr_device_init_clear_attachment_programs(struct pvr_device *device)
offset_idx++;
}
- result = pvr_bo_alloc(device,
- device->heaps.pds_heap,
- alloc_size,
- pds_prog_alignment,
- PVR_BO_ALLOC_FLAG_CPU_MAPPED,
- &clear_state->pds_clear_attachment_programs);
+ result = pvr_bo_suballoc(&device->suballoc_pds,
+ alloc_size,
+ pds_prog_alignment,
+ false,
+ &clear_state->pds_clear_attachment_programs);
if (result != VK_SUCCESS) {
- pvr_bo_free(device, clear_state->usc_clear_attachment_programs);
+ pvr_bo_suballoc_free(clear_state->usc_clear_attachment_programs);
return result;
}
pds_upload_offset =
- clear_state->pds_clear_attachment_programs->vma->dev_addr.addr -
+ clear_state->pds_clear_attachment_programs->dev_addr.addr -
device->heaps.pds_heap->base_addr.addr;
- ptr = clear_state->pds_clear_attachment_programs->bo->map;
+ ptr =
+ pvr_bo_suballoc_get_map_addr(clear_state->pds_clear_attachment_programs);
for (uint32_t i = 0, offset_idx = 0;
i < ARRAY_SIZE(clear_attachment_collection);
@@ -428,8 +425,6 @@ pvr_device_init_clear_attachment_programs(struct pvr_device *device)
offset_idx++;
}
- pvr_bo_cpu_unmap(device, clear_state->pds_clear_attachment_programs);
-
return VK_SUCCESS;
}
@@ -439,8 +434,8 @@ pvr_device_finish_clear_attachment_programs(struct pvr_device *device)
struct pvr_device_static_clear_state *clear_state =
&device->static_clear_state;
- pvr_bo_free(device, clear_state->usc_clear_attachment_programs);
- pvr_bo_free(device, clear_state->pds_clear_attachment_programs);
+ pvr_bo_suballoc_free(clear_state->usc_clear_attachment_programs);
+ pvr_bo_suballoc_free(clear_state->pds_clear_attachment_programs);
}
/**
diff --git a/src/imagination/vulkan/pvr_clear.h b/src/imagination/vulkan/pvr_clear.h
index 01f25ed234e..dfcb9b5b397 100644
--- a/src/imagination/vulkan/pvr_clear.h
+++ b/src/imagination/vulkan/pvr_clear.h
@@ -126,7 +126,7 @@ void pvr_device_finish_graphics_static_clear_state(struct pvr_device *device);
VkResult pvr_emit_ppp_from_template(
struct pvr_csb *const csb,
const struct pvr_static_clear_ppp_template *const template,
- struct pvr_bo **const pvr_bo_out);
+ struct pvr_suballoc_bo **const pvr_bo_out);
void pvr_pds_clear_vertex_shader_program_init_base(
struct pvr_pds_vertex_shader_program *program,
diff --git a/src/imagination/vulkan/pvr_cmd_buffer.c b/src/imagination/vulkan/pvr_cmd_buffer.c
index bd696a3dee1..7823678d58e 100644
--- a/src/imagination/vulkan/pvr_cmd_buffer.c
+++ b/src/imagination/vulkan/pvr_cmd_buffer.c
@@ -2781,7 +2781,7 @@ static VkResult pvr_cs_write_load_op(struct pvr_cmd_buffer *cmd_buffer,
device->static_clear_state.ppp_templates[VK_IMAGE_ASPECT_COLOR_BIT];
uint32_t pds_state[PVR_STATIC_CLEAR_PDS_STATE_COUNT];
struct pvr_pds_upload shareds_update_program;
- struct pvr_bo *pvr_bo;
+ struct pvr_suballoc_bo *pvr_bo;
VkResult result;
result = pvr_load_op_data_create_and_upload(cmd_buffer,
@@ -7064,7 +7064,7 @@ static void pvr_insert_transparent_obj(struct pvr_cmd_buffer *const cmd_buffer,
device->static_clear_state.ppp_templates[VK_IMAGE_ASPECT_COLOR_BIT];
uint32_t pds_state[PVR_STATIC_CLEAR_PDS_STATE_COUNT] = { 0 };
struct pvr_csb *csb = &sub_cmd->control_stream;
- struct pvr_bo *ppp_bo;
+ struct pvr_suballoc_bo *ppp_bo;
assert(clear.requires_pds_state);
diff --git a/src/imagination/vulkan/pvr_private.h b/src/imagination/vulkan/pvr_private.h
index 45b4f9aa129..b5541dcac11 100644
--- a/src/imagination/vulkan/pvr_private.h
+++ b/src/imagination/vulkan/pvr_private.h
@@ -240,8 +240,8 @@ struct pvr_device {
uint32_t vdm_words[PVR_CLEAR_VDM_STATE_DWORD_COUNT];
uint32_t large_clear_vdm_words[PVR_CLEAR_VDM_STATE_DWORD_COUNT];
- struct pvr_bo *usc_clear_attachment_programs;
- struct pvr_bo *pds_clear_attachment_programs;
+ struct pvr_suballoc_bo *usc_clear_attachment_programs;
+ struct pvr_suballoc_bo *pds_clear_attachment_programs;
/* TODO: See if we can use PVR_CLEAR_ATTACHMENT_PROGRAM_COUNT to save some
* memory.
*/