mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-09 07:58:16 +02:00
amd/vpelib: update 3dlut and shaper FL
[WHY] Fast load support is required for 3DLUT and Shaper features. The calculation logic needs to be modularized and exposed via the resource interface to support this. [HOW] 1. Add `calculate_shaper` and `program_fastload` function pointers to the `resource` struct. 2. Move shaper normalization, HDR multiplier update, and 3DLUT update logic from `vpe_color_update_movable_cm` into a new core function `vpe_calculate_shaper`. 3. Implement `vpe10_calculate_shaper` and assign it to the resource function table for VPE10 and VPE11. 4. Update `vpe_create_engine` return signature to remove `const` qualifier. Acked-by: Chuanyu Tseng <Chuanyu.Tseng@amd.com> Signed-off-by: Nawwar Ali <Nawwar.Ali@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39848>
This commit is contained in:
parent
4ffd5a1c31
commit
f3db1d5f46
9 changed files with 57 additions and 17 deletions
|
|
@ -158,7 +158,7 @@ enum vpe_status vpe_build_resolve_query(
|
|||
* @param[in] param provide the asic version.
|
||||
* @return vpe engine instance if valid. NULL otherwise
|
||||
*/
|
||||
const struct vpe_engine *vpe_create_engine(struct vpe_init_data *param);
|
||||
struct vpe_engine *vpe_create_engine(struct vpe_init_data *param);
|
||||
|
||||
/**
|
||||
* destroy the vpe engine instance.
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@ bool vpe10_validate_cached_param(struct vpe_priv *vpe_priv, const struct vpe_bui
|
|||
void vpe10_setup_check_funcs(struct vpe_check_support_funcs *funcs);
|
||||
|
||||
const struct vpe_caps *vpe10_get_capability(void);
|
||||
|
||||
enum vpe_status vpe10_calculate_shaper(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -438,6 +438,7 @@ enum vpe_status vpe10_construct_resource(struct vpe_priv *vpe_priv, struct resou
|
|||
res->update_blnd_gamma = vpe10_update_blnd_gamma;
|
||||
res->update_output_gamma = vpe10_update_output_gamma;
|
||||
res->validate_cached_param = vpe10_validate_cached_param;
|
||||
res->calculate_shaper = vpe10_calculate_shaper;
|
||||
|
||||
return VPE_STATUS_OK;
|
||||
err:
|
||||
|
|
@ -1535,3 +1536,8 @@ void vpe10_setup_check_funcs(struct vpe_check_support_funcs *funcs)
|
|||
funcs->get_dcc_compression_input_cap = vpe10_get_dcc_compression_input_cap;
|
||||
funcs->get_dcc_compression_output_cap = vpe10_get_dcc_compression_output_cap;
|
||||
}
|
||||
|
||||
enum vpe_status vpe10_calculate_shaper(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx)
|
||||
{
|
||||
return vpe_calculate_shaper(vpe_priv, stream_ctx); // calculate shaper data and config
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ enum vpe_status vpe11_construct_resource(struct vpe_priv *vpe_priv, struct resou
|
|||
res->update_blnd_gamma = vpe10_update_blnd_gamma;
|
||||
res->update_output_gamma = vpe10_update_output_gamma;
|
||||
res->validate_cached_param = vpe11_validate_cached_param;
|
||||
res->calculate_shaper = vpe10_calculate_shaper;
|
||||
|
||||
return VPE_STATUS_OK;
|
||||
err:
|
||||
|
|
|
|||
|
|
@ -777,6 +777,40 @@ enum vpe_status vpe_color_update_shaper(const struct vpe_priv *vpe_priv, uint16_
|
|||
return ret;
|
||||
}
|
||||
|
||||
enum vpe_status vpe_calculate_shaper(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx)
|
||||
{
|
||||
uint32_t shaper_norm_factor;
|
||||
struct vpe_color_space cs;
|
||||
enum color_space out_lut_cs;
|
||||
enum color_transfer_func lut_in_tf;
|
||||
bool need_update_3dlut = true;
|
||||
bool enable_3dlut =
|
||||
stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut;
|
||||
|
||||
// Get the normalization factor for the shaper based on tone mapping parameters.
|
||||
get_shaper_norm_factor(&stream_ctx->stream.tm_params, stream_ctx, &shaper_norm_factor);
|
||||
|
||||
// Update the HDR multiplier based on the shaper normalization factor and other parameters.
|
||||
vpe_color_tm_update_hdr_mult(SHAPER_EXP_MAX_IN, shaper_norm_factor,
|
||||
&stream_ctx->lut3d_func->hdr_multiplier, enable_3dlut,
|
||||
vpe_is_fp16(stream_ctx->stream.surface_info.format));
|
||||
|
||||
if (need_update_3dlut) {
|
||||
/* DirectConfig loading case */
|
||||
vpe_color_update_3dlut(vpe_priv, stream_ctx, enable_3dlut);
|
||||
}
|
||||
|
||||
// Build the shaper color space based on tone mapping parameters and output surface.
|
||||
vpe_color_build_shaper_cs(&stream_ctx->stream.tm_params, &vpe_priv->output_ctx.surface, &cs);
|
||||
|
||||
// Extract the color space and transfer function from the shaper color space.
|
||||
vpe_color_get_color_space_and_tf(&cs, &out_lut_cs, &lut_in_tf);
|
||||
|
||||
// Update the shaper transfer function for the current stream.
|
||||
return vpe_color_update_shaper(
|
||||
vpe_priv, SHAPER_EXP_MAX_IN, stream_ctx, lut_in_tf, enable_3dlut);
|
||||
}
|
||||
|
||||
enum vpe_status vpe_color_update_movable_cm(
|
||||
struct vpe_priv *vpe_priv, const struct vpe_build_param *param)
|
||||
{
|
||||
|
|
@ -793,12 +827,9 @@ enum vpe_status vpe_color_update_movable_cm(
|
|||
|
||||
if (stream_ctx->uid_3dlut != stream_ctx->stream.tm_params.UID) {
|
||||
|
||||
uint32_t shaper_norm_factor;
|
||||
struct vpe_color_space tm_out_cs;
|
||||
struct vpe_color_space cs;
|
||||
enum color_space out_lut_cs;
|
||||
enum color_transfer_func tf, lut_in_tf;
|
||||
|
||||
enum color_transfer_func tf;
|
||||
if (!stream_ctx->in_shaper_func) {
|
||||
stream_ctx->in_shaper_func =
|
||||
(struct transfer_func *)vpe_zalloc(sizeof(struct transfer_func));
|
||||
|
|
@ -838,17 +869,7 @@ enum vpe_status vpe_color_update_movable_cm(
|
|||
}
|
||||
}
|
||||
|
||||
get_shaper_norm_factor(&stream_ctx->stream.tm_params, stream_ctx, &shaper_norm_factor);
|
||||
|
||||
vpe_color_tm_update_hdr_mult(SHAPER_EXP_MAX_IN, shaper_norm_factor,
|
||||
&stream_ctx->lut3d_func->hdr_multiplier, enable_3dlut,
|
||||
vpe_is_fp16(stream_ctx->stream.surface_info.format));
|
||||
|
||||
vpe_color_build_shaper_cs(
|
||||
&stream_ctx->stream.tm_params, &vpe_priv->output_ctx.surface, &cs);
|
||||
vpe_color_get_color_space_and_tf(&cs, &out_lut_cs, &lut_in_tf);
|
||||
vpe_color_update_shaper(
|
||||
vpe_priv, SHAPER_EXP_MAX_IN, stream_ctx, lut_in_tf, enable_3dlut);
|
||||
vpe_priv->resource.calculate_shaper(vpe_priv, stream_ctx);
|
||||
|
||||
vpe_color_build_tm_cs(
|
||||
&stream_ctx->stream.tm_params, &vpe_priv->output_ctx.surface, &tm_out_cs);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "vpe_types.h"
|
||||
#include "plane_desc_writer.h"
|
||||
#include "hw_shared.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -46,6 +47,7 @@ struct cmd_builder {
|
|||
|
||||
enum vpe_status (*build_collaborate_sync_cmd)(
|
||||
struct vpe_priv *vpe_priv, struct vpe_build_bufs *cur_bufs);
|
||||
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -264,6 +264,8 @@ enum vpe_status vpe_color_update_movable_cm(
|
|||
void vpe_color_get_color_space_and_tf(
|
||||
const struct vpe_color_space *vcs, enum color_space *cs, enum color_transfer_func *tf);
|
||||
|
||||
enum vpe_status vpe_shaper_generator(struct vpe_priv *vpe_priv);
|
||||
|
||||
bool vpe_use_csc_adjust(const struct vpe_color_adjust *adjustments);
|
||||
|
||||
bool vpe_is_rgb_equal(const struct pwl_result_data *rgb, uint32_t num);
|
||||
|
|
@ -302,6 +304,8 @@ bool vpe_color_update_degamma_tf(struct vpe_priv *vpe_priv, enum color_transfer_
|
|||
enum color_range_type vpe_get_range_type(
|
||||
enum color_space color_space, enum vpe_surface_pixel_format format);
|
||||
|
||||
enum vpe_status vpe_calculate_shaper(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -114,6 +114,9 @@ struct resource {
|
|||
bool geometric_scaling);
|
||||
|
||||
bool (*validate_cached_param)(struct vpe_priv *vpe_priv, const struct vpe_build_param *param);
|
||||
|
||||
enum vpe_status (*calculate_shaper)(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx);
|
||||
|
||||
// Indicates the nominal range hdr input content should be in during processing.
|
||||
int internal_hdr_normalization;
|
||||
|
||||
|
|
|
|||
|
|
@ -1011,7 +1011,7 @@ enum vpe_status vpe_build_resolve_query(
|
|||
return result;
|
||||
}
|
||||
|
||||
const struct vpe_engine *vpe_create_engine(struct vpe_init_data *params)
|
||||
struct vpe_engine *vpe_create_engine(struct vpe_init_data *params)
|
||||
{
|
||||
struct vpe_engine_priv *engine_priv;
|
||||
struct vpe_engine *engine_handle;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue