[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13792] trunk/blender/source/blender: made auto threads default (noob' s get faster renders in their dual core CPU's)

Campbell Barton ideasman42 at gmail.com
Thu Feb 21 09:43:13 CET 2008


Revision: 13792
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13792
Author:   campbellbarton
Date:     2008-02-21 09:43:13 +0100 (Thu, 21 Feb 2008)

Log Message:
-----------
made auto threads default (noob's get faster renders in their dual core CPU's)
changed env variable check order $TMP, $TMPDIR - aparently $TMP is more common.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/threads.c
    trunk/blender/source/blender/blenlib/intern/util.c
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/blender/python/api2_2x/sceneRender.c
    trunk/blender/source/blender/render/intern/source/pipeline.c
    trunk/blender/source/blender/src/buttons_scene.c

Modified: trunk/blender/source/blender/blenlib/intern/threads.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/threads.c	2008-02-21 01:35:20 UTC (rev 13791)
+++ trunk/blender/source/blender/blenlib/intern/threads.c	2008-02-21 08:43:13 UTC (rev 13792)
@@ -32,20 +32,20 @@
 #include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
-#include <unistd.h> /* for checking system threads */
 
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_threads.h"
 
+/* for checking system threads - BLI_system_thread_count */
 #ifdef WIN32
 #include "Windows.h"
-#endif
-
-#ifdef __APPLE__
+#elif defined(__APPLE__)
 #include <sys/types.h>
 #include <sys/sysctl.h>
+#else
+#include <unistd.h> 
 #endif
 
 /* ********** basic thread control API ************ 

Modified: trunk/blender/source/blender/blenlib/intern/util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/util.c	2008-02-21 01:35:20 UTC (rev 13791)
+++ trunk/blender/source/blender/blenlib/intern/util.c	2008-02-21 08:43:13 UTC (rev 13792)
@@ -1615,25 +1615,30 @@
 		strcpy(fullname, U.tempdir);
 	}
 	
+	
+#ifdef WIN32
 	if (fullname[0] == '\0') {
-#ifdef WIN32
 		char *tmp = getenv("TEMP"); /* Windows */
 		if (tmp && BLI_exists(tmp)) {
 			strcpy(fullname, tmp);
 		}
+	}
 #else
-		char *tmp = getenv("TMPDIR"); /* Other OS's - Try TMP and TMPDIR */
+	/* Other OS's - Try TMP and TMPDIR */
+	if (fullname[0] == '\0') {
+		char *tmp = getenv("TMP");
 		if (tmp && BLI_exists(tmp)) {
 			strcpy(fullname, tmp);
 		}
-		if (fullname[0] == '\0') {
-			tmp = getenv("TMP");
-			if (tmp && BLI_exists(tmp)) {
-				strcpy(fullname, tmp);
-			}
+	}
+	
+	if (fullname[0] == '\0') {
+		char *tmp = getenv("TMPDIR");
+		if (tmp && BLI_exists(tmp)) {
+			strcpy(fullname, tmp);
 		}
-#endif
 	}
+#endif	
 	
 	if (fullname[0] == '\0') {
 		strcpy(fullname, "/tmp/");

Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h	2008-02-21 01:35:20 UTC (rev 13791)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h	2008-02-21 08:43:13 UTC (rev 13792)
@@ -577,7 +577,7 @@
 		/* threads obsolete... is there for old files, now use for autodetect threads */
 #define R_THREADS		0x80000
 		/* Use the same flag for autothreads */
-#define R_AUTO_THREADS		0x80000 
+#define R_FIXED_THREADS		0x80000 
 
 #define R_SPEED			0x100000
 #define R_SSS			0x200000

Modified: trunk/blender/source/blender/python/api2_2x/sceneRender.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/sceneRender.c	2008-02-21 01:35:20 UTC (rev 13791)
+++ trunk/blender/source/blender/python/api2_2x/sceneRender.c	2008-02-21 08:43:13 UTC (rev 13792)
@@ -2089,7 +2089,7 @@
 
 #define MODE_MASK ( R_OSA | R_SHADOW | R_GAMMA | R_ENVMAP | R_EDGE | \
 	R_FIELDS | R_FIELDSTILL | R_RADIO | R_BORDER | R_PANORAMA | R_CROP | \
-	R_ODDFIELD | R_MBLUR | R_RAYTRACE | R_AUTO_THREADS )
+	R_ODDFIELD | R_MBLUR | R_RAYTRACE | R_FIXED_THREADS )
 
 static PyObject *RenderData_getMode( BPy_RenderData *self )
 {
@@ -2593,13 +2593,12 @@
 	 (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
 	 "Skip rendering existing image files",
 	 (void *)R_NO_OVERWRITE},
-	{"autoThreads",
+	{"fixedThreads",
 	 (getter)RenderData_getModeBit, (setter)RenderData_setModeBit,
-	 "Use system number of processors",
-	 (void *)R_AUTO_THREADS},
+	 "Use the number of threads defined by the blend file",
+	 (void *)R_FIXED_THREADS},
 /* R_GAUSS unused */
 /* R_FBUF unused */
-/* R_AUTO_THREADS unused */
 	{"threads",
 	 (getter)RenderData_getThreads, (setter)RenderData_setThreads,
 	 "Number of threads used to render",
@@ -3721,7 +3720,7 @@
 		PyConstant_Insert( d, "ODDFIELD", PyInt_FromLong( R_ODDFIELD ) );
 		PyConstant_Insert( d, "MBLUR", PyInt_FromLong( R_MBLUR ) );
 		PyConstant_Insert( d, "RAYTRACING", PyInt_FromLong( R_RAYTRACE ) );
-		PyConstant_Insert( d, "AUTOTHREADS", PyInt_FromLong( R_AUTO_THREADS ) );
+		PyConstant_Insert( d, "FIXEDTHREADS", PyInt_FromLong( R_FIXED_THREADS ) );
 	}
 	return M;
 }

Modified: trunk/blender/source/blender/render/intern/source/pipeline.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/pipeline.c	2008-02-21 01:35:20 UTC (rev 13791)
+++ trunk/blender/source/blender/render/intern/source/pipeline.c	2008-02-21 08:43:13 UTC (rev 13792)
@@ -1108,7 +1108,7 @@
 		/* we clip faces with a minimum of 2 pixel boundary outside of image border. see zbuf.c */
 		re->clipcrop= 1.0f + 2.0f/(float)(re->winx>re->winy?re->winy:re->winx);
 		
-		if (rd->mode & R_AUTO_THREADS || commandline_threads == 0) { /* Automatic threads */
+		if (rd->mode & R_FIXED_THREADS || commandline_threads == 0) { /* Automatic threads */
 			re->r.threads = BLI_system_thread_count();
 		} else if(commandline_threads >= 1 && commandline_threads<=BLENDER_MAX_THREADS) {
 			re->r.threads= commandline_threads;

Modified: trunk/blender/source/blender/src/buttons_scene.c
===================================================================
--- trunk/blender/source/blender/src/buttons_scene.c	2008-02-21 01:35:20 UTC (rev 13791)
+++ trunk/blender/source/blender/src/buttons_scene.c	2008-02-21 08:43:13 UTC (rev 13792)
@@ -2023,8 +2023,8 @@
 	uiBlockEndAlign(block);
 
 	uiBlockBeginAlign(block);
-	uiDefIconButBitI(block, TOG, R_AUTO_THREADS, B_REDR, ICON_AUTO,	10, 63, 20, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Automatically set the threads to the number of processors on the system");
-	if (G.scene->r.mode & R_AUTO_THREADS) {
+	uiDefIconButBitI(block, TOGN, R_FIXED_THREADS, B_REDR, ICON_AUTO,	10, 63, 20, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Automatically set the threads to the number of processors on the system");
+	if ((G.scene->r.mode & R_FIXED_THREADS)==0) {
 		char thread_str[16];
 		sprintf(thread_str, " Threads: %d", BLI_system_thread_count());
 		uiDefBut(block, LABEL, 0, thread_str, 30, 63,80,20, 0, 0, 0, 0, 0, "");





More information about the Bf-blender-cvs mailing list