amd/vpelib: Remove extra collaborate sync commands in IB

Remove extra collaborate sync commands and fix coding format.

Co-authored-by: Roy Chan <roy.chan@amd.com>
Reviewed-by: Roy Chan <roy.chan@amd.com>
Acked-by: Alan Liu <haoping.liu@amd.com>
Signed-off-by: Ricky Lin <ricky.lin@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30715>
This commit is contained in:
Lin, Ricky 2024-05-15 14:20:06 +08:00 committed by Marge Bot
parent e9e2fe389f
commit 015b1b52c8
7 changed files with 43 additions and 40 deletions

View file

@ -878,13 +878,21 @@ enum vpe_status vpe10_populate_cmd_info(struct vpe_priv *vpe_priv)
cmd_info->ops = VPE_CMD_OPS_COMPOSITING;
cmd_info->tm_enabled = tm_enabled;
vpe_priv->num_vpe_cmds++;
if (cmd_info->cd == (stream_ctx->num_segments - 1)) {
cmd_info->is_begin = true;
}
cmd_info->insert_start_csync = false;
cmd_info->insert_end_csync = false;
if (cmd_info->cd == 0) {
cmd_info->is_end = true;
// The following codes are only valid if blending is supported
/*
if (cmd_info->ops == VPE_CMD_OPS_BLENDING) {
if (cmd_info->cd == (stream_ctx->num_segments - 1)) {
cmd_info->insert_start_csync = true;
}
if (cmd_info->cd == 0) {
cmd_info->insert_end_csync = true;
}
}
*/
}
}

View file

@ -32,7 +32,7 @@ extern "C" {
void vpe11_construct_cmd_builder(struct vpe_priv *vpe_priv, struct cmd_builder *cmd_builder);
enum vpe_status vpe11_build_collaborate_sync_cmd(
struct vpe_priv *vpe_priv, struct vpe_build_bufs *cur_bufs, bool is_end);
struct vpe_priv *vpe_priv, struct vpe_build_bufs *cur_bufs);
#ifdef __cplusplus
}
#endif

View file

@ -40,7 +40,7 @@ void vpe11_construct_cmd_builder(struct vpe_priv *vpe_priv, struct cmd_builder *
}
enum vpe_status vpe11_build_collaborate_sync_cmd(
struct vpe_priv *vpe_priv, struct vpe_build_bufs *cur_bufs, bool is_end)
struct vpe_priv *vpe_priv, struct vpe_build_bufs *cur_bufs)
{
struct vpe_buf *buf = &cur_bufs->cmd_buf;
uint32_t *cmd_space;
@ -56,9 +56,7 @@ enum vpe_status vpe11_build_collaborate_sync_cmd(
*cmd_space++ = VPE_COLLABORATE_SYNC_CMD_HEADER;
*cmd_space++ = VPE_COLLABORATE_SYNC_DATA_MASK(collarborate_sync_data);
if (is_end == true) {
vpe_priv->collaborate_sync_index++;
}
vpe_priv->collaborate_sync_index++;
buf->cpu_va += size;
buf->gpu_va += size;
buf->size -= size;

View file

@ -119,14 +119,6 @@ void vpe_create_bg_segments(
vpe_priv->vpe_cmd_info[vpe_priv->num_vpe_cmds].tm_enabled =
false; // currently only support frontend tm
if (vpe_priv->vpe_cmd_info[vpe_priv->num_vpe_cmds].cd == (gaps_cnt - 1)) {
vpe_priv->vpe_cmd_info[vpe_priv->num_vpe_cmds].is_begin = true;
}
if (vpe_priv->vpe_cmd_info[vpe_priv->num_vpe_cmds].cd == 0) {
vpe_priv->vpe_cmd_info[vpe_priv->num_vpe_cmds].is_end = true;
}
vpe_priv->num_vpe_cmds++;
}
}

View file

@ -45,7 +45,7 @@ struct cmd_builder {
#ifdef VPE_BUILD_1_1
enum vpe_status (*build_collaborate_sync_cmd)(
struct vpe_priv *vpe_priv, struct vpe_build_bufs *cur_bufs, bool is_end);
struct vpe_priv *vpe_priv, struct vpe_build_bufs *cur_bufs);
#endif
};

View file

@ -98,8 +98,8 @@ struct vpe_cmd_info {
struct vpe_rect dst_viewport_c;
bool tm_enabled;
bool is_begin;
bool is_end;
bool insert_start_csync;
bool insert_end_csync;
};
struct config_record {

View file

@ -555,9 +555,6 @@ enum vpe_status vpe_build_commands(
int64_t emb_buf_size;
uint64_t cmd_buf_gpu_a, cmd_buf_cpu_a;
uint64_t emb_buf_gpu_a, emb_buf_cpu_a;
#ifdef VPE_BUILD_1_1
bool is_collaborate_sync_end = false;
#endif
if (!vpe || !param || !bufs)
return VPE_STATUS_ERROR;
@ -655,20 +652,15 @@ enum vpe_status vpe_build_commands(
vpe_bg_color_convert(vpe_priv->output_ctx.cs, vpe_priv->output_ctx.output_tf,
&vpe_priv->output_ctx.bg_color, vpe_priv->stream_ctx[0].enable_3dlut);
for (cmd_idx = 0; cmd_idx < vpe_priv->num_vpe_cmds; cmd_idx++) {
#ifdef VPE_BUILD_1_1
if ((vpe_priv->collaboration_mode == true) &&
(vpe_priv->vpe_cmd_info[cmd_idx].is_begin == true)) {
status = builder->build_collaborate_sync_cmd(
vpe_priv, &curr_bufs, is_collaborate_sync_end);
if (status != VPE_STATUS_OK) {
vpe_log("failed in building collaborate sync cmd %d\n", (int)status);
} else {
is_collaborate_sync_end = true;
}
if (vpe_priv->collaboration_mode == true) {
status = builder->build_collaborate_sync_cmd(vpe_priv, &curr_bufs);
if (status != VPE_STATUS_OK) {
vpe_log("failed in building collaborate sync cmd %d\n", (int)status);
}
}
#endif
for (cmd_idx = 0; cmd_idx < vpe_priv->num_vpe_cmds; cmd_idx++) {
status = builder->build_vpe_cmd(vpe_priv, &curr_bufs, cmd_idx);
if (status != VPE_STATUS_OK) {
vpe_log("failed in building vpe cmd %d\n", (int)status);
@ -676,17 +668,30 @@ enum vpe_status vpe_build_commands(
#ifdef VPE_BUILD_1_1
if ((vpe_priv->collaboration_mode == true) &&
(vpe_priv->vpe_cmd_info[cmd_idx].is_end == true)) {
status = builder->build_collaborate_sync_cmd(
vpe_priv, &curr_bufs, is_collaborate_sync_end);
(vpe_priv->vpe_cmd_info[cmd_idx].insert_end_csync == true)) {
status = builder->build_collaborate_sync_cmd(vpe_priv, &curr_bufs);
if (status != VPE_STATUS_OK) {
vpe_log("failed in building collaborate sync cmd %d\n", (int)status);
} else {
is_collaborate_sync_end = false;
}
// Add next collaborate sync start command when this vpe_cmd isn't the final one.
if (cmd_idx < (uint32_t)(vpe_priv->num_vpe_cmds - 1)) {
status = builder->build_collaborate_sync_cmd(vpe_priv, &curr_bufs);
if (status != VPE_STATUS_OK) {
vpe_log("failed in building collaborate sync cmd %d\n", (int)status);
}
}
}
#endif
}
#ifdef VPE_BUILD_1_1
if (vpe_priv->collaboration_mode == true) {
status = builder->build_collaborate_sync_cmd(vpe_priv, &curr_bufs);
if (status != VPE_STATUS_OK) {
vpe_log("failed in building collaborate sync cmd %d\n", (int)status);
}
}
#endif
}
if (status == VPE_STATUS_OK) {