mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 06:20:19 +01:00
amd/vpelib: Generalize visual confirm handling
Generalize the visual confirm handling through helper function with minor coding style changes Reviewed-by: Evan Damphousse <evan.damphousse@amd.com> Reviewed-by: Roy Chan <Roy.Chan@amd.com> Acked-by: Chih-Wei Chien <Chih-Wei.Chien@amd.com> Signed-off-by: Brendan Leder <breleder@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31693>
This commit is contained in:
parent
257658cbca
commit
ab9bd6b932
2 changed files with 20 additions and 7 deletions
|
|
@ -29,6 +29,18 @@
|
|||
#include "background.h"
|
||||
#include "resource.h"
|
||||
|
||||
static bool should_generate_visual_confirm(enum vpe_stream_type stream_type)
|
||||
{
|
||||
switch (stream_type) {
|
||||
case VPE_STREAM_TYPE_INPUT:
|
||||
case VPE_STREAM_TYPE_BG_GEN:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t get_visual_confirm_segs_count(uint32_t max_seg_width, uint32_t target_rect_width)
|
||||
{
|
||||
// Unlike max_gaps logic in vpe10_calculate_segments, we are pure BG seg, no need to worry
|
||||
|
|
@ -50,8 +62,9 @@ static uint16_t vpe_get_visual_confirm_total_seg_count(
|
|||
if (vpe_priv->init.debug.visual_confirm_params.input_format) {
|
||||
for (stream_idx = 0; stream_idx < vpe_priv->num_streams; stream_idx++) {
|
||||
stream_ctx = &vpe_priv->stream_ctx[stream_idx];
|
||||
total_visual_confirm_segs += get_visual_confirm_segs_count(
|
||||
max_seg_width, stream_ctx->stream.scaling_info.dst_rect.width);
|
||||
if (should_generate_visual_confirm(stream_ctx->stream_type))
|
||||
total_visual_confirm_segs += get_visual_confirm_segs_count(
|
||||
max_seg_width, stream_ctx->stream.scaling_info.dst_rect.width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -222,7 +222,6 @@ void vpe_destroy(struct vpe **vpe)
|
|||
*vpe = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************************
|
||||
* populate_bg_stream
|
||||
* populate virtual stream for background output only
|
||||
|
|
@ -346,14 +345,14 @@ static enum vpe_status populate_input_streams(struct vpe_priv *vpe_priv, const s
|
|||
stream_ctx = &stream_ctx_base[i];
|
||||
stream_ctx->stream_type = VPE_STREAM_TYPE_INPUT;
|
||||
stream_ctx->stream_idx = (int32_t)i;
|
||||
|
||||
|
||||
stream_ctx->per_pixel_alpha =
|
||||
vpe_has_per_pixel_alpha(param->streams[i].surface_info.format);
|
||||
|
||||
if (vpe_priv->init.debug.bypass_per_pixel_alpha) {
|
||||
stream_ctx->per_pixel_alpha = false;
|
||||
} else if (param->streams[i].enable_luma_key) {
|
||||
stream_ctx->per_pixel_alpha = true;
|
||||
stream_ctx->per_pixel_alpha = true;
|
||||
}
|
||||
if (param->streams[i].horizontal_mirror && !input_h_mirror && output_h_mirror)
|
||||
stream_ctx->flip_horizonal_output = true;
|
||||
|
|
@ -385,18 +384,19 @@ static enum vpe_status populate_virtual_streams(struct vpe_priv* vpe_priv, const
|
|||
|
||||
vpe_priv->resource.check_h_mirror_support(&input_h_mirror, &output_h_mirror);
|
||||
|
||||
// Background generation stream
|
||||
if (param->num_streams == 0 || vpe_priv->init.debug.bg_color_fill_only) {
|
||||
if (num_virtual_streams != 1)
|
||||
result = VPE_STATUS_ERROR;
|
||||
else
|
||||
result = populate_bg_stream(vpe_priv, param, &vpe_priv->stream_ctx[virtual_stream_idx++]);
|
||||
result = populate_bg_stream(vpe_priv, param, &stream_ctx_base[virtual_stream_idx++]);
|
||||
}
|
||||
|
||||
if (result != VPE_STATUS_OK)
|
||||
return result;
|
||||
|
||||
for (virtual_stream_idx = 0; virtual_stream_idx < num_virtual_streams; virtual_stream_idx++) {
|
||||
stream_ctx = &stream_ctx_base[virtual_stream_idx];
|
||||
stream_ctx = &stream_ctx_base[virtual_stream_idx];
|
||||
stream_ctx->stream_idx = virtual_stream_idx + vpe_priv->num_input_streams;
|
||||
stream_ctx->per_pixel_alpha =
|
||||
vpe_has_per_pixel_alpha(stream_ctx->stream.surface_info.format);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue