amd/vpelib: Add param check for geometric scaling and refactor

[WHY]
Param check for geometric scaling is required.
3dlut for geometric scaling case is too complicate.

[HOW]
Add Param check for geometric scaling.
Refactor 3dlut for geometric scaling case.

Reviewed-by: Roy Chan <Roy.Chan@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:
Mike Hsieh 2023-10-19 16:14:26 +08:00 committed by Marge Bot
parent 4893afd427
commit cb6d928327
6 changed files with 22 additions and 15 deletions

View file

@ -72,7 +72,8 @@ enum vpe_status {
VPE_STATUS_REPEAT_ITEM,
VPE_STATUS_PATCH_OVER_MAXSIZE,
VPE_STATUS_INVALID_BUFFER_SIZE,
VPE_STATUS_SCALER_NOT_SET
VPE_STATUS_SCALER_NOT_SET,
VPE_STATUS_GEOMETRICSCALING_ERROR
};
/** HW IP level */

View file

@ -778,11 +778,9 @@ enum vpe_status vpe_color_update_movable_cm(
stream_ctx = &vpe_priv->stream_ctx[stream_idx];
bool enable_3dlut = stream_ctx->stream.tm_params.enable_3dlut;
bool update_3dlut = stream_ctx->stream.tm_params.update_3dlut;
if (param->streams->flags.geometric_scaling) {
enable_3dlut = false;
update_3dlut = true;
}
if (stream_ctx->update_3dlut) {
@ -850,10 +848,7 @@ enum vpe_status vpe_color_update_movable_cm(
vpe_convert_to_tetrahedral(vpe_priv, param->streams[stream_idx].tm_params.lut_data,
stream_ctx->lut3d_func, enable_3dlut);
if (param->streams->flags.geometric_scaling)
stream_ctx->update_3dlut = true;
else
stream_ctx->update_3dlut = false;
stream_ctx->update_3dlut = false;
}
}
exit:

View file

@ -553,14 +553,11 @@ enum vpe_status vpe_check_input_support(struct vpe *vpe, const struct vpe_stream
}
enum vpe_status vpe_cache_tone_map_params(
struct stream_ctx *stream_ctx, const struct vpe_build_param *param)
struct stream_ctx *stream_ctx, const struct vpe_stream *stream)
{
stream_ctx->update_3dlut = stream_ctx->update_3dlut || param->streams->tm_params.update_3dlut;
if (param->streams->flags.geometric_scaling) {
stream_ctx->update_3dlut = true;
}
stream_ctx->update_3dlut = stream_ctx->update_3dlut || stream->tm_params.update_3dlut ||
(stream_ctx->stream.flags.geometric_scaling != stream->flags.geometric_scaling);
return VPE_STATUS_OK;
}

View file

@ -81,7 +81,7 @@ enum vpe_status vpe_check_output_support(struct vpe *vpe, const struct vpe_build
enum vpe_status vpe_check_input_support(struct vpe *vpe, const struct vpe_stream *stream);
enum vpe_status vpe_cache_tone_map_params(struct stream_ctx *, const struct vpe_build_param *param);
enum vpe_status vpe_cache_tone_map_params(struct stream_ctx *, const struct vpe_stream *stream);
enum vpe_status vpe_check_tone_map_support(
struct vpe *vpe, const struct vpe_stream *stream, const struct vpe_build_param *param);

View file

@ -160,6 +160,7 @@ struct stream_ctx *vpe_alloc_stream_ctx(struct vpe_priv *vpe_priv, uint32_t num_
ctx->vpe_priv = vpe_priv;
vpe_color_set_adjustments_to_default(&ctx->color_adjustments);
ctx->tf_scaling_factor = vpe_fixpt_one;
ctx->stream.flags.geometric_scaling = 0;
}
return ctx_base;

View file

@ -182,6 +182,15 @@ void vpe_destroy(struct vpe **vpe)
*vpe = NULL;
}
static enum vpe_status validate_geometric_scaling_support(const struct vpe_build_param *param)
{
if(param->num_streams > 1 && param->streams[0].flags.geometric_scaling)
{
return VPE_STATUS_GEOMETRICSCALING_ERROR;
}
return VPE_STATUS_OK;
}
/*****************************************************************************************
* handle_zero_input
* handle any zero input stream but background output only
@ -344,7 +353,7 @@ enum vpe_status vpe_check_support(
// Need a sticky bit to tell vpe to program the 3dlut on next jobs submission even
// if 3dlut has not changed
for (i = 0; i < param->num_streams; i++) {
vpe_cache_tone_map_params(&vpe_priv->stream_ctx[i], param);
vpe_cache_tone_map_params(&vpe_priv->stream_ctx[i], &param->streams[i]);
}
if (status == VPE_STATUS_OK) {
@ -450,6 +459,10 @@ enum vpe_status vpe_check_support(
vpe_priv->ops_support = true;
}
if (status == VPE_STATUS_OK) {
status = validate_geometric_scaling_support(param);
}
if (vpe_priv->init.debug.assert_when_not_support)
VPE_ASSERT(status == VPE_STATUS_OK);