Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 2014 19:33:08 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268954 - head/sys/dev/drm2/radeon
Message-ID:  <201407211933.s6LJX8l8099215@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Mon Jul 21 19:33:08 2014
New Revision: 268954
URL: http://svnweb.freebsd.org/changeset/base/268954

Log:
  Merge change from upstream linux kernel submitted by OpenBSD:
  
  drm/radeon: fix-up some float to fixed conversion thinkos
  
  Spotted by Brad Smith when porting to OpenBSD.
  Noticed-by: Brad Smith <brad@comstyle.com>
  Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  
  ref: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=1cd73ff7
  
  Remove #ifdef DUMBBELL_WIP in favor of upstream fix.
  
  Phabric:	https://phabric.freebsd.org/D423
  Reviewed by:	dumbbell, jkim
  MFC after:	2 weeks

Modified:
  head/sys/dev/drm2/radeon/rs690.c
  head/sys/dev/drm2/radeon/rv515.c

Modified: head/sys/dev/drm2/radeon/rs690.c
==============================================================================
--- head/sys/dev/drm2/radeon/rs690.c	Mon Jul 21 19:08:02 2014	(r268953)
+++ head/sys/dev/drm2/radeon/rs690.c	Mon Jul 21 19:33:08 2014	(r268954)
@@ -308,12 +308,11 @@ static void rs690_crtc_bandwidth_compute
 		if (rdev->pm.max_bandwidth.full > rdev->pm.sideport_bandwidth.full &&
 			rdev->pm.sideport_bandwidth.full)
 			rdev->pm.max_bandwidth = rdev->pm.sideport_bandwidth;
-#ifdef DUMBBELL_WIP
-		read_delay_latency.full = dfixed_const(370 * 800 * 1000);
-#endif /* DUMBBELL_WIP */
-		read_delay_latency.full = UINT_MAX;
-		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 (rdev->pm.max_bandwidth.full > rdev->pm.k8_bandwidth.full &&
 			rdev->pm.k8_bandwidth.full)
@@ -488,14 +487,10 @@ void rs690_bandwidth_update(struct radeo
 		}
 		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 +521,6 @@ void rs690_bandwidth_update(struct radeo
 		}
 		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 +548,6 @@ void rs690_bandwidth_update(struct radeo
 		}
 		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);

Modified: head/sys/dev/drm2/radeon/rv515.c
==============================================================================
--- head/sys/dev/drm2/radeon/rv515.c	Mon Jul 21 19:08:02 2014	(r268953)
+++ head/sys/dev/drm2/radeon/rv515.c	Mon Jul 21 19:33:08 2014	(r268954)
@@ -1087,14 +1087,10 @@ void rv515_bandwidth_avivo_update(struct
 		}
 		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);
@@ -1125,8 +1121,6 @@ void rv515_bandwidth_avivo_update(struct
 		}
 		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);
@@ -1154,8 +1148,6 @@ void rv515_bandwidth_avivo_update(struct
 		}
 		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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407211933.s6LJX8l8099215>