amd/vpelib: Adding new wrapper for register profiling
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

[WHY]
To read back register read/write counts from VPEs, we need to add a new
wrapper function.

[HOW]
Added a wrapper that calls build command and populate the register
profiling data structure.

Acked-by: Chuanyu Tseng <Chuanyu.Tseng@amd.com>
Signed-off-by: Muhammad Ansari <Muhammad.Ansari@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39848>
This commit is contained in:
Ansari, Muhammad 2025-12-03 22:22:23 -05:00 committed by Marge Bot
parent 2a5124a09f
commit d42268f3e5
3 changed files with 51 additions and 0 deletions

View file

@ -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

View file

@ -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()

View file

@ -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;