mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 15:50:17 +01:00
amd/vpelib: More parameters to the segmentation process and introduce validation hook
Generalization for the following: 1. pass in the scaler output alignment requirement to segment number determination function 2. parameter validation hook Signed-off-by: Navid Assadian <Navid.Assadian@amd.com> Reviewed-by: Roy Chan <Roy.Chan@amd.com> Reviewed-by: Jesse Agate <Jesse.Agate@amd.com> Acked-by: Alan Liu <Haoping.Liu@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33833>
This commit is contained in:
parent
37c244998a
commit
9a88afecbd
8 changed files with 106 additions and 53 deletions
|
|
@ -35,7 +35,7 @@ void vpe10_destroy_resource(struct vpe_priv *vpe_priv, struct resource *res);
|
|||
|
||||
enum vpe_status vpe10_set_num_segments(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx,
|
||||
struct scaler_data *scl_data, struct vpe_rect *src_rect, struct vpe_rect *dst_rect,
|
||||
uint32_t *max_seg_width);
|
||||
uint32_t *max_seg_width, uint32_t recout_width_alignment);
|
||||
|
||||
bool vpe10_get_dcc_compression_output_cap(const struct vpe *vpe, const struct vpe_dcc_surface_param *params, struct vpe_surface_dcc_cap *cap);
|
||||
|
||||
|
|
@ -85,6 +85,8 @@ struct dpp *vpe10_dpp_create(struct vpe_priv *vpe_priv, int inst);
|
|||
struct cdc_fe *vpe10_cdc_fe_create(struct vpe_priv *vpe_priv, int inst);
|
||||
struct cdc_be *vpe10_cdc_be_create(struct vpe_priv *vpe_priv, int inst);
|
||||
|
||||
bool vpe10_validate_cached_param(struct vpe_priv *vpe_priv, const struct vpe_build_param *param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -247,13 +247,14 @@ static bool vpe10_init_scaler_data(struct vpe_priv *vpe_priv, struct stream_ctx
|
|||
|
||||
enum vpe_status vpe10_set_num_segments(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx,
|
||||
struct scaler_data *scl_data, struct vpe_rect *src_rect, struct vpe_rect *dst_rect,
|
||||
uint32_t *max_seg_width)
|
||||
uint32_t *max_seg_width, uint32_t recout_width_alignment)
|
||||
{
|
||||
|
||||
uint16_t num_segs;
|
||||
struct dpp *dpp = vpe_priv->resource.dpp[0];
|
||||
const uint32_t max_lb_size = dpp->funcs->get_line_buffer_size();
|
||||
|
||||
(void)recout_width_alignment;
|
||||
|
||||
*max_seg_width = min(*max_seg_width, max_lb_size / scl_data->taps.v_taps);
|
||||
|
||||
num_segs = vpe_get_num_segments(vpe_priv, src_rect, dst_rect, *max_seg_width);
|
||||
|
|
@ -419,6 +420,7 @@ enum vpe_status vpe10_construct_resource(struct vpe_priv *vpe_priv, struct resou
|
|||
res->check_bg_color_support = vpe10_check_bg_color_support;
|
||||
res->check_mirror_rotation_support = vpe10_check_mirror_rotation_support;
|
||||
res->update_blnd_gamma = vpe10_update_blnd_gamma;
|
||||
res->validate_cached_param = vpe10_validate_cached_param;
|
||||
|
||||
return VPE_STATUS_OK;
|
||||
err:
|
||||
|
|
@ -652,7 +654,7 @@ enum vpe_status vpe10_calculate_segments(
|
|||
return VPE_STATUS_SCALING_RATIO_NOT_SUPPORTED;
|
||||
|
||||
res = vpe_priv->resource.set_num_segments(
|
||||
vpe_priv, stream_ctx, &scl_data, src_rect, dst_rect, &max_seg_width);
|
||||
vpe_priv, stream_ctx, &scl_data, src_rect, dst_rect, &max_seg_width, 0);
|
||||
if (res != VPE_STATUS_OK)
|
||||
return res;
|
||||
|
||||
|
|
@ -1263,6 +1265,44 @@ enum vpe_status vpe10_update_blnd_gamma(struct vpe_priv *vpe_priv,
|
|||
return status;
|
||||
}
|
||||
|
||||
bool vpe10_validate_cached_param(struct vpe_priv *vpe_priv, const struct vpe_build_param *param)
|
||||
{
|
||||
uint32_t i;
|
||||
struct output_ctx *output_ctx;
|
||||
|
||||
if (vpe_priv->num_input_streams != param->num_streams &&
|
||||
!(vpe_priv->init.debug.bg_color_fill_only == true && vpe_priv->num_streams == 1))
|
||||
return false;
|
||||
|
||||
for (i = 0; i < vpe_priv->num_input_streams; i++) {
|
||||
struct vpe_stream stream = param->streams[i];
|
||||
|
||||
vpe_clip_stream(
|
||||
&stream.scaling_info.src_rect, &stream.scaling_info.dst_rect, ¶m->target_rect);
|
||||
|
||||
if (memcmp(&vpe_priv->stream_ctx[i].stream, &stream, sizeof(struct vpe_stream)))
|
||||
return false;
|
||||
}
|
||||
|
||||
output_ctx = &vpe_priv->output_ctx;
|
||||
if (output_ctx->alpha_mode != param->alpha_mode)
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->mpc_bg_color, ¶m->bg_color, sizeof(struct vpe_color)))
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->opp_bg_color, ¶m->bg_color, sizeof(struct vpe_color)))
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->target_rect, ¶m->target_rect, sizeof(struct vpe_rect)))
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->surface, ¶m->dst_surface, sizeof(struct vpe_surface_info)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static enum vpe_status bg_color_outside_cs_gamut(
|
||||
const struct vpe_priv *vpe_priv, struct vpe_color *bg_color)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,9 @@ void vpe11_destroy_resource(struct vpe_priv *vpe_priv, struct resource *res);
|
|||
|
||||
enum vpe_status vpe11_set_num_segments(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx,
|
||||
struct scaler_data *scl_data, struct vpe_rect *src_rect, struct vpe_rect *dst_rect,
|
||||
uint32_t *max_seg_width);
|
||||
uint32_t *max_seg_width, uint32_t recout_width_alignment);
|
||||
|
||||
bool vpe11_validate_cached_param(struct vpe_priv *vpe_priv, const struct vpe_build_param *param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ enum vpe_status vpe11_construct_resource(struct vpe_priv *vpe_priv, struct resou
|
|||
res->check_bg_color_support = vpe10_check_bg_color_support;
|
||||
res->check_mirror_rotation_support = vpe10_check_mirror_rotation_support;
|
||||
res->update_blnd_gamma = vpe10_update_blnd_gamma;
|
||||
res->validate_cached_param = vpe11_validate_cached_param;
|
||||
|
||||
return VPE_STATUS_OK;
|
||||
err:
|
||||
|
|
@ -233,13 +234,13 @@ void vpe11_destroy_resource(struct vpe_priv *vpe_priv, struct resource *res)
|
|||
|
||||
enum vpe_status vpe11_set_num_segments(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx,
|
||||
struct scaler_data *scl_data, struct vpe_rect *src_rect, struct vpe_rect *dst_rect,
|
||||
uint32_t *max_seg_width)
|
||||
uint32_t *max_seg_width, uint32_t recout_width_alignment)
|
||||
{
|
||||
|
||||
uint16_t num_segs;
|
||||
struct dpp *dpp = vpe_priv->resource.dpp[0];
|
||||
const uint32_t max_lb_size = dpp->funcs->get_line_buffer_size();
|
||||
|
||||
(void)recout_width_alignment;
|
||||
*max_seg_width = min(*max_seg_width, max_lb_size / scl_data->taps.v_taps);
|
||||
|
||||
num_segs = vpe_get_num_segments(vpe_priv, src_rect, dst_rect, *max_seg_width);
|
||||
|
|
@ -256,3 +257,47 @@ enum vpe_status vpe11_set_num_segments(struct vpe_priv *vpe_priv, struct stream_
|
|||
|
||||
return VPE_STATUS_OK;
|
||||
}
|
||||
|
||||
bool vpe11_validate_cached_param(struct vpe_priv *vpe_priv, const struct vpe_build_param *param)
|
||||
{
|
||||
uint32_t i;
|
||||
struct output_ctx *output_ctx;
|
||||
|
||||
if (vpe_priv->num_input_streams != param->num_streams &&
|
||||
!(vpe_priv->init.debug.bg_color_fill_only == true && vpe_priv->num_streams == 1))
|
||||
return false;
|
||||
|
||||
if (vpe_priv->collaboration_mode != param->collaboration_mode)
|
||||
return false;
|
||||
|
||||
if (param->num_instances > 0 && vpe_priv->vpe_num_instance != param->num_instances)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < vpe_priv->num_input_streams; i++) {
|
||||
struct vpe_stream stream = param->streams[i];
|
||||
|
||||
vpe_clip_stream(
|
||||
&stream.scaling_info.src_rect, &stream.scaling_info.dst_rect, ¶m->target_rect);
|
||||
|
||||
if (memcmp(&vpe_priv->stream_ctx[i].stream, &stream, sizeof(struct vpe_stream)))
|
||||
return false;
|
||||
}
|
||||
|
||||
output_ctx = &vpe_priv->output_ctx;
|
||||
if (output_ctx->alpha_mode != param->alpha_mode)
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->mpc_bg_color, ¶m->bg_color, sizeof(struct vpe_color)))
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->opp_bg_color, ¶m->bg_color, sizeof(struct vpe_color)))
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->target_rect, ¶m->target_rect, sizeof(struct vpe_rect)))
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->surface, ¶m->dst_surface, sizeof(struct vpe_surface_info)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@ bool vpe_find_color_space_from_table(
|
|||
return false;
|
||||
}
|
||||
|
||||
bool vpe_is_subsampled_format(enum vpe_surface_pixel_format format)
|
||||
{
|
||||
return (format >= VPE_SURFACE_PIXEL_FORMAT_VIDEO_BEGIN &&
|
||||
format <= VPE_SURFACE_PIXEL_FORMAT_SUBSAMPLE_END);
|
||||
}
|
||||
|
||||
bool vpe_is_dual_plane_format(enum vpe_surface_pixel_format format)
|
||||
{
|
||||
switch (format) {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ extern "C" {
|
|||
bool vpe_find_color_space_from_table(
|
||||
const struct vpe_color_space *table, int table_size, const struct vpe_color_space *cs);
|
||||
|
||||
bool vpe_is_subsampled_format(enum vpe_surface_pixel_format format);
|
||||
bool vpe_is_dual_plane_format(enum vpe_surface_pixel_format format);
|
||||
|
||||
// RGB checkers
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ struct resource {
|
|||
|
||||
enum vpe_status (*set_num_segments)(struct vpe_priv *vpe_priv, struct stream_ctx *stream_ctx,
|
||||
struct scaler_data *scl_data, struct vpe_rect *src_rect, struct vpe_rect *dst_rect,
|
||||
uint32_t *max_seg_width);
|
||||
uint32_t *max_seg_width, uint32_t recout_width_alignment);
|
||||
|
||||
bool (*split_bg_gap)(struct vpe_rect *gaps, const struct vpe_rect *target_rect,
|
||||
uint32_t max_width, uint16_t max_gaps, uint16_t *num_gaps, uint16_t num_instances);
|
||||
|
|
@ -106,6 +106,7 @@ struct resource {
|
|||
const struct vpe_build_param *param, const struct vpe_stream *stream,
|
||||
struct transfer_func *blnd_tf);
|
||||
|
||||
bool (*validate_cached_param)(struct vpe_priv *vpe_priv, const struct vpe_build_param *param);
|
||||
// Indicates the nominal range hdr input content should be in during processing.
|
||||
int internal_hdr_normalization;
|
||||
|
||||
|
|
|
|||
|
|
@ -634,50 +634,6 @@ enum vpe_status vpe_build_noops(struct vpe *vpe, uint32_t num_dword, uint32_t **
|
|||
return status;
|
||||
}
|
||||
|
||||
static bool validate_cached_param(struct vpe_priv *vpe_priv, const struct vpe_build_param *param)
|
||||
{
|
||||
uint32_t i;
|
||||
struct output_ctx *output_ctx;
|
||||
|
||||
if (vpe_priv->num_input_streams != param->num_streams &&
|
||||
!(vpe_priv->init.debug.bg_color_fill_only == true && vpe_priv->num_streams == 1))
|
||||
return false;
|
||||
|
||||
if (vpe_priv->collaboration_mode != param->collaboration_mode)
|
||||
return false;
|
||||
|
||||
if (param->num_instances > 0 && vpe_priv->vpe_num_instance != param->num_instances)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < vpe_priv->num_input_streams; i++) {
|
||||
struct vpe_stream stream = param->streams[i];
|
||||
|
||||
vpe_clip_stream(
|
||||
&stream.scaling_info.src_rect, &stream.scaling_info.dst_rect, ¶m->target_rect);
|
||||
|
||||
if (memcmp(&vpe_priv->stream_ctx[i].stream, &stream, sizeof(struct vpe_stream)))
|
||||
return false;
|
||||
}
|
||||
|
||||
output_ctx = &vpe_priv->output_ctx;
|
||||
if (output_ctx->alpha_mode != param->alpha_mode)
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->mpc_bg_color, ¶m->bg_color, sizeof(struct vpe_color)))
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->opp_bg_color, ¶m->bg_color, sizeof(struct vpe_color)))
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->target_rect, ¶m->target_rect, sizeof(struct vpe_rect)))
|
||||
return false;
|
||||
|
||||
if (memcmp(&output_ctx->surface, ¶m->dst_surface, sizeof(struct vpe_surface_info)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
enum vpe_status vpe_build_commands(
|
||||
struct vpe *vpe, const struct vpe_build_param *param, struct vpe_build_bufs *bufs)
|
||||
{
|
||||
|
|
@ -704,7 +660,7 @@ enum vpe_status vpe_build_commands(
|
|||
}
|
||||
|
||||
if (status == VPE_STATUS_OK) {
|
||||
if (!validate_cached_param(vpe_priv, param)) {
|
||||
if (!vpe_priv->resource.validate_cached_param(vpe_priv, param)) {
|
||||
status = VPE_STATUS_PARAM_CHECK_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue