amd/vpelib: Fix whitepoint for geometric downscaling

Fix whitepoint for geometric down scaling.

---------

Reviewed-by: Roy Chan <Roy.Chan@amd.com>
Acked-by: Jack Chih <chiachih@amd.com>
Signed-off-by: Navid Assadian <navid.assadian@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30531>
This commit is contained in:
Assadian, Navid
2024-04-19 19:13:59 -04:00
committed by Marge Bot
parent 30a28b76c8
commit a76d1aa565
3 changed files with 18 additions and 4 deletions

View File

@@ -645,6 +645,11 @@ enum vpe_status vpe_color_update_color_space_and_tf(
new_matrix_scaling_factor = vpe_fixpt_one;
stream_ctx = &vpe_priv->stream_ctx[stream_idx];
stream_ctx->geometric_scaling = geometric_scaling;
// GDS needs to preserve 'is_yuv_input' flag to be used in updating the whitepoint
if (!geometric_update && !geometric_scaling) { // Non GDS cases
stream_ctx->is_yuv_input =
stream_ctx->stream.surface_info.cs.encoding == VPE_PIXEL_ENCODING_YCbCr;
}
bool is_3dlut_enable =
stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut;
bool require_update = stream_ctx->UID_3DLUT != param->streams[stream_idx].tm_params.UID;
@@ -999,7 +1004,7 @@ enum vpe_status vpe_color_update_whitepoint(
for (unsigned int stream_index = 0; stream_index < vpe_priv->num_streams; stream_index++) {
input_isHDR = vpe_is_HDR(stream->tf);
isYCbCr = (vpe_cs->encoding == VPE_PIXEL_ENCODING_YCbCr);
isYCbCr = stream->is_yuv_input;
isG24 = (vpe_cs->tf == VPE_TF_G24);
if (!input_isHDR && output_isHDR) {

View File

@@ -80,12 +80,20 @@ enum vpe_status vpe_validate_geometric_scaling_support(const struct vpe_build_pa
void vpe_update_geometric_scaling(struct vpe_priv *vpe_priv, const struct vpe_build_param *param,
bool *geometric_update, bool *geometric_scaling)
{
bool cached_gds = vpe_priv->stream_ctx[0].geometric_scaling;
bool is_gds = (bool)vpe_priv->stream_ctx[0].stream.flags.geometric_scaling;
if (param->num_streams == 1) {
if ((bool)vpe_priv->stream_ctx[0].stream.flags.geometric_scaling !=
vpe_priv->stream_ctx[0].geometric_scaling) {
if (cached_gds != is_gds) {
*geometric_update = true;
// Vpe needs to apply the cooresponding whitepoint on the last pass
// based on the input format of the first pass
if (is_gds) { // First pass
vpe_priv->stream_ctx[0].is_yuv_input =
vpe_priv->stream_ctx[0].stream.surface_info.cs.encoding ==
VPE_PIXEL_ENCODING_YCbCr;
}
}
*geometric_scaling = (bool)vpe_priv->stream_ctx[0].stream.flags.geometric_scaling;
*geometric_scaling = is_gds;
}
}

View File

@@ -130,6 +130,7 @@ struct stream_ctx {
bool enable_3dlut;
uint64_t UID_3DLUT; // UID for current 3D LUT params
bool geometric_scaling;
bool is_yuv_input;
union {
struct {