Module: Mesa Branch: main Commit: 6b441ef6ab1e89da5560cd31711feb499a9cd8ff URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b441ef6ab1e89da5560cd31711feb499a9cd8ff
Author: Peyton Lee <peyto...@amd.com> Date: Thu Oct 12 17:58:15 2023 +0800 frontends, va: add new parameters of post processor Signed-off-by: Peyton Lee <peyto...@amd.com> Reviewed-by: Leo Liu <leo....@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25713> --- src/gallium/frontends/va/postproc.c | 61 ++++++++++++++++++++++++++++++++ src/gallium/include/pipe/p_video_enums.h | 29 +++++++++++++++ src/gallium/include/pipe/p_video_state.h | 8 +++++ 3 files changed, 98 insertions(+) diff --git a/src/gallium/frontends/va/postproc.c b/src/gallium/frontends/va/postproc.c index 3fdd2b99e7a..3575e1762f1 100644 --- a/src/gallium/frontends/va/postproc.c +++ b/src/gallium/frontends/va/postproc.c @@ -263,6 +263,67 @@ static VAStatus vlVaVidEngineBlit(vlVaDriver *drv, vlVaContext *context, } } + // Output background color + context->desc.vidproc.background_color = param->output_background_color; + + // Input surface color standard + context->desc.vidproc.in_colors_standard = PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_NONE; + if (param->surface_color_standard == VAProcColorStandardBT601) + context->desc.vidproc.in_colors_standard = PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_BT601; + else if (param->surface_color_standard == VAProcColorStandardBT709) + context->desc.vidproc.in_colors_standard = PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_BT709; + else if (param->surface_color_standard == VAProcColorStandardBT2020) + context->desc.vidproc.in_colors_standard = PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_BT2020; + + // Input surface color range + context->desc.vidproc.in_color_range = PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_NONE; + if (param->input_color_properties.color_range == VA_SOURCE_RANGE_REDUCED) + context->desc.vidproc.in_color_range = PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_REDUCED; + else if (param->input_color_properties.color_range == VA_SOURCE_RANGE_FULL) + context->desc.vidproc.in_color_range = PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_FULL; + + // Input surface chroma sample location + context->desc.vidproc.in_chroma_siting = PIPE_VIDEO_VPP_CHROMA_SITING_NONE; + if (param->input_color_properties.chroma_sample_location & VA_CHROMA_SITING_VERTICAL_TOP) + context->desc.vidproc.in_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_VERTICAL_TOP; + else if (param->input_color_properties.chroma_sample_location & VA_CHROMA_SITING_VERTICAL_CENTER) + context->desc.vidproc.in_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_VERTICAL_CENTER; + else if (param->input_color_properties.chroma_sample_location & VA_CHROMA_SITING_VERTICAL_BOTTOM) + context->desc.vidproc.in_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_VERTICAL_BOTTOM; + if (param->input_color_properties.chroma_sample_location & VA_CHROMA_SITING_HORIZONTAL_LEFT) + context->desc.vidproc.in_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_HORIZONTAL_LEFT; + else if (param->input_color_properties.chroma_sample_location & VA_CHROMA_SITING_HORIZONTAL_CENTER) + context->desc.vidproc.in_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_HORIZONTAL_CENTER; + + // Output surface color standard + context->desc.vidproc.out_colors_standard = PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_NONE; + if (param->output_color_standard == VAProcColorStandardBT601) + context->desc.vidproc.out_colors_standard = PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_BT601; + else if (param->output_color_standard == VAProcColorStandardBT709) + context->desc.vidproc.out_colors_standard = PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_BT709; + else if (param->output_color_standard == VAProcColorStandardBT2020) + context->desc.vidproc.out_colors_standard = PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_BT2020; + + // Output surface color range + context->desc.vidproc.out_color_range = PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_NONE; + if (param->output_color_properties.color_range == VA_SOURCE_RANGE_REDUCED) + context->desc.vidproc.out_color_range = PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_REDUCED; + else if (param->output_color_properties.color_range == VA_SOURCE_RANGE_FULL) + context->desc.vidproc.out_color_range = PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_FULL; + + // Output surface chroma sample location + context->desc.vidproc.out_chroma_siting = PIPE_VIDEO_VPP_CHROMA_SITING_NONE; + if (param->output_color_properties.chroma_sample_location & VA_CHROMA_SITING_VERTICAL_TOP) + context->desc.vidproc.out_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_VERTICAL_TOP; + else if (param->output_color_properties.chroma_sample_location & VA_CHROMA_SITING_VERTICAL_CENTER) + context->desc.vidproc.out_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_VERTICAL_CENTER; + else if (param->output_color_properties.chroma_sample_location & VA_CHROMA_SITING_VERTICAL_BOTTOM) + context->desc.vidproc.out_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_VERTICAL_BOTTOM; + if (param->output_color_properties.chroma_sample_location & VA_CHROMA_SITING_HORIZONTAL_LEFT) + context->desc.vidproc.out_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_HORIZONTAL_LEFT; + else if (param->output_color_properties.chroma_sample_location & VA_CHROMA_SITING_HORIZONTAL_CENTER) + context->desc.vidproc.out_chroma_siting |= PIPE_VIDEO_VPP_CHROMA_SITING_HORIZONTAL_CENTER; + if (context->needs_begin_frame) { context->decoder->begin_frame(context->decoder, dst, &context->desc.base); diff --git a/src/gallium/include/pipe/p_video_enums.h b/src/gallium/include/pipe/p_video_enums.h index bff95af6b76..f02e004cbca 100644 --- a/src/gallium/include/pipe/p_video_enums.h +++ b/src/gallium/include/pipe/p_video_enums.h @@ -230,6 +230,35 @@ enum pipe_video_vpp_blend_mode PIPE_VIDEO_VPP_BLEND_MODE_GLOBAL_ALPHA = 0x1, }; +/* To be used for VPP state*/ +enum pipe_video_vpp_color_standard_type +{ + PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_NONE = 0x0, + PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_BT601 = 0x1, + PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_BT709 = 0x2, + PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_BT2020 = 0xC, + PIPE_VIDEO_VPP_COLOR_STANDARD_TYPE_COUNT, +}; + +/* To be used for VPP state*/ +enum pipe_video_vpp_color_range +{ + PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_NONE = 0x00, + PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_REDUCED = 0x01, + PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_FULL = 0x02, +}; + +/* To be used for VPP state*/ +enum pipe_video_vpp_chroma_siting +{ + PIPE_VIDEO_VPP_CHROMA_SITING_NONE = 0x00, + PIPE_VIDEO_VPP_CHROMA_SITING_VERTICAL_TOP = 0x01, + PIPE_VIDEO_VPP_CHROMA_SITING_VERTICAL_CENTER = 0x02, + PIPE_VIDEO_VPP_CHROMA_SITING_VERTICAL_BOTTOM = 0x04, + PIPE_VIDEO_VPP_CHROMA_SITING_HORIZONTAL_LEFT = 0x10, + PIPE_VIDEO_VPP_CHROMA_SITING_HORIZONTAL_CENTER = 0x20, +}; + /* To be used with cap PIPE_VIDEO_CAP_ENC_SLICES_STRUCTURE*/ /** diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index f3e7d418207..bd53555e516 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -1539,6 +1539,14 @@ struct pipe_vpp_desc /* Fence to wait on for the src surface */ struct pipe_fence_handle *src_surface_fence; + + uint32_t background_color; + enum pipe_video_vpp_color_standard_type in_colors_standard; + enum pipe_video_vpp_color_range in_color_range; + enum pipe_video_vpp_chroma_siting in_chroma_siting; + enum pipe_video_vpp_color_standard_type out_colors_standard; + enum pipe_video_vpp_color_range out_color_range; + enum pipe_video_vpp_chroma_siting out_chroma_siting; };