diff --git a/src/amd/vpelib/inc/vpe_types.h b/src/amd/vpelib/inc/vpe_types.h index 6b855c1063e..01e331c36fe 100644 --- a/src/amd/vpelib/inc/vpe_types.h +++ b/src/amd/vpelib/inc/vpe_types.h @@ -998,6 +998,18 @@ struct vpe_engine { struct vpe_check_support_funcs check_funcs; /**< vpe check format support funcs */ }; +#ifdef VPE_REGISTER_PROFILE +/** @struct vpe_register_count + * @brief VPE register profiling information + */ +struct vpe_register_count { + uint64_t total_register_count; /**< Total Registers Accessed */ + uint64_t burstmode_register_count; /**< Burst Mode Registers Accessed */ + uint64_t nonburstmode_register_count; /**< Non-Burst Mode Registers Accessed */ + uint64_t total_config_count; /**< Total Config Descriptors */ + uint64_t reused_config_count; /**< Total Re-used Config Descriptors */ +}; +#endif #ifdef __cplusplus } #endif diff --git a/src/amd/vpelib/inc/vpelib.h b/src/amd/vpelib/inc/vpelib.h index 714452cd352..0c7f10baad7 100644 --- a/src/amd/vpelib/inc/vpelib.h +++ b/src/amd/vpelib/inc/vpelib.h @@ -117,6 +117,24 @@ enum vpe_status vpe_build_noops(struct vpe *vpe, uint32_t num_dwords, uint32_t * enum vpe_status vpe_build_commands( struct vpe *vpe, const struct vpe_build_param *param, struct vpe_build_bufs *bufs); +#ifdef VPE_REGISTER_PROFILE +/** + * Wrapper function for vpe_build_commands to be used with profiling + * caller must call vpe_check_support() before this function, + * unexpected result otherwise. + * + * @param[in] vpe vpe instance created by vpe_create() + * @param[in] param vpe build params + * @param[in,out] bufs [in] memory allocated for the command buffer, embedded buffer and 3dlut. + * If size is 0, it reports the required size for this checked + * operation. [out] the next write address and the filled sizes. + * @param[out] reg_counts register profiling data collected during command building + * @return status + */ + +enum vpe_status vpe_get_register_profile_data(struct vpe *vpe, const struct vpe_build_param *param, + struct vpe_build_bufs *bufs, struct vpe_register_count *reg_count); +#endif /** * get the optimal number of taps based on the scaling ratio. * @param[in] vpe vpe instance created by vpe_create() diff --git a/src/amd/vpelib/src/core/vpelib.c b/src/amd/vpelib/src/core/vpelib.c index ce37555e590..f332ab66cd7 100644 --- a/src/amd/vpelib/src/core/vpelib.c +++ b/src/amd/vpelib/src/core/vpelib.c @@ -912,6 +912,27 @@ enum vpe_status vpe_build_commands( return status; } +#ifdef VPE_REGISTER_PROFILE +enum vpe_status vpe_get_register_profile_data(struct vpe *vpe, const struct vpe_build_param *param, + struct vpe_build_bufs *bufs, struct vpe_register_count *reg_count) +{ + struct vpe_priv *vpe_priv; + + vpe_priv = container_of(vpe, struct vpe_priv, pub); + // call build commands to get the register profile data + enum vpe_status status = vpe_build_commands(vpe, param, bufs); + + // populate the register count data and return + reg_count->total_register_count = vpe_priv->config_writer.total_register_count; + reg_count->burstmode_register_count = vpe_priv->config_writer.burstMode_register_count; + reg_count->nonburstmode_register_count = vpe_priv->config_writer.nonBurstMode_register_count; + reg_count->total_config_count = vpe_priv->config_writer.total_config_count; + reg_count->reused_config_count = vpe_priv->config_writer.reused_config_count; + + return status; +} +#endif + void vpe_get_optimal_num_of_taps(struct vpe *vpe, struct vpe_scaling_info *scaling_info) { struct vpe_priv *vpe_priv;