mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-19 21:10:30 +01:00
pvr: switch pvr_spm 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>
This commit is contained in:
parent
983f98d858
commit
e2e6adbe37
2 changed files with 22 additions and 30 deletions
|
|
@ -257,8 +257,8 @@ struct pvr_device {
|
|||
} static_clear_state;
|
||||
|
||||
struct {
|
||||
struct pvr_bo *usc_programs;
|
||||
struct pvr_bo *pds_programs;
|
||||
struct pvr_suballoc_bo *usc_programs;
|
||||
struct pvr_suballoc_bo *pds_programs;
|
||||
|
||||
struct pvr_spm_per_load_program_state {
|
||||
pvr_dev_addr_t pds_pixel_program_offset;
|
||||
|
|
|
|||
|
|
@ -260,8 +260,8 @@ VkResult pvr_device_init_spm_load_state(struct pvr_device *device)
|
|||
uint32_t usc_aligned_offsets[PVR_SPM_LOAD_PROGRAM_COUNT];
|
||||
uint32_t pds_allocation_size = 0;
|
||||
uint32_t usc_allocation_size = 0;
|
||||
struct pvr_bo *pds_bo;
|
||||
struct pvr_bo *usc_bo;
|
||||
struct pvr_suballoc_bo *pds_bo;
|
||||
struct pvr_suballoc_bo *usc_bo;
|
||||
uint8_t *mem_ptr;
|
||||
VkResult result;
|
||||
|
||||
|
|
@ -282,16 +282,15 @@ VkResult pvr_device_init_spm_load_state(struct pvr_device *device)
|
|||
usc_allocation_size += ALIGN_POT(spm_load_collection[i].size, 4);
|
||||
}
|
||||
|
||||
result = pvr_bo_alloc(device,
|
||||
device->heaps.usc_heap,
|
||||
usc_allocation_size,
|
||||
4,
|
||||
PVR_BO_ALLOC_FLAG_CPU_MAPPED,
|
||||
&usc_bo);
|
||||
result = pvr_bo_suballoc(&device->suballoc_usc,
|
||||
usc_allocation_size,
|
||||
4,
|
||||
false,
|
||||
&usc_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
mem_ptr = (uint8_t *)usc_bo->bo->map;
|
||||
mem_ptr = (uint8_t *)pvr_bo_suballoc_get_map_addr(usc_bo);
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(spm_load_collection); i++) {
|
||||
memcpy(mem_ptr + usc_aligned_offsets[i],
|
||||
|
|
@ -299,8 +298,6 @@ VkResult pvr_device_init_spm_load_state(struct pvr_device *device)
|
|||
spm_load_collection[i].size);
|
||||
}
|
||||
|
||||
pvr_bo_cpu_unmap(device, usc_bo);
|
||||
|
||||
/* Upload PDS programs. */
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(spm_load_collection); i++) {
|
||||
|
|
@ -340,18 +337,17 @@ VkResult pvr_device_init_spm_load_state(struct pvr_device *device)
|
|||
}
|
||||
|
||||
/* FIXME: Figure out the define for alignment of 16. */
|
||||
result = pvr_bo_alloc(device,
|
||||
device->heaps.pds_heap,
|
||||
pds_allocation_size,
|
||||
16,
|
||||
PVR_BO_ALLOC_FLAG_CPU_MAPPED,
|
||||
&pds_bo);
|
||||
result = pvr_bo_suballoc(&device->suballoc_pds,
|
||||
pds_allocation_size,
|
||||
16,
|
||||
false,
|
||||
&pds_bo);
|
||||
if (result != VK_SUCCESS) {
|
||||
pvr_bo_free(device, usc_bo);
|
||||
pvr_bo_suballoc_free(usc_bo);
|
||||
return result;
|
||||
}
|
||||
|
||||
mem_ptr = (uint8_t *)pds_bo->bo->map;
|
||||
mem_ptr = (uint8_t *)pvr_bo_suballoc_get_map_addr(pds_bo);
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(spm_load_collection); i++) {
|
||||
struct pvr_pds_pixel_shader_sa_program pds_texture_program = {
|
||||
|
|
@ -359,7 +355,7 @@ VkResult pvr_device_init_spm_load_state(struct pvr_device *device)
|
|||
.num_texture_dma_kicks = 1,
|
||||
};
|
||||
const pvr_dev_addr_t usc_program_dev_addr =
|
||||
PVR_DEV_ADDR_OFFSET(usc_bo->vma->dev_addr, usc_aligned_offsets[i]);
|
||||
PVR_DEV_ADDR_OFFSET(usc_bo->dev_addr, usc_aligned_offsets[i]);
|
||||
struct pvr_pds_kickusc_program pds_kick_program = { 0 };
|
||||
|
||||
pvr_pds_generate_pixel_shader_sa_code_segment(
|
||||
|
|
@ -378,11 +374,9 @@ VkResult pvr_device_init_spm_load_state(struct pvr_device *device)
|
|||
(uint32_t *)(mem_ptr + pds_kick_aligned_offsets[i]));
|
||||
|
||||
device->spm_load_state.load_program[i].pds_pixel_program_offset =
|
||||
PVR_DEV_ADDR_OFFSET(pds_bo->vma->dev_addr,
|
||||
pds_kick_aligned_offsets[i]);
|
||||
PVR_DEV_ADDR_OFFSET(pds_bo->dev_addr, pds_kick_aligned_offsets[i]);
|
||||
device->spm_load_state.load_program[i].pds_uniform_program_offset =
|
||||
PVR_DEV_ADDR_OFFSET(pds_bo->vma->dev_addr,
|
||||
pds_texture_aligned_offsets[i]);
|
||||
PVR_DEV_ADDR_OFFSET(pds_bo->dev_addr, pds_texture_aligned_offsets[i]);
|
||||
|
||||
/* TODO: From looking at the pvr_pds_generate_...() functions, it seems
|
||||
* like temps_used is always 1. Should we remove this and hard code it
|
||||
|
|
@ -392,8 +386,6 @@ VkResult pvr_device_init_spm_load_state(struct pvr_device *device)
|
|||
pds_texture_program.temps_used;
|
||||
}
|
||||
|
||||
pvr_bo_cpu_unmap(device, pds_bo);
|
||||
|
||||
device->spm_load_state.usc_programs = usc_bo;
|
||||
device->spm_load_state.pds_programs = pds_bo;
|
||||
|
||||
|
|
@ -402,8 +394,8 @@ VkResult pvr_device_init_spm_load_state(struct pvr_device *device)
|
|||
|
||||
void pvr_device_finish_spm_load_state(struct pvr_device *device)
|
||||
{
|
||||
pvr_bo_free(device, device->spm_load_state.pds_programs);
|
||||
pvr_bo_free(device, device->spm_load_state.usc_programs);
|
||||
pvr_bo_suballoc_free(device->spm_load_state.pds_programs);
|
||||
pvr_bo_suballoc_free(device->spm_load_state.usc_programs);
|
||||
}
|
||||
|
||||
static inline enum PVRX(PBESTATE_PACKMODE)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue