Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/imagination/vulkan/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ common_per_arch_files += files(
pvr_files += files(
'pvr_g5p_formats.c',
'pvr_g5p_image.c',
'pvr_g5p_reuse.c',
'pvr_g5p_nir.c',
'pvr_g5p_shader_dump.c',
'pvr_errlog.c',
Expand Down
18 changes: 16 additions & 2 deletions src/imagination/vulkan/pvr_arch_cmd_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* SOFTWARE.
*/

#include "pvr_g5p_reuse.h"
#include "pvr_cmd_buffer.h"

#include <assert.h>
Expand Down Expand Up @@ -192,6 +193,17 @@ struct pvr_renderpass_hwsetup_render *pvr_arch_pass_info_get_hw_render(
return &render_pass_info->pass->hw_setup->renders[idx];
}

/* G5P: a primary command buffer's control stream blocks go back to the
* device's cache once its submissions have completed (pvr_g5p_reuse.h). A
* secondary's are linked from primaries this buffer does not know of: freed. */
static void pvr_cmd_buffer_retire_csb(struct pvr_cmd_buffer *cmd_buffer, struct pvr_csb *csb)
{
if (cmd_buffer->device->g5p_reuse && cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY)
pvr_g5p_csb_retire(cmd_buffer->device, csb, cmd_buffer->g5p_retire);
else
pvr_csb_finish(csb);
}

static void pvr_cmd_buffer_free_sub_cmd(struct pvr_cmd_buffer *cmd_buffer,
struct pvr_sub_cmd *sub_cmd)
{
Expand All @@ -213,7 +225,7 @@ static void pvr_cmd_buffer_free_sub_cmd(struct pvr_cmd_buffer *cmd_buffer,
pvr_bo_free(cmd_buffer->device, *bo);
util_dynarray_fini(&sub_cmd->gfx.g9p_view_bos);
util_dynarray_fini(&sub_cmd->gfx.unbound_deferred_clears);
pvr_csb_finish(&sub_cmd->gfx.control_stream);
pvr_cmd_buffer_retire_csb(cmd_buffer, &sub_cmd->gfx.control_stream);
pvr_bo_free(cmd_buffer->device, sub_cmd->gfx.terminate_ctrl_stream);
pvr_bo_free(cmd_buffer->device, sub_cmd->gfx.multiview_ctrl_stream);
pvr_bo_suballoc_free(sub_cmd->gfx.depth_bias_bo);
Expand All @@ -234,7 +246,7 @@ static void pvr_cmd_buffer_free_sub_cmd(struct pvr_cmd_buffer *cmd_buffer,
free(l->line);
free(l);
}
pvr_csb_finish(&sub_cmd->compute.control_stream);
pvr_cmd_buffer_retire_csb(cmd_buffer, &sub_cmd->compute.control_stream);
break;

case PVR_SUB_CMD_TYPE_TRANSFER:
Expand Down Expand Up @@ -285,6 +297,8 @@ static void pvr_cmd_buffer_free_resources(struct pvr_cmd_buffer *cmd_buffer)
util_dynarray_fini(&cmd_buffer->state.query_indices);

pvr_cmd_buffer_free_sub_cmds(cmd_buffer);
/* the blocks recorded from now on belong to no submission yet */
memset(cmd_buffer->g5p_retire, 0, sizeof(cmd_buffer->g5p_retire));

memset(cmd_buffer->g5p_upload, 0, sizeof(cmd_buffer->g5p_upload));
if (cmd_buffer->g5p_views) {
Expand Down
17 changes: 11 additions & 6 deletions src/imagination/vulkan/pvr_arch_csb.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "util/list.h"
#include "util/u_dynarray.h"
#include "vk_log.h"
#include "pvr_g5p_reuse.h"

/**
* \brief Adds VDMCTRL_STREAM_LINK/CDMCTRL_STREAM_LINK dwords into the control
Expand Down Expand Up @@ -121,12 +122,16 @@ static bool pvr_csb_buffer_extend(struct pvr_csb *csb)
STATIC_ASSERT(ROGUE_VDMCTRL_GUARD_SIZE_DEFAULT ==
ROGUE_CDMCTRL_GUARD_SIZE_DEFAULT);

result = pvr_bo_alloc(csb->device,
csb->device->heaps.general_heap,
PVR_CMD_BUFFER_CSB_BO_SIZE,
cache_line_size,
PVR_BO_ALLOC_FLAG_CPU_MAPPED,
&pvr_bo);
/* G5P: a block retired by an earlier command buffer whose jobs have
* completed, zeroed (pvr_g5p_reuse.h); else a new one */
pvr_g5p_csb_block_alloc(csb->device, &pvr_bo);
result = pvr_bo ? VK_SUCCESS
: pvr_bo_alloc(csb->device,
csb->device->heaps.general_heap,
PVR_CMD_BUFFER_CSB_BO_SIZE,
cache_line_size,
PVR_BO_ALLOC_FLAG_CPU_MAPPED,
&pvr_bo);
if (result != VK_SUCCESS) {
vk_error(csb->device, result);
csb->status = result;
Expand Down
5 changes: 5 additions & 0 deletions src/imagination/vulkan/pvr_arch_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* SPDX-License-Identifier: MIT
*/

#include "pvr_g5p_reuse.h"
#include "pvr_bo_log.h"
#include "pvr_device.h"

Expand Down Expand Up @@ -901,6 +902,8 @@ VkResult PVR_PER_ARCH(create_device)(struct pvr_physical_device *pdevice,
device,
device->suballoc_usc.default_size);

pvr_g5p_reuse_init(device);

if (p_atomic_inc_return(&instance->active_device_count) >
PVR_SECONDARY_DEVICE_THRESHOLD) {
initial_free_list_size = PVR_SECONDARY_DEVICE_FREE_LIST_INITAL_SIZE;
Expand Down Expand Up @@ -1079,6 +1082,7 @@ VkResult PVR_PER_ARCH(create_device)(struct pvr_physical_device *pdevice,
pvr_bo_log_summary(device, "destroy");
pvr_bo_log_device_finish(device);
}
pvr_g5p_reuse_finish(device);
pvr_bo_suballocator_fini(&device->suballoc_cmd_usc);
pvr_bo_suballocator_fini(&device->suballoc_cmd_pds);
pvr_bo_suballocator_fini(&device->suballoc_cmd_general);
Expand Down Expand Up @@ -1158,6 +1162,7 @@ void PVR_PER_ARCH(destroy_device)(struct pvr_device *device,
pvr_bo_log_summary(device, "destroy");
pvr_bo_log_device_finish(device);
}
pvr_g5p_reuse_finish(device);
pvr_bo_suballocator_fini(&device->suballoc_cmd_usc);
pvr_bo_suballocator_fini(&device->suballoc_cmd_pds);
pvr_bo_suballocator_fini(&device->suballoc_cmd_general);
Expand Down
2 changes: 1 addition & 1 deletion src/imagination/vulkan/pvr_arch_g5p_compute.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ PVR_PER_ARCH(g5p_compute_job_submit)(struct pvr_compute_ctx *ctx,
* run on the device. */
if (cs->pvr_bo != list_first_entry(&cs->pvr_bo_list, struct pvr_bo, link))
return vk_errorf(d, VK_ERROR_OUT_OF_HOST_MEMORY, "G5P: chained CDM stream not implemented yet");
struct pvr_winsys_compute_submit_info info = { .wait = wait,
struct pvr_winsys_compute_submit_info info = { .stamp = sub->g5p_stamp, .wait = wait,
.g5p_log = sub->g5p_log_first, .g5p_log_count = sub->g5p_log_count,
.frame_num = d->global_queue_present_count, .job_num = d->global_cmd_buffer_submit_count };
info.fw_stream_len =
Expand Down
1 change: 1 addition & 0 deletions src/imagination/vulkan/pvr_arch_job_compute.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ static void pvr_compute_job_ws_submit_info_init(
submit_info->job_num = device->global_cmd_buffer_submit_count;

submit_info->wait = wait;
submit_info->stamp = sub_cmd->g5p_stamp;

pvr_submit_info_stream_init(ctx, sub_cmd, submit_info);
pvr_submit_info_ext_stream_init(ctx, submit_info);
Expand Down
1 change: 1 addition & 0 deletions src/imagination/vulkan/pvr_arch_job_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,7 @@ static void pvr_render_job_ws_submit_info_init(

submit_info->frame_num = ctx->device->global_queue_present_count;
submit_info->job_num = ctx->device->global_cmd_buffer_submit_count;
submit_info->stamp = job->g5p_stamp;

pvr_render_job_ws_geometry_state_init(ctx,
job,
Expand Down
Loading
Loading