amd/vpelib: Make BG gen stream idx adjustable

Update BKGR API

Change bg generation code so bg gen isn't hard-coded to stream 0, as
certain cases result in bg being generated at different stream.

Reviewed-by: Roy Chan <Roy.Chan@amd.com>
Reviewed-by: Evan Damphousse <Evan.Damphousse@amd.com>
Acked-by: ChuanYu Tseng <ChuanYu.Tseng@amd.com>
Signed-off-by: Leder, Brendan Steve <BrendanSteve.Leder@amd.co>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35012>
This commit is contained in:
Leder, Brendan Steve 2025-02-11 02:45:43 -05:00 committed by ChuanYu Tseng (Max)
parent 5b34895e81
commit c1a3d021f3
5 changed files with 15 additions and 2 deletions

View file

@ -51,6 +51,8 @@ bool vpe10_check_h_mirror_support(bool *input_mirror, bool *output_mirror);
enum vpe_status vpe10_check_bg_color_support(struct vpe_priv* vpe_priv, struct vpe_color* bg_color);
uint16_t vpe10_get_bg_stream_idx(struct vpe_priv *vpe_priv);
enum vpe_status vpe10_calculate_segments(
struct vpe_priv *vpe_priv, const struct vpe_build_param *params);

View file

@ -411,6 +411,7 @@ enum vpe_status vpe10_construct_resource(struct vpe_priv *vpe_priv, struct resou
res->set_num_segments = vpe10_set_num_segments;
res->split_bg_gap = vpe10_split_bg_gap;
res->calculate_dst_viewport_and_active = vpe10_calculate_dst_viewport_and_active;
res->get_bg_stream_idx = vpe10_get_bg_stream_idx;
res->find_bg_gaps = vpe_find_bg_gaps;
res->create_bg_segments = vpe_create_bg_segments;
res->populate_cmd_info = vpe10_populate_cmd_info;
@ -594,6 +595,11 @@ static uint16_t get_max_gap_num(
return max_gaps;
}
uint16_t vpe10_get_bg_stream_idx(struct vpe_priv *vpe_priv)
{
return 0;
}
enum vpe_status vpe10_calculate_segments(
struct vpe_priv *vpe_priv, const struct vpe_build_param *params)
{

View file

@ -187,6 +187,7 @@ enum vpe_status vpe11_construct_resource(struct vpe_priv *vpe_priv, struct resou
res->set_num_segments = vpe11_set_num_segments;
res->split_bg_gap = vpe10_split_bg_gap;
res->calculate_dst_viewport_and_active = vpe10_calculate_dst_viewport_and_active;
res->get_bg_stream_idx = vpe10_get_bg_stream_idx;
res->find_bg_gaps = vpe_find_bg_gaps;
res->create_bg_segments = vpe_create_bg_segments;
res->populate_cmd_info = vpe10_populate_cmd_info;

View file

@ -30,9 +30,10 @@ void vpe_create_bg_segments(
struct vpe_priv *vpe_priv, struct vpe_rect *gaps, uint16_t gaps_cnt, enum vpe_cmd_ops ops)
{
uint16_t gap_index;
uint16_t bg_index = vpe_priv->resource.get_bg_stream_idx(vpe_priv);
struct vpe_cmd_info cmd_info = {0};
struct scaler_data *scaler_data = &(cmd_info.inputs[0].scaler_data);
struct stream_ctx *stream_ctx = &(vpe_priv->stream_ctx[0]);
struct stream_ctx *stream_ctx = &(vpe_priv->stream_ctx[bg_index]);
int32_t vp_x = stream_ctx->stream.scaling_info.src_rect.x;
int32_t vp_y = stream_ctx->stream.scaling_info.src_rect.y;
uint16_t src_h_div = vpe_is_yuv420(stream_ctx->stream.surface_info.format) ? 2 : 1;
@ -153,12 +154,13 @@ uint16_t vpe_find_bg_gaps(struct vpe_priv *vpe_priv, const struct vpe_rect *targ
struct vpe_rect *gaps, uint16_t max_gaps)
{
uint16_t num_gaps = 0;
uint16_t bg_index = vpe_priv->resource.get_bg_stream_idx(vpe_priv);
uint16_t num_segs;
struct vpe_rect *dst_viewport_rect;
bool full_bg = false;
const uint32_t max_seg_width = vpe_priv->pub.caps->plane_caps.max_viewport_width;
const uint16_t num_multiple = vpe_priv->vpe_num_instance ? vpe_priv->vpe_num_instance : 1;
struct stream_ctx* ctx = &vpe_priv->stream_ctx[0];
struct stream_ctx *ctx = &vpe_priv->stream_ctx[bg_index];
num_segs = ctx->num_segments;
dst_viewport_rect = &(ctx->segment_ctx[0].scaler_data.dst_viewport);

View file

@ -84,6 +84,8 @@ struct resource {
void (*calculate_dst_viewport_and_active)(
struct segment_ctx *segment_ctx, uint32_t max_seg_width);
uint16_t (*get_bg_stream_idx)(struct vpe_priv *vpe_priv);
uint16_t (*find_bg_gaps)(struct vpe_priv *vpe_priv, const struct vpe_rect *target_rect,
struct vpe_rect *gaps, uint16_t max_gaps);