diff options
| author | Tomson Chang <tomson.chang@amd.com> | 2024-07-16 10:43:33 +0800 |
|---|---|---|
| committer | Alan Liu <haoping.liu@amd.com> | 2024-09-30 10:12:14 +0000 |
| commit | fdbdda8c9a51c6a79dc27434ab4465c2ae5a9cfc (patch) | |
| tree | c1c990e986d38ab81024866be5d63903ee17ea35 | |
| parent | 52289f4ab29418853f92bf0c6e9e6f15f9347b60 (diff) | |
amd/vpelib: Only update cached adjustment when it is valid
Only update cached adjustment when it is valid.
Reviewed-by: Roy Chan <roy.chan@amd.com>
Acked-by: Alan Liu <haoping.liu@amd.com>
Signed-off-by: Tomson Chang <tomson.chang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31274>
| -rw-r--r-- | src/amd/vpelib/src/core/color.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/amd/vpelib/src/core/color.c b/src/amd/vpelib/src/core/color.c index 59458468a8e..3b5ea03a507 100644 --- a/src/amd/vpelib/src/core/color.c +++ b/src/amd/vpelib/src/core/color.c @@ -54,7 +54,7 @@ static bool color_update_degamma_tf(struct vpe_priv *vpe_priv, static bool color_update_input_cs(struct vpe_priv *vpe_priv, enum color_space in_cs, const struct vpe_color_adjust *adjustments, struct vpe_csc_matrix *input_cs, - struct fixed31_32 *matrix_scaling_factor); + struct vpe_color_adjust *stream_clr_adjustments, struct fixed31_32 *matrix_scaling_factor); static bool is_ycbcr(enum color_space in_cs); @@ -361,7 +361,7 @@ static enum color_space color_get_icsc_cs(enum color_space ics) // return true is bypass can be done static bool color_update_input_cs(struct vpe_priv *vpe_priv, enum color_space in_cs, const struct vpe_color_adjust *adjustments, struct vpe_csc_matrix *input_cs, - struct fixed31_32 *matrix_scaling_factor) + struct vpe_color_adjust *stream_clr_adjustments, struct fixed31_32 *matrix_scaling_factor) { int i, j; bool use_adjustments = false; @@ -390,6 +390,10 @@ static bool color_update_input_cs(struct vpe_priv *vpe_priv, enum color_space in if (!vpe_color_calculate_input_cs( vpe_priv, in_cs, adjustments, input_cs, matrix_scaling_factor)) return false; + *stream_clr_adjustments = *adjustments; + } + else { // no adjustments needed, but we still need to update the stream_clr_adjustments as it is valid + *stream_clr_adjustments = *adjustments; } return true; @@ -726,10 +730,9 @@ enum vpe_status vpe_color_update_color_space_and_tf( stream_ctx->stream.surface_info.format); if (stream_ctx->dirty_bits.color_space) { - stream_ctx->color_adjustments = stream_ctx->stream.color_adj; // Always update the cached color adj when it's dirty if (!color_update_input_cs(vpe_priv, stream_ctx->cs, &stream_ctx->stream.color_adj, stream_ctx->input_cs, - &new_matrix_scaling_factor)) { + &stream_ctx->color_adjustments, &new_matrix_scaling_factor)) { vpe_log("err: input cs not being programmed!"); } else { |