drm/radeon: fix-up some float to fixed conversion thinkos
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Nov 2013 23:16:23 +0000 (18:16 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 8 Nov 2013 17:33:38 +0000 (12:33 -0500)
Spotted by Brad Smith when porting to OpenBSD.

Noticed-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/rs690.c
drivers/gpu/drm/radeon/rv515.c

index 1447d794c22ad21648408a390e4b78bc84493af0..1c560629575a8906fb74e006285096f07eac7f19 100644 (file)
@@ -345,9 +345,11 @@ static void rs690_crtc_bandwidth_compute(struct radeon_device *rdev,
                if (max_bandwidth.full > rdev->pm.sideport_bandwidth.full &&
                        rdev->pm.sideport_bandwidth.full)
                        max_bandwidth = rdev->pm.sideport_bandwidth;
-               read_delay_latency.full = dfixed_const(370 * 800 * 1000);
-               read_delay_latency.full = dfixed_div(read_delay_latency,
-                       rdev->pm.igp_sideport_mclk);
+               read_delay_latency.full = dfixed_const(370 * 800);
+               a.full = dfixed_const(1000);
+               b.full = dfixed_div(rdev->pm.igp_sideport_mclk, a);
+               read_delay_latency.full = dfixed_div(read_delay_latency, b);
+               read_delay_latency.full = dfixed_mul(read_delay_latency, a);
        } else {
                if (max_bandwidth.full > rdev->pm.k8_bandwidth.full &&
                        rdev->pm.k8_bandwidth.full)
@@ -488,14 +490,10 @@ static void rs690_compute_mode_priority(struct radeon_device *rdev,
                }
                if (wm0->priority_mark.full > priority_mark02.full)
                        priority_mark02.full = wm0->priority_mark.full;
-               if (dfixed_trunc(priority_mark02) < 0)
-                       priority_mark02.full = 0;
                if (wm0->priority_mark_max.full > priority_mark02.full)
                        priority_mark02.full = wm0->priority_mark_max.full;
                if (wm1->priority_mark.full > priority_mark12.full)
                        priority_mark12.full = wm1->priority_mark.full;
-               if (dfixed_trunc(priority_mark12) < 0)
-                       priority_mark12.full = 0;
                if (wm1->priority_mark_max.full > priority_mark12.full)
                        priority_mark12.full = wm1->priority_mark_max.full;
                *d1mode_priority_a_cnt = dfixed_trunc(priority_mark02);
@@ -526,8 +524,6 @@ static void rs690_compute_mode_priority(struct radeon_device *rdev,
                }
                if (wm0->priority_mark.full > priority_mark02.full)
                        priority_mark02.full = wm0->priority_mark.full;
-               if (dfixed_trunc(priority_mark02) < 0)
-                       priority_mark02.full = 0;
                if (wm0->priority_mark_max.full > priority_mark02.full)
                        priority_mark02.full = wm0->priority_mark_max.full;
                *d1mode_priority_a_cnt = dfixed_trunc(priority_mark02);
@@ -555,8 +551,6 @@ static void rs690_compute_mode_priority(struct radeon_device *rdev,
                }
                if (wm1->priority_mark.full > priority_mark12.full)
                        priority_mark12.full = wm1->priority_mark.full;
-               if (dfixed_trunc(priority_mark12) < 0)
-                       priority_mark12.full = 0;
                if (wm1->priority_mark_max.full > priority_mark12.full)
                        priority_mark12.full = wm1->priority_mark_max.full;
                *d2mode_priority_a_cnt = dfixed_trunc(priority_mark12);
index 873eb4b193b4f86c35fa2cc02417adbdee54344d..5d1c316115efa31ab7b029de44db66e399322e71 100644 (file)
@@ -1155,14 +1155,10 @@ static void rv515_compute_mode_priority(struct radeon_device *rdev,
                }
                if (wm0->priority_mark.full > priority_mark02.full)
                        priority_mark02.full = wm0->priority_mark.full;
-               if (dfixed_trunc(priority_mark02) < 0)
-                       priority_mark02.full = 0;
                if (wm0->priority_mark_max.full > priority_mark02.full)
                        priority_mark02.full = wm0->priority_mark_max.full;
                if (wm1->priority_mark.full > priority_mark12.full)
                        priority_mark12.full = wm1->priority_mark.full;
-               if (dfixed_trunc(priority_mark12) < 0)
-                       priority_mark12.full = 0;
                if (wm1->priority_mark_max.full > priority_mark12.full)
                        priority_mark12.full = wm1->priority_mark_max.full;
                *d1mode_priority_a_cnt = dfixed_trunc(priority_mark02);
@@ -1193,8 +1189,6 @@ static void rv515_compute_mode_priority(struct radeon_device *rdev,
                }
                if (wm0->priority_mark.full > priority_mark02.full)
                        priority_mark02.full = wm0->priority_mark.full;
-               if (dfixed_trunc(priority_mark02) < 0)
-                       priority_mark02.full = 0;
                if (wm0->priority_mark_max.full > priority_mark02.full)
                        priority_mark02.full = wm0->priority_mark_max.full;
                *d1mode_priority_a_cnt = dfixed_trunc(priority_mark02);
@@ -1222,8 +1216,6 @@ static void rv515_compute_mode_priority(struct radeon_device *rdev,
                }
                if (wm1->priority_mark.full > priority_mark12.full)
                        priority_mark12.full = wm1->priority_mark.full;
-               if (dfixed_trunc(priority_mark12) < 0)
-                       priority_mark12.full = 0;
                if (wm1->priority_mark_max.full > priority_mark12.full)
                        priority_mark12.full = wm1->priority_mark_max.full;
                *d2mode_priority_a_cnt = dfixed_trunc(priority_mark12);