mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 23:30:13 +01:00
amd/vpelib: Resolve mismatch with shader
Shader in SDR mode with NV12 input bypasses both primary and gamma conversions. Since in this case for RGB output p601 primary can be set for the output primary, vpe should be able to set that primary for output as well. Reviewed-by: Roy Chan <Roy.Chan@amd.com> Acked-by: Jack Chih <chiachih@amd.com> Signed-off-by: Navid Assadian <navid.assadian@amd.com> --- Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28972>
This commit is contained in:
parent
383c3a417f
commit
39b08da80a
6 changed files with 31 additions and 16 deletions
|
|
@ -251,7 +251,8 @@ bool vpe10_cm_helper_translate_curve_to_hw_format(
|
|||
seg_distr[i] = 1;
|
||||
region_start = -MAX_LOW_POINT;
|
||||
region_end = 1;
|
||||
} else if (output_tf->tf == TRANSFER_FUNC_LINEAR_0_125) {
|
||||
} else if (output_tf->tf == TRANSFER_FUNC_LINEAR_0_125 ||
|
||||
output_tf->tf == TRANSFER_FUNC_LINEAR_0_1) {
|
||||
|
||||
int num_regions_linear = MAX_LOW_POINT + 3;
|
||||
|
||||
|
|
|
|||
|
|
@ -333,6 +333,7 @@ void vpe10_dpp_cnv_program_pre_dgam(struct dpp *dpp, enum color_transfer_func tr
|
|||
|
||||
switch (tr) {
|
||||
case TRANSFER_FUNC_LINEAR_0_125:
|
||||
case TRANSFER_FUNC_LINEAR_0_1:
|
||||
pre_degam_en = 0; // bypass
|
||||
break;
|
||||
case TRANSFER_FUNC_SRGB:
|
||||
|
|
|
|||
|
|
@ -959,12 +959,12 @@ void vpe10_create_stream_ops_config(struct vpe_priv *vpe_priv, uint32_t pipe_idx
|
|||
if (ops == VPE_CMD_OPS_BG_VSCF_INPUT) {
|
||||
blndcfg.bg_color = vpe_get_visual_confirm_color(stream_ctx->stream.surface_info.format,
|
||||
stream_ctx->stream.surface_info.cs, vpe_priv->output_ctx.cs,
|
||||
vpe_priv->output_ctx.output_tf,
|
||||
vpe_priv->output_ctx.output_tf, vpe_priv->output_ctx.surface.format,
|
||||
(stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut));
|
||||
} else if (ops == VPE_CMD_OPS_BG_VSCF_OUTPUT) {
|
||||
blndcfg.bg_color = vpe_get_visual_confirm_color(vpe_priv->output_ctx.surface.format,
|
||||
vpe_priv->output_ctx.surface.cs, vpe_priv->output_ctx.cs,
|
||||
vpe_priv->output_ctx.output_tf,
|
||||
vpe_priv->output_ctx.output_tf, vpe_priv->output_ctx.surface.format,
|
||||
false); // 3DLUT should only affect input visual confirm
|
||||
} else {
|
||||
blndcfg.bg_color = vpe_priv->output_ctx.bg_color;
|
||||
|
|
|
|||
|
|
@ -451,6 +451,9 @@ static enum vpe_status vpe_update_blnd_gamma(
|
|||
tf = output_ctx->tf;
|
||||
}
|
||||
|
||||
if (vpe_is_fp16(param->dst_surface.format)) {
|
||||
y_scale = vpe_fixpt_mul_int(y_scale, CCCS_NORM);
|
||||
}
|
||||
color_update_regamma_tf(vpe_priv,
|
||||
tf,
|
||||
x_scale,
|
||||
|
|
@ -511,19 +514,19 @@ static enum vpe_status vpe_update_output_gamma(
|
|||
struct output_ctx *output_ctx = &vpe_priv->output_ctx;
|
||||
bool is_studio = (param->dst_surface.cs.range == VPE_COLOR_RANGE_STUDIO);
|
||||
enum vpe_status status = VPE_STATUS_OK;
|
||||
struct fixed31_32 y_scale = vpe_fixpt_one;
|
||||
|
||||
if (vpe_is_fp16(param->dst_surface.format)) {
|
||||
y_scale = vpe_fixpt_mul_int(y_scale, CCCS_NORM);
|
||||
}
|
||||
|
||||
if (vpe_is_HDR(output_ctx->tf) && !is_studio)
|
||||
can_bypass = false; //Blending is done in linear light so ogam needs to handle the regam
|
||||
else
|
||||
can_bypass = true;
|
||||
|
||||
color_update_regamma_tf(vpe_priv,
|
||||
output_ctx->tf,
|
||||
vpe_fixpt_one,
|
||||
vpe_fixpt_one,
|
||||
vpe_fixpt_zero,
|
||||
can_bypass,
|
||||
output_tf);
|
||||
color_update_regamma_tf(
|
||||
vpe_priv, output_ctx->tf, vpe_fixpt_one, y_scale, vpe_fixpt_zero, can_bypass, output_tf);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
@ -673,6 +676,7 @@ enum vpe_status vpe_color_update_color_space_and_tf(
|
|||
struct fixed31_32 new_matrix_scaling_factor;
|
||||
struct output_ctx *output_ctx = &vpe_priv->output_ctx;
|
||||
enum vpe_status status = VPE_STATUS_OK;
|
||||
struct fixed31_32 y_scale = vpe_fixpt_one;
|
||||
|
||||
status = vpe_allocate_cm_memory(vpe_priv, param);
|
||||
if (status == VPE_STATUS_OK) {
|
||||
|
|
@ -710,9 +714,13 @@ enum vpe_status vpe_color_update_color_space_and_tf(
|
|||
}
|
||||
|
||||
if (stream_ctx->dirty_bits.transfer_function) {
|
||||
if (vpe_is_fp16(stream_ctx->stream.surface_info.format)) {
|
||||
y_scale = vpe_fixpt_div_int(y_scale, CCCS_NORM);
|
||||
}
|
||||
|
||||
color_update_degamma_tf(vpe_priv, stream_ctx->tf,
|
||||
vpe_priv->stream_ctx->tf_scaling_factor,
|
||||
vpe_fixpt_one,
|
||||
y_scale,
|
||||
vpe_fixpt_zero,
|
||||
stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut, // By Pass degamma if 3DLUT is enabled
|
||||
stream_ctx->input_tf);
|
||||
|
|
@ -887,7 +895,7 @@ void vpe_color_get_color_space_and_tf(
|
|||
*tf = TRANSFER_FUNC_NORMALIZED_PQ;
|
||||
break;
|
||||
case VPE_TF_G10:
|
||||
*tf = TRANSFER_FUNC_LINEAR_0_125;
|
||||
*tf = TRANSFER_FUNC_LINEAR_0_1;
|
||||
break;
|
||||
case VPE_TF_SRGB:
|
||||
*tf = TRANSFER_FUNC_SRGB;
|
||||
|
|
@ -932,6 +940,10 @@ void vpe_color_get_color_space_and_tf(
|
|||
}
|
||||
} else {
|
||||
switch (vcs->primaries) {
|
||||
case VPE_PRIMARIES_BT601:
|
||||
*cs = colorRange == VPE_COLOR_RANGE_FULL ? COLOR_SPACE_YCBCR601
|
||||
: COLOR_SPACE_YCBCR601_LIMITED;
|
||||
break;
|
||||
case VPE_PRIMARIES_BT709:
|
||||
if (vcs->tf == VPE_TF_G10) {
|
||||
*cs = COLOR_SPACE_MSREF_SCRGB;
|
||||
|
|
@ -991,7 +1003,8 @@ void vpe_convert_full_range_color_enum(enum color_space *cs)
|
|||
bool vpe_is_HDR(enum color_transfer_func tf)
|
||||
{
|
||||
|
||||
return (tf == TRANSFER_FUNC_PQ2084 || tf == TRANSFER_FUNC_LINEAR_0_125 || tf == TRANSFER_FUNC_HLG);
|
||||
return (tf == TRANSFER_FUNC_PQ2084 || tf == TRANSFER_FUNC_LINEAR_0_125 ||
|
||||
tf == TRANSFER_FUNC_HLG || tf == TRANSFER_FUNC_LINEAR_0_1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ extern "C" {
|
|||
|
||||
struct vpe_color vpe_get_visual_confirm_color(enum vpe_surface_pixel_format format,
|
||||
struct vpe_color_space cs, enum color_space output_cs, struct transfer_func *output_tf,
|
||||
bool enable_3dLut);
|
||||
enum vpe_surface_pixel_format output_format, bool enable_3dLut);
|
||||
|
||||
enum vpe_status vpe_create_visual_confirm_segs(
|
||||
struct vpe_priv *vpe_priv, const struct vpe_build_param *params, uint32_t max_seg_width);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ static uint16_t vpe_get_visual_confirm_total_seg_count(
|
|||
|
||||
struct vpe_color vpe_get_visual_confirm_color(enum vpe_surface_pixel_format format,
|
||||
struct vpe_color_space cs, enum color_space output_cs, struct transfer_func *output_tf,
|
||||
bool enable_3dlut)
|
||||
enum vpe_surface_pixel_format output_format, bool enable_3dlut)
|
||||
{
|
||||
struct vpe_color visual_confirm_color;
|
||||
visual_confirm_color.is_ycbcr = false;
|
||||
|
|
@ -148,7 +148,7 @@ struct vpe_color vpe_get_visual_confirm_color(enum vpe_surface_pixel_format form
|
|||
vpe_bg_color_convert(output_cs, output_tf, &visual_confirm_color, enable_3dlut);
|
||||
|
||||
// Experimental: To make FP16 Linear color looks more visually ok
|
||||
if (output_tf->tf == TRANSFER_FUNC_LINEAR_0_125) {
|
||||
if (vpe_is_fp16(output_format)) {
|
||||
visual_confirm_color.rgba.r /= 125;
|
||||
visual_confirm_color.rgba.g /= 125;
|
||||
visual_confirm_color.rgba.b /= 125;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue