amd/vpelib: Enhance output format capabilities

- Generalize the p2b programming to support chroma viewport if any
- Turn vpe_get_element_size_in_bytes to a global helper function

Reviewed-by: Jesse Agate <Jesse.Agate@amd.com>
Acked-by: Chih-Wei Chien <Chih-Wei.Chien@amd.com>
Signed-off-by: Jiali <jiali.zhao@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31693>
This commit is contained in:
Jiali 2024-06-17 14:35:48 -04:00 committed by Marge Bot
parent 10acd37e93
commit 8fa10461c9
7 changed files with 13 additions and 6 deletions

View File

@ -90,7 +90,8 @@ void vpe10_cdc_program_global_sync(
struct cdc_be *cdc_be, uint32_t vupdate_offset, uint32_t vupdate_width, uint32_t vready_offset);
void vpe10_cdc_program_p2b_config(struct cdc_be *cdc_be, enum vpe_surface_pixel_format format,
enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport);
enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport,
const struct vpe_rect *viewport_c);
#ifdef __cplusplus
}

View File

@ -69,7 +69,8 @@ void vpe10_cdc_program_global_sync(
}
void vpe10_cdc_program_p2b_config(struct cdc_be *cdc_be, enum vpe_surface_pixel_format format,
enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport)
enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport,
const struct vpe_rect *viewport_c)
{
uint32_t bar_sel0 = (uint32_t)MUX_SEL_CB_B;
uint32_t bar_sel1 = (uint32_t)MUX_SEL_Y_G;

View File

@ -869,7 +869,7 @@ int32_t vpe10_program_backend(
vpe_priv->be_cb_ctx.share = true;
cdc_be->funcs->program_p2b_config(
cdc_be, surface_info->format, surface_info->swizzle, &output_ctx->target_rect);
cdc_be, surface_info->format, surface_info->swizzle, &output_ctx->target_rect, NULL);
cdc_be->funcs->program_global_sync(cdc_be, VPE10_CDC_VUPDATE_OFFSET_DEFAULT,
VPE10_CDC_VUPDATE_WIDTH_DEFAULT, VPE10_CDC_VREADY_OFFSET_DEFAULT);

View File

@ -150,6 +150,7 @@ static enum predefined_gamut_type color_space_to_predefined_gamut_types(
case COLOR_SPACE_2020_RGB_FULLRANGE:
case COLOR_SPACE_2020_RGB_LIMITEDRANGE:
case COLOR_SPACE_2020_YCBCR:
case COLOR_SPACE_2020_YCBCR_LIMITED:
return gamut_type_bt2020;
default:
VPE_ASSERT(0);

View File

@ -190,7 +190,7 @@ bool vpe_is_yuv(enum vpe_surface_pixel_format format)
vpe_is_yuv444(format));
}
static uint8_t vpe_get_element_size_in_bytes(enum vpe_surface_pixel_format format, int plane_idx)
uint8_t vpe_get_element_size_in_bytes(enum vpe_surface_pixel_format format, int plane_idx)
{
switch (format) {
// nv12/21

View File

@ -49,7 +49,8 @@ struct cdc_fe_funcs {
uint32_t vupdate_width, uint32_t vready_offset);
void (*program_p2b_config)(struct cdc_fe *cdc_fe, enum vpe_surface_pixel_format format,
enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport);
enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport,
const struct vpe_rect *viewport_c);
/** segment specific */
void (*program_viewport)(
@ -63,7 +64,8 @@ struct cdc_be_funcs {
uint32_t vupdate_width, uint32_t vready_offset);
void (*program_p2b_config)(struct cdc_be *cdc_be, enum vpe_surface_pixel_format format,
enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport);
enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport,
const struct vpe_rect *viewport_c);
};
struct cdc_fe {

View File

@ -88,6 +88,8 @@ enum vpe_status vpe_check_input_support(struct vpe *vpe, const struct vpe_stream
enum vpe_status vpe_check_tone_map_support(
struct vpe *vpe, const struct vpe_stream *stream, const struct vpe_build_param *param);
uint8_t vpe_get_element_size_in_bytes(enum vpe_surface_pixel_format format, int plane_idx);
#ifdef __cplusplus
}
#endif