[PATCH] gpu: color: eliminate implicit conversion about enum type

Wei Yongjun weiyongjun1 at huawei.com
Mon Sep 19 02:31:10 UTC 2022


gpu: color: fix enum-conversion compile warning

标题我记得不跟你所过让你改的


On 2022/9/19 9:44, Zeng Heng wrote:
> Fix below compile warning when open enum-conversion
> option check:
> 
> drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c:
> In function ‘apply_degamma_for_user_regamma’:
> drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c:1695:29:
> error: implicit conversion from ‘enum <anonymous>’ to ‘enum dc_transfer_func_predefined’ [-Werror=enum-conversion]
>  1695 |  build_coefficients(&coeff, true);
>       |                             ^~~~
> 
> As 'build_coefficients' definition, it needs enum
> 'dc_transfer_func_predefined' type acts as the
> second argument, instead of bool-type one.
> 
> The numerical values of TRANSFER_FUNCTION_BT709 & true
> happen to be the same, so there is no change in
> behavior.
> 
> Signed-off-by: Zeng Heng <zengheng4 at huawei.com>
> ---
>  drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
> index 04f7656906ca..2f807d787c77 100644
> --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
> +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
> @@ -1692,7 +1692,7 @@ static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma
>  	struct pwl_float_data_ex *rgb = rgb_regamma;
>  	const struct hw_x_point *coord_x = coordinates_x;
>  
> -	build_coefficients(&coeff, true);
> +	build_coefficients(&coeff, TRANSFER_FUNCTION_BT709);
>  
>  	i = 0;
>  	while (i != hw_points_num + 1) {
> 


More information about the amd-gfx mailing list