diff --git a/src/amd/vpelib/src/chip/vpe10/vpe10_resource.c b/src/amd/vpelib/src/chip/vpe10/vpe10_resource.c index 8f9c8a7e630..d88ef429837 100644 --- a/src/amd/vpelib/src/chip/vpe10/vpe10_resource.c +++ b/src/amd/vpelib/src/chip/vpe10/vpe10_resource.c @@ -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; + } } + */ } } diff --git a/src/amd/vpelib/src/chip/vpe11/inc/vpe11_cmd_builder.h b/src/amd/vpelib/src/chip/vpe11/inc/vpe11_cmd_builder.h index 5d8c3914a7e..5d19287df7e 100644 --- a/src/amd/vpelib/src/chip/vpe11/inc/vpe11_cmd_builder.h +++ b/src/amd/vpelib/src/chip/vpe11/inc/vpe11_cmd_builder.h @@ -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 diff --git a/src/amd/vpelib/src/chip/vpe11/vpe11_cmd_builder.c b/src/amd/vpelib/src/chip/vpe11/vpe11_cmd_builder.c index 6189714c391..4321bf5b10d 100644 --- a/src/amd/vpelib/src/chip/vpe11/vpe11_cmd_builder.c +++ b/src/amd/vpelib/src/chip/vpe11/vpe11_cmd_builder.c @@ -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; diff --git a/src/amd/vpelib/src/core/background.c b/src/amd/vpelib/src/core/background.c index bdf6c29f59c..bdf092fd1e8 100644 --- a/src/amd/vpelib/src/core/background.c +++ b/src/amd/vpelib/src/core/background.c @@ -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++; } } diff --git a/src/amd/vpelib/src/core/inc/cmd_builder.h b/src/amd/vpelib/src/core/inc/cmd_builder.h index e4bc4a7f67b..0c0a7938ad6 100644 --- a/src/amd/vpelib/src/core/inc/cmd_builder.h +++ b/src/amd/vpelib/src/core/inc/cmd_builder.h @@ -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 }; diff --git a/src/amd/vpelib/src/core/inc/vpe_priv.h b/src/amd/vpelib/src/core/inc/vpe_priv.h index 81d222d62ee..4b2b5069839 100644 --- a/src/amd/vpelib/src/core/inc/vpe_priv.h +++ b/src/amd/vpelib/src/core/inc/vpe_priv.h @@ -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 { diff --git a/src/amd/vpelib/src/core/vpelib.c b/src/amd/vpelib/src/core/vpelib.c index 576f1a4b9cb..c9f7b8c94d0 100644 --- a/src/amd/vpelib/src/core/vpelib.c +++ b/src/amd/vpelib/src/core/vpelib.c @@ -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) {