diff mbox series

[4/5] drm/amdgpu: fix build_coefficients() argument

Message ID 20201026210039.3884312-4-arnd@kernel.org
State New
Headers show
Series [1/5] drm/amdgpu: fix enum mismatches | expand

Commit Message

Arnd Bergmann Oct. 26, 2020, 9 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>


gcc -Wextra warns about a function taking an enum argument
being called with a bool:

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:1617:29: warning: implicit conversion from 'enum <anonymous>' to 'enum dc_transfer_func_predefined' [-Wenum-conversion]
 1617 |  build_coefficients(&coeff, true);

It appears that a patch was added using the old calling conventions
after the type was changed, and the value should actually be 0
(TRANSFER_FUNCTION_SRGB) here instead of 1 (true).

Fixes: 55a01d4023ce ("drm/amd/display: Add user_regamma to color module")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Comments

Alex Deucher Oct. 30, 2020, 3:53 a.m. UTC | #1
On Mon, Oct 26, 2020 at 5:01 PM Arnd Bergmann <arnd@kernel.org> wrote:
>

> From: Arnd Bergmann <arnd@arndb.de>

>

> gcc -Wextra warns about a function taking an enum argument

> being called with a bool:

>

> 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:1617:29: warning: implicit conversion from 'enum <anonymous>' to 'enum dc_transfer_func_predefined' [-Wenum-conversion]

>  1617 |  build_coefficients(&coeff, true);

>

> It appears that a patch was added using the old calling conventions

> after the type was changed, and the value should actually be 0

> (TRANSFER_FUNCTION_SRGB) here instead of 1 (true).


This looks correct to me.  Harry, Leo?

Alex


>

> Fixes: 55a01d4023ce ("drm/amd/display: Add user_regamma to color module")

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> ---

>  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 b8695660b480..09bc2c249e1a 100644

> --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c

> +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c

> @@ -1614,7 +1614,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_SRGB);

>

>         i = 0;

>         while (i != hw_points_num + 1) {

> --

> 2.27.0

>

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Harry Wentland Oct. 30, 2020, 5:04 p.m. UTC | #2
On 2020-10-29 11:53 p.m., Alex Deucher wrote:
> On Mon, Oct 26, 2020 at 5:01 PM Arnd Bergmann <arnd@kernel.org> wrote:

>>

>> From: Arnd Bergmann <arnd@arndb.de>

>>

>> gcc -Wextra warns about a function taking an enum argument

>> being called with a bool:

>>

>> 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:1617:29: warning: implicit conversion from 'enum <anonymous>' to 'enum dc_transfer_func_predefined' [-Wenum-conversion]

>>   1617 |  build_coefficients(&coeff, true);

>>

>> It appears that a patch was added using the old calling conventions

>> after the type was changed, and the value should actually be 0

>> (TRANSFER_FUNCTION_SRGB) here instead of 1 (true).

> 

> This looks correct to me.  Harry, Leo?

> 


Confirmed with Kruno, this is correct.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>


Harry

> Alex

> 

> 

>>

>> Fixes: 55a01d4023ce ("drm/amd/display: Add user_regamma to color module")

>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

>> ---

>>   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 b8695660b480..09bc2c249e1a 100644

>> --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c

>> +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c

>> @@ -1614,7 +1614,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_SRGB);

>>

>>          i = 0;

>>          while (i != hw_points_num + 1) {

>> --

>> 2.27.0

>>

>> _______________________________________________

>> amd-gfx mailing list

>> amd-gfx@lists.freedesktop.org

>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Charry.wentland%40amd.com%7C3b50cfb318a04e2708e308d87c875c07%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637396268091128887%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=QGijLrlFTXI3xx2sGx1iNczHBezfWdu%2FP2xkfoq%2FMB0%3D&amp;reserved=0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher Oct. 30, 2020, 5:45 p.m. UTC | #3
Applied.  Thanks!

Alex

On Fri, Oct 30, 2020 at 1:04 PM Harry Wentland <harry.wentland@amd.com> wrote:
>

>

>

> On 2020-10-29 11:53 p.m., Alex Deucher wrote:

> > On Mon, Oct 26, 2020 at 5:01 PM Arnd Bergmann <arnd@kernel.org> wrote:

> >>

> >> From: Arnd Bergmann <arnd@arndb.de>

> >>

> >> gcc -Wextra warns about a function taking an enum argument

> >> being called with a bool:

> >>

> >> 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:1617:29: warning: implicit conversion from 'enum <anonymous>' to 'enum dc_transfer_func_predefined' [-Wenum-conversion]

> >>   1617 |  build_coefficients(&coeff, true);

> >>

> >> It appears that a patch was added using the old calling conventions

> >> after the type was changed, and the value should actually be 0

> >> (TRANSFER_FUNCTION_SRGB) here instead of 1 (true).

> >

> > This looks correct to me.  Harry, Leo?

> >

>

> Confirmed with Kruno, this is correct.

>

> Reviewed-by: Harry Wentland <harry.wentland@amd.com>

>

> Harry

>

> > Alex

> >

> >

> >>

> >> Fixes: 55a01d4023ce ("drm/amd/display: Add user_regamma to color module")

> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> >> ---

> >>   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 b8695660b480..09bc2c249e1a 100644

> >> --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c

> >> +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c

> >> @@ -1614,7 +1614,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_SRGB);

> >>

> >>          i = 0;

> >>          while (i != hw_points_num + 1) {

> >> --

> >> 2.27.0

> >>

> >> _______________________________________________

> >> amd-gfx mailing list

> >> amd-gfx@lists.freedesktop.org

> >> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Charry.wentland%40amd.com%7C3b50cfb318a04e2708e308d87c875c07%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637396268091128887%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=QGijLrlFTXI3xx2sGx1iNczHBezfWdu%2FP2xkfoq%2FMB0%3D&amp;reserved=0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

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 b8695660b480..09bc2c249e1a 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -1614,7 +1614,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_SRGB);
 
 	i = 0;
 	while (i != hw_points_num + 1) {