Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /nouveau-pm/monitor_downclocking.c [91cdba] .. [1d97c1] Maximize Restore

  Switch to side-by-side view

--- a/nouveau-pm/monitor_downclocking.c
+++ b/nouveau-pm/monitor_downclocking.c
@@ -43,7 +43,7 @@
 	static int fanspeed;
 	if (read_fanspeed != fanspeed) {
 		read_fanspeed = fanspeed;
-		fprintf(info);
+		fprintf(stderr, info);
 	}
 #endif
 }
@@ -82,37 +82,37 @@
 
 	ret = XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_GPU, 0,
 										 0, NV_CTRL_GPU_CORE_TEMPERATURE, &i);
-	printf("%sNV_CTRL_GPU_CORE_TEMPERATURE = %d\n", ret ? "" : "Failed ", i);
+	fprintf(stderr, "%sNV_CTRL_GPU_CORE_TEMPERATURE = %d\n", ret ? "" : "Failed ", i);
 
 	/* ------------------------------------------------------------------------------*/
 	ret = XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_GPU, 0,
 										 0, NV_CTRL_GPU_CORE_THRESHOLD, &i);
-	printf("%sNV_CTRL_GPU_CORE_THRESHOLD = %d\n", ret ? "" : "Failed ", i);
+	fprintf(stderr, "%sNV_CTRL_GPU_CORE_THRESHOLD = %d\n", ret ? "" : "Failed ", i);
 
 	ret = XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_GPU, 0,
 										 0, NV_CTRL_GPU_DEFAULT_CORE_THRESHOLD, &i);
-	printf("%sNV_CTRL_GPU_DEFAULT_CORE_THRESHOLD = %d\n", ret ? "" : "Failed ", i);
+	fprintf(stderr, "%sNV_CTRL_GPU_DEFAULT_CORE_THRESHOLD = %d\n", ret ? "" : "Failed ", i);
 
 	ret = XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_GPU, 0,
 										 0, NV_CTRL_GPU_MAX_CORE_THRESHOLD, &i);
-	printf("%sNV_CTRL_GPU_MAX_CORE_THRESHOLD = %d\n", ret ? "" : "Failed ", i);
+	fprintf(stderr, "%sNV_CTRL_GPU_MAX_CORE_THRESHOLD = %d\n", ret ? "" : "Failed ", i);
 
 	/* ------------------------------------------------------------------------------*/
 	ret = XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_GPU, 0,
 										 0, NV_CTRL_AMBIENT_TEMPERATURE, &i);
-	printf("%sNV_CTRL_AMBIENT_TEMPERATURE = %d\n", ret ? "" : "Failed ", i);
+	fprintf(stderr, "%sNV_CTRL_AMBIENT_TEMPERATURE = %d\n", ret ? "" : "Failed ", i);
 
 }
 
 void check_fans(Display *dpy, int *pData, int len)
 {
 	int ret;
-
+/* NV-CONTROL version 1.20 and above have the nessesary bits */
 	ret = XNVCTRLQueryTargetBinaryData (dpy, NV_CTRL_TARGET_TYPE_GPU, 0, 0,
 									NV_CTRL_BINARY_DATA_COOLERS_USED_BY_GPU,
 									(unsigned char **)(&pData), &len);
 
-	printf("%sNV_COOLER_COUNT = %d\n", ret ? "" : "Failed ", ret ? pData[0]:0 );
+	fprintf(stderr, "%sNV_COOLER_COUNT = %d\n", ret ? "" : "Failed ", ret ? pData[0]:0 );
 
 	read_fanspeed(dpy,pData,len);
 }
@@ -126,53 +126,54 @@
 	char *str;
 	int *pData = 0, len = 0;
 
+	fprintf(stderr, "Getting system time\n");
 	gettimeofday(&tv, NULL);
 	start_time = tv.tv_sec;
-
+	fprintf(stderr, "Done\n");
 	dpy = XOpenDisplay(NULL);
 
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_GPU, 0,
 										 0,NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE , &i);
 	if ( i != NV_CTRL_GPU_ADAPTIVE_CLOCK_STATE_ENABLED ) {
-		printf("ERROR - Driver not in Adaptive state\n");
+		fprintf(stderr, "ERROR - Driver not in Adaptive state\n");
 		return 2;
 	}
 
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_GPU, 0,
 										 0,NV_CTRL_GPU_POWER_MIZER_MODE , &i);
 	if ( i != NV_CTRL_GPU_POWER_MIZER_MODE_ADAPTIVE ) {
-		printf("ERROR - PowerMizer mode is not Adaptive.\n");
+		fprintf(stderr, "ERROR - PowerMizer mode is not Adaptive.\n");
 		return 3;
 	}
 
-	printf("Start of downclock monitoring\n");
+	fprintf(stderr, "Start of downclock monitoring\n");
 
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
 										 0, NV_CTRL_NUM_GPU_ERRORS_RECOVERED, &i);
-	printf("NV_CTRL_NUM_GPU_ERRORS_RECOVERED = %d\n",i);
+	fprintf(stderr, "NV_CTRL_NUM_GPU_ERRORS_RECOVERED = %d\n",i);
 
 	XNVCTRLQueryTargetStringAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
 										 0, NV_CTRL_STRING_PERFORMANCE_MODES, &str);
-	printf("NV_CTRL_STRING_PERFORMANCE_MODES = %s\n", str);
+	fprintf(stderr, "NV_CTRL_STRING_PERFORMANCE_MODES = %s\n", str);
 
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
 										0, NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL, &old_mode);
-	printf("NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL = %d\n", old_mode);
+	fprintf(stderr, "NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL = %d\n", old_mode);
 
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
 										 0, NV_CTRL_GPU_DEFAULT_2D_CLOCK_FREQS, &def_2d);
-	printf("NV_CTRL_GPU_DEFAULT_2D_CLOCK_FREQS = %x, Core = %d, Mem = %d\n",
+	fprintf(stderr, "NV_CTRL_GPU_DEFAULT_2D_CLOCK_FREQS = %x, Core = %d, Mem = %d\n",
 										 def_2d, ((def_2d & 0xFFFF0000) >> 16), (def_2d & 0xFFFF));
 
 /* XXX: compare with the default ones, but inside the program use these
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
 										 0, NV_CTRL_GPU_2D_CLOCK_FREQS, &def_2d);
-	printf("NV_CTRL_GPU_2D_CLOCK_FREQS = %x, Core = %d, Mem = %d\n",
+	fprintf(stderr, "NV_CTRL_GPU_2D_CLOCK_FREQS = %x, Core = %d, Mem = %d\n",
 										 def_2d, ((def_2d & 0xFFFF0000) >> 16), (def_2d & 0xFFFF));
 */
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
 										 0, NV_CTRL_GPU_CURRENT_CLOCK_FREQS, &old_hz);
-	printf("NV_CTRL_GPU_CURRENT_CLOCK_FREQS = %x, Core = %d, Mem = %d\n",
+	fprintf(stderr, "NV_CTRL_GPU_CURRENT_CLOCK_FREQS = %x, Core = %d, Mem = %d\n",
 										 old_hz, ((old_hz & 0xFFFF0000) >> 16), (old_hz & 0xFFFF));
 
 	check_fans(dpy, pData, len);
@@ -185,7 +186,7 @@
 		gettimeofday(&tv, NULL);
 		get_time = tv.tv_sec;
 		if ((start_time + NOUVEAU_TIME_WAIT) < get_time ) {
-			printf("ERROR - Timeout\n");
+			fprintf(stderr, "ERROR - Timeout\n");
 			XCloseDisplay(dpy);
 			return 4;
 		}
@@ -194,7 +195,7 @@
 									 0, NV_CTRL_GPU_CURRENT_CLOCK_FREQS, &new_hz);
 		if (new_hz != old_hz) {
 			old_hz = new_hz;
-			printf("Changed NV_CTRL_GPU_CURRENT_CLOCK_FREQS = %x, Core = %d, Mem = %d\n",
+			fprintf(stderr, "Changed NV_CTRL_GPU_CURRENT_CLOCK_FREQS = %x, Core = %d, Mem = %d\n",
 									 new_hz, ((new_hz & 0xFFFF0000) >> 16), (new_hz & 0xFFFF));
 			read_bus_rate(dpy);
 			read_fanspeed(dpy,pData,len);
@@ -205,20 +206,20 @@
 									 0, NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL, &new_mode);
 		if (new_mode != old_mode) {
 			old_mode = new_mode;
-			printf("Changed NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL = %d\n", new_mode);
+			fprintf(stderr, "Changed NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL = %d\n", new_mode);
 		}
 
 	} while ( new_hz != def_2d );
 
-	printf("Downclock monitoring finished\n");
+	fprintf(stderr, "Downclock monitoring finished\n");
 
 	check_temp(dpy);
 
 	XNVCTRLQueryTargetAttribute (dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, 0,
 										 0, NV_CTRL_NUM_GPU_ERRORS_RECOVERED, &i);
 
-	printf("Total NV_CTRL_NUM_GPU_ERRORS_RECOVERED = %d\n",i);
-	printf("All done !!!\n");
+	fprintf(stderr, "Total NV_CTRL_NUM_GPU_ERRORS_RECOVERED = %d\n",i);
+	fprintf(stderr, "All done !!!\n");
 
 	XCloseDisplay(dpy);