mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
amd/vpelib: Add UID for 3d Lut and control logic
[WHY] 3D lut generation takes time, we need to cache it and identify it as it updated. [HOW] Add unique id when new 3d lut is generated. Add control logic with UID. Reviewed-by: Jesse Agate <jesse.agate@amd.com> Acked-by: Alan Liu <haoping.liu@amd.com> Signed-off-by: Mike Hsieh <Mike.Hsieh@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27239>
This commit is contained in:
parent
039b1e0a1e
commit
33d88f797b
7 changed files with 19 additions and 11 deletions
|
|
@ -546,6 +546,7 @@ struct vpe_hdr_metadata {
|
|||
};
|
||||
|
||||
struct vpe_tonemap_params {
|
||||
uint64_t UID; /* Unique ID for tonemap params */
|
||||
enum vpe_transfer_function shaper_tf;
|
||||
enum vpe_transfer_function lut_out_tf;
|
||||
enum vpe_color_primaries lut_in_gamut;
|
||||
|
|
|
|||
|
|
@ -751,7 +751,7 @@ int32_t vpe10_program_frontend(struct vpe_priv *vpe_priv, uint32_t pipe_idx, uin
|
|||
fmt.exponenta_bits = 6;
|
||||
fmt.mantissa_bits = 12;
|
||||
fmt.sign = true;
|
||||
if (stream_ctx->stream.tm_params.enable_3dlut) {
|
||||
if (stream_ctx->stream.tm_params.UID || stream_ctx->stream.tm_params.enable_3dlut) {
|
||||
vpe_convert_to_custom_float_format(
|
||||
stream_ctx->lut3d_func->hdr_multiplier, &fmt, &hw_mult);
|
||||
} else {
|
||||
|
|
@ -893,7 +893,7 @@ enum vpe_status vpe10_populate_cmd_info(struct vpe_priv *vpe_priv)
|
|||
for (stream_idx = 0; stream_idx < vpe_priv->num_streams; stream_idx++) {
|
||||
stream_ctx = &vpe_priv->stream_ctx[stream_idx];
|
||||
|
||||
tm_enabled = stream_ctx->stream.tm_params.enable_3dlut;
|
||||
tm_enabled = stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut;
|
||||
|
||||
for (segment_idx = 0; segment_idx < stream_ctx->num_segments; segment_idx++) {
|
||||
if (vpe_priv->num_vpe_cmds >= MAX_VPE_CMD) {
|
||||
|
|
@ -959,7 +959,8 @@ void vpe10_create_stream_ops_config(struct vpe_priv *vpe_priv, uint32_t pipe_idx
|
|||
if (ops == VPE_CMD_OPS_BG_VSCF_INPUT) {
|
||||
blndcfg.bg_color = vpe_get_visual_confirm_color(stream_ctx->stream.surface_info.format,
|
||||
stream_ctx->stream.surface_info.cs, vpe_priv->output_ctx.cs,
|
||||
vpe_priv->output_ctx.output_tf, stream_ctx->stream.tm_params.enable_3dlut);
|
||||
vpe_priv->output_ctx.output_tf,
|
||||
(stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut));
|
||||
} else if (ops == VPE_CMD_OPS_BG_VSCF_OUTPUT) {
|
||||
blndcfg.bg_color = vpe_get_visual_confirm_color(vpe_priv->output_ctx.surface.format,
|
||||
vpe_priv->output_ctx.surface.cs, vpe_priv->output_ctx.cs,
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ static enum vpe_status vpe_update_blnd_gamma(
|
|||
|
||||
is_studio = (param->dst_surface.cs.range == VPE_COLOR_RANGE_STUDIO);
|
||||
output_ctx = &vpe_priv->output_ctx;
|
||||
lut3d_enabled = tm_params->enable_3dlut;
|
||||
lut3d_enabled = tm_params->UID != 0 || tm_params->enable_3dlut;
|
||||
|
||||
if (is_studio) {
|
||||
|
||||
|
|
@ -686,7 +686,7 @@ enum vpe_status vpe_color_update_color_space_and_tf(
|
|||
|
||||
color_check_input_cm_update(vpe_priv, stream_ctx,
|
||||
¶m->streams[stream_idx].surface_info.cs, ¶m->streams[stream_idx].color_adj,
|
||||
param->streams[stream_idx].tm_params.enable_3dlut);
|
||||
param->streams[stream_idx].tm_params.UID != 0 || param->streams[stream_idx].tm_params.enable_3dlut);
|
||||
|
||||
build_scale_and_bias(stream_ctx->bias_scale,
|
||||
¶m->streams[stream_idx].surface_info.cs,
|
||||
|
|
@ -714,13 +714,14 @@ enum vpe_status vpe_color_update_color_space_and_tf(
|
|||
vpe_priv->stream_ctx->tf_scaling_factor,
|
||||
vpe_fixpt_one,
|
||||
vpe_fixpt_zero,
|
||||
stream_ctx->stream.tm_params.enable_3dlut, // By Pass degamma if 3DLUT is enabled
|
||||
stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut, // By Pass degamma if 3DLUT is enabled
|
||||
stream_ctx->input_tf);
|
||||
}
|
||||
|
||||
if (stream_ctx->dirty_bits.color_space || output_ctx->dirty_bits.color_space) {
|
||||
status = vpe_color_update_gamut(vpe_priv, stream_ctx->cs, output_ctx->cs,
|
||||
stream_ctx->gamut_remap, stream_ctx->stream.tm_params.enable_3dlut);
|
||||
stream_ctx->gamut_remap,
|
||||
stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -791,9 +792,9 @@ enum vpe_status vpe_color_update_movable_cm(
|
|||
for (stream_idx = 0; stream_idx < param->num_streams; stream_idx++) {
|
||||
stream_ctx = &vpe_priv->stream_ctx[stream_idx];
|
||||
|
||||
bool enable_3dlut = stream_ctx->stream.tm_params.enable_3dlut;
|
||||
bool enable_3dlut = stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut;
|
||||
|
||||
if (stream_ctx->update_3dlut) {
|
||||
if (stream_ctx->update_3dlut || stream_ctx->UID_3DLUT != stream_ctx->stream.tm_params.UID) {
|
||||
|
||||
uint32_t shaper_norm_factor;
|
||||
struct vpe_color_space tm_out_cs;
|
||||
|
|
@ -857,6 +858,7 @@ enum vpe_status vpe_color_update_movable_cm(
|
|||
stream_ctx->lut3d_func, enable_3dlut);
|
||||
|
||||
stream_ctx->update_3dlut = false;
|
||||
stream_ctx->UID_3DLUT = param->streams[stream_idx].tm_params.UID;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ enum vpe_status vpe_cache_tone_map_params(
|
|||
struct stream_ctx *stream_ctx, const struct vpe_stream *stream)
|
||||
{
|
||||
stream_ctx->update_3dlut = stream_ctx->update_3dlut || stream->tm_params.update_3dlut ||
|
||||
(stream_ctx->stream.flags.geometric_scaling != stream->flags.geometric_scaling);
|
||||
stream->tm_params.UID || (stream_ctx->stream.flags.geometric_scaling != stream->flags.geometric_scaling);
|
||||
|
||||
return VPE_STATUS_OK;
|
||||
}
|
||||
|
|
@ -566,7 +566,7 @@ enum vpe_status vpe_check_tone_map_support(
|
|||
{
|
||||
enum vpe_status status = VPE_STATUS_OK;
|
||||
bool input_is_hdr = is_HDR(stream->surface_info.cs.tf);
|
||||
bool is_3D_lut_enabled = stream->tm_params.enable_3dlut;
|
||||
bool is_3D_lut_enabled = stream->tm_params.enable_3dlut || stream->tm_params.UID;
|
||||
bool is_hlg = stream->tm_params.shaper_tf == VPE_TF_HLG;
|
||||
bool is_in_lum_greater_than_out_lum = stream->hdr_metadata.max_mastering > param->hdr_metadata.max_mastering;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ void geometric_scaling_feature_skip(struct vpe_priv *vpe_priv, const struct vpe_
|
|||
vpe_priv->output_ctx.surface.cs.tf = param->streams[0].surface_info.cs.tf;
|
||||
|
||||
/* skip tone mapping */
|
||||
vpe_priv->stream_ctx[0].stream.tm_params.UID = 0;
|
||||
vpe_priv->stream_ctx[0].stream.tm_params.enable_3dlut = false;
|
||||
|
||||
/* disable blending */
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ struct stream_ctx {
|
|||
enum color_space cs;
|
||||
bool enable_3dlut;
|
||||
bool update_3dlut;
|
||||
uint64_t UID_3DLUT; // UID for current 3D LUT params
|
||||
|
||||
union {
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -161,6 +161,8 @@ struct stream_ctx *vpe_alloc_stream_ctx(struct vpe_priv *vpe_priv, uint32_t num_
|
|||
vpe_color_set_adjustments_to_default(&ctx->color_adjustments);
|
||||
ctx->tf_scaling_factor = vpe_fixpt_one;
|
||||
ctx->stream.flags.geometric_scaling = 0;
|
||||
ctx->stream.tm_params.UID = 0;
|
||||
ctx->UID_3DLUT = 0;
|
||||
}
|
||||
|
||||
return ctx_base;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue