xf86-video-intel: src/scripts/clock-graph.5c

Eric Anholt anholt at kemper.freedesktop.org
Fri Oct 19 15:04:33 PDT 2007


 src/scripts/clock-graph.5c |   36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

New commits:
commit 78e251db671e21bc859c9b505d391b70babee2dc
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Oct 19 15:04:10 2007 -0700

    In the clock graph, draw the VCO as erasures in the lines representing clocks.
    
    This shows one of the reasons for the gaps: with the other settings, the VCO
    is too low inside the gap.  However, it also points out another issue: we
    aren't using the high end of the VCO range due to some other limits being hit.

diff --git a/src/scripts/clock-graph.5c b/src/scripts/clock-graph.5c
index 98500e1..e39e559 100644
--- a/src/scripts/clock-graph.5c
+++ b/src/scripts/clock-graph.5c
@@ -4,12 +4,14 @@ library "examples/sort.5c";
 import Sort;
 
 int width = 1000, height = 200;
-
+int min_vco = 1400000000;
+int max_vco = 2800000000;
 int min = 0xffffffff;
 int max = 0;
 
 int max_clocks = 1000;
 int[4][max_clocks] clocks;
+int[4][max_clocks] vcos;
 int[4] clock_count = {0...};
 
 int[4] p2vals = {5,10,7,14};
@@ -49,8 +51,7 @@ void calc_p2(int p2i)
 						continue;
 					if (m2 > m1)
 						continue; /* won't happen */
-					if (vco < 1400000000 ||
-					    vco > 2800000000)
+					if (vco < min_vco || vco > max_vco)
 						continue;
 
 /*
@@ -61,6 +62,7 @@ void calc_p2(int p2i)
 */
 
 					clocks[p2i][clock_count[p2i]] = clock;
+					vcos[p2i][clock_count[p2i]] = vco;
 					clock_count[p2i]++;
 				}
 			}
@@ -88,6 +90,9 @@ real scale_x(real clock)
 for (p2i = 0; p2i < dim(p2vals); p2i++) {
 	int p2 = p2vals[p2i]; 
 	calc_p2(p2i);
+	real row_y1 = (p2i + 1) / (dim(p2vals) + 1) * height;
+	real row_y2 = p2i / (dim(p2vals) + 1) * height;
+
 	/*qsort(&p2vals[p2i], sort_p2);*/
 
 	switch (p2) {
@@ -104,6 +109,8 @@ for (p2i = 0; p2i < dim(p2vals); p2i++) {
 		set_source_rgb(cr, 0,0,0);
 		break;
 	}
+
+	/* draw the line for the clock */
 	for (int i = 0; i < clock_count[p2i]; i++) {
 		int clock = clocks[p2i][i];
 		real xpos;
@@ -112,8 +119,27 @@ for (p2i = 0; p2i < dim(p2vals); p2i++) {
 			continue;
 
 		xpos = scale_x(clock);
-		move_to(cr, xpos, p2i / (dim(p2vals) + 1) * height);
-		line_to(cr, xpos, (p2i + 1) / (dim(p2vals) + 1) * height);
+		move_to(cr, xpos, row_y1);
+		line_to(cr, xpos, row_y2);
+		stroke(cr);
+	}
+
+	set_source_rgb(cr, 1, 1, 1);
+	/* add a mark for the vco value of the clocks at each location */
+	for (int i = 0; i < clock_count[p2i]; i++) {
+		int clock = clocks[p2i][i];
+		int vco = vcos[p2i][i];
+		real mark_center;
+
+		if (clock < min_rate || clock > max_rate)
+			continue;
+
+		real xpos = scale_x(clock);
+		real vcofrac = (vco - min_vco) / (max_vco - min_vco);
+		real mark_height = (row_y1 + vcofrac * (row_y2 - row_y1));
+
+		move_to(cr, xpos, mark_height - 1);
+		line_to(cr, xpos, mark_height + 1);
 		stroke(cr);
 	}
 


More information about the xorg-commit mailing list