Skip to contentSkip to conversation

drm/amd/display: Add comment for NaN checks in DCN calcs

PATCH In review Harry Wentland 3 participants 4 messages Oct 11, 2017 – Oct 12, 2017 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Add comment for NaN checks in DCN calcs

This is confusing as-is and really needs a comment.

---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c +4 -0
index b6abe0f3bb15..f95dc4ff9a23 100644
@@ -27,6 +27,7 @@
 
 float dcn_bw_mod(const float arg1, const float arg2)
 {
+	/* NaN checks */
 	if (arg1 != arg1)
 		return arg2;
 	if (arg2 != arg2)
@@ -36,6 +37,7 @@ float dcn_bw_mod(const float arg1, const float arg2)
 
 float dcn_bw_min2(const float arg1, const float arg2)
 {
+	/* NaN checks */
 	if (arg1 != arg1)
 		return arg2;
 	if (arg2 != arg2)
@@ -45,6 +47,7 @@ float dcn_bw_min2(const float arg1, const float arg2)
 
 unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
 {
+	/* NaN checks */
 	if (arg1 != arg1)
 		return arg2;
 	if (arg2 != arg2)
@@ -53,6 +56,7 @@ unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
 }
 float dcn_bw_max2(const float arg1, const float arg2)
 {
+	/* NaN checks */
 	if (arg1 != arg1)
 		return arg2;
 	if (arg2 != arg2)
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20171011145502.7551-1-harry.wentland-5C7GfCeVMHo@public.gmane.org

Acked-by
#2 lore raw
Quoted 3 lines · Harry Wentland

This is confusing as-is and really needs a comment.

Quoted 43 lines
---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c +4 -1
index b6abe0f3bb15..f95dc4ff9a23 100644
@@ -27,6 +27,7 @@
 
 float dcn_bw_mod(const float arg1, const float arg2)
 {
+       /* NaN checks */
        if (arg1 != arg1)
                return arg2;
        if (arg2 != arg2)
@@ -36,6 +37,7 @@ float dcn_bw_mod(const float arg1, const float arg2)
 
 float dcn_bw_min2(const float arg1, const float arg2)
 {
+       /* NaN checks */
        if (arg1 != arg1)
                return arg2;
        if (arg2 != arg2)
@@ -45,6 +47,7 @@ float dcn_bw_min2(const float arg1, const float arg2)
 
 unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
 {
+       /* NaN checks */
        if (arg1 != arg1)
                return arg2;
        if (arg2 != arg2)
@@ -53,6 +56,7 @@ unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
 }
 float dcn_bw_max2(const float arg1, const float arg2)
 {
+       /* NaN checks */
        if (arg1 != arg1)
                return arg2;
        if (arg2 != arg2)
--

2.14.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to a message not in the archive

Hi Harry, couldn't a simple isnan() macro be used? Also a question below.

Den 11 okt. 2017 17:01 skrev "Harry Wentland" <[email protected]>:

This is confusing as-is and really needs a comment.

---
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c | 4 ++++
 1 file changed, 4 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c index b6abe0f3bb15..f95dc4ff9a23 100644

drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c +3 -0
@@ -27,6 +27,7 @@
 
 float dcn_bw_mod(const float arg1, const float arg2)
 {
+       /* NaN checks */
        if (arg1 != arg1)
                return arg2;
        if (arg2 != arg2)
@@ -36,6 +37,7 @@ float dcn_bw_mod(const float arg1, const float arg2)
 
 float dcn_bw_min2(const float arg1, const float arg2)
 {
+       /* NaN checks */
        if (arg1 != arg1)
                return arg2;
        if (arg2 != arg2)
@@ -45,6 +47,7 @@ float dcn_bw_min2(const float arg1, const float arg2)
 
 unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
 {
+       /* NaN checks */
 
 

How can the int arguments be NaN?

BR
Nils

        if (arg1 != arg1)
                return arg2;
        if (arg2 != arg2)

@@ -53,6 +56,7 @@ unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
}
float dcn_bw_max2(const float arg1, const float arg2)
{
+ /* NaN checks */

        if (arg1 != arg1)
                return arg2;
        if (arg2 != arg2)

--
2.14.1

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CA+nq7DvTS3crAD+o5y3XZteovHG7EJXCUsAkudZpmwGUhOAoKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw
Quoted 2 lines · Nils Wallménius

Hi Harry, couldn't a simple isnan() macro be used? Also a question below.

Both very good points. I'll send a new patch.

Harry

Quoted 51 lines

Den 11 okt. 2017 17:01 skrev "Harry Wentland" <[email protected] <mailto:[email protected]>>:

    This is confusing as-is and really needs a comment.

    Signed-off-by: Harry Wentland <[email protected] <mailto:[email protected]>>
    ---
     drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c | 4 ++++
     1 file changed, 4 insertions(+)

    diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c
    index b6abe0f3bb15..f95dc4ff9a23 100644
    --- a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c
    +++ b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c
    @@ -27,6 +27,7 @@

     float dcn_bw_mod(const float arg1, const float arg2)
     {
    +       /* NaN checks */
            if (arg1 != arg1)
                    return arg2;
            if (arg2 != arg2)
    @@ -36,6 +37,7 @@ float dcn_bw_mod(const float arg1, const float arg2)

     float dcn_bw_min2(const float arg1, const float arg2)
     {
    +       /* NaN checks */
            if (arg1 != arg1)
                    return arg2;
            if (arg2 != arg2)
    @@ -45,6 +47,7 @@ float dcn_bw_min2(const float arg1, const float arg2)

     unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
     {
    +       /* NaN checks */

How can the int arguments be NaN?

BR
Nils

            if (arg1 != arg1)
                    return arg2;
            if (arg2 != arg2)
    @@ -53,6 +56,7 @@ unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
     }
     float dcn_bw_max2(const float arg1, const float arg2)
     {
    +       /* NaN checks */
            if (arg1 != arg1)
                    return arg2;
Quoted 10 lines
            if (arg2 != arg2)
    --
    2.14.1

    _______________________________________________
    amd-gfx mailing list
    [email protected] <mailto:[email protected]>
    https://lists.freedesktop.org/mailman/listinfo/amd-gfx <https://lists.freedesktop.org/mailman/listinfo/amd-gfx>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx