changeset 1294:3fa46ff7824e draft

merge
author Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
date Fri, 02 Dec 2011 15:04:34 +0900
parents 82dc8a041cfe (current diff) 1486f2d17e4a (diff)
children 5a67df5570e8
files Renderer/Engine/SceneGraphRoot.cc
diffstat 20 files changed, 356 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc	Fri Dec 02 15:03:54 2011 +0900
+++ b/Renderer/Engine/SceneGraphRoot.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -1,4 +1,4 @@
-#include <SDL.h>
+
 #include <SDL_image.h>
 #include <libxml/parser.h>
 #include "SceneGraphRoot.h"
@@ -261,7 +261,7 @@
     xmlFreeDoc(doc);
 }
 
-static const char*
+/*static const char*
 get_property(const char *name, xmlNodePtr cur){
    xmlAttr *p=cur->properties; 
    if (p==0) return "";
@@ -275,20 +275,32 @@
        }
    }
    return "";
-}
+}*/
 
 static void 
 xml_walk( SceneGraphRoot* self, xmlNodePtr cur)
 {
-	printf("name = %s\n", cur->name);
-	if(xmlStrcmp(cur->name,(xmlChar*)"float_array") != 0){
-	    const char *id = get_property("id", cur);
-	    int count = atoi(get_property("count", cur));
-	    printf("id:%s count:%d\n", id, count);
+	 /*get float array.*/
+	printf("name = %s, child:%s\n", cur->name, cur->children);
+	if (!xmlStrcmp(cur->name, (xmlChar*)"float_array")) {
+
+	    char *cont =(char*)xmlNodeGetContent(cur);
+	    //const char *id = get_property("id", cur);
+
+	    char *id = (char*)xmlGetProp(cur, (xmlChar*)"id");
+	    //int count = atoi(get_property("count", cur));
+
+	    int count = atoi((char*)xmlGetProp(cur, (xmlChar*)"count"));
+	    
+	    printf("id:%s count:%d cont:%s\n", id, count, cont);
+
+	    if (cur->children == "(null)") {
+	        return;
+	    }
 	
 	}
 	for (cur=cur->children; cur; cur=cur->next){
-		xml_walk(self, cur);
+            xml_walk(self, cur);
 	}
 }	
 
@@ -297,8 +309,9 @@
 {
 	/*make parse dom*/
 	xmlDocPtr doc;
-	xmlNodePtr cur,cur_images,cur_effects,cur_geometries,cur_visual_scenes;
-	SceneGraphPtr tmp;
+	xmlNodePtr cur;
+	//,cur_images,cur_effects,cur_geometries,cur_visual_scenes;
+	//SceneGraphPtr tmp;
 
 	doc = xmlParseFile(xmlColladafile);
 	cur = xmlDocGetRootElement(doc);
--- a/TaskManager/Fifo/MainScheduler.cc	Fri Dec 02 15:03:54 2011 +0900
+++ b/TaskManager/Fifo/MainScheduler.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -4,15 +4,18 @@
 #include "TaskManagerImpl.h"
 #include "FifoDmaManager.h"
 #include "ReferencedDmaManager.h"
+#include "PreRefDmaManager.h"
 #include "error.h"
 
 void
 MainScheduler::init_impl(int useRefDma)
 {
-	if (useRefDma == 0) {
+	if (useRefDma & 0x10) {
+		fifoDmaManager = new PreRefDmaManager();
+	} else if (useRefDma & 0x01) {
+		fifoDmaManager = new ReferencedDmaManager();
+	} else {
 		fifoDmaManager = new FifoDmaManager();
-	} else {
-		fifoDmaManager = new ReferencedDmaManager();
 	}
     connector = fifoDmaManager;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/Fifo/PreRefDmaManager.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,13 @@
+#include "PreRefDmaManager.h"
+#include "Scheduler.h"
+#include "TaskManagerImpl.h"
+
+void *
+PreRefDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
+{
+#ifdef __CERIUM_FIFO__
+	asm("prefetcht0 %0"::"m"(addr):"memory");
+#endif // __CERIUM_FIFO__
+	return (void*)addr;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TaskManager/Fifo/PreRefDmaManager.h	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,13 @@
+#ifndef INCLUDED_PRE_REFERENCED_DMA_MANAGER
+#define INCLUDED_PRE_REFERENCED_DMA_MANAGER
+
+#include "ReferencedDmaManager.h"
+
+class PreRefDmaManager : public ReferencedDmaManager {
+
+public:
+	/* functions */
+    virtual void *dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask);
+} ;
+
+#endif/* PRE_REFERENCED_DMA_MANAGER */
--- a/TaskManager/Fifo/ReferencedDmaManager.cc	Fri Dec 02 15:03:54 2011 +0900
+++ b/TaskManager/Fifo/ReferencedDmaManager.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -5,10 +5,6 @@
 void *
 ReferencedDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
 {
-#ifdef __CERIUM_FIFO__
-	asm("prefetcht0 %0"::"m"(addr):"memory");
-#endif // __CERIUM_FIFO__
-
 	return (void*)addr;
 }
 
--- a/TaskManager/kernel/main.cc	Fri Dec 02 15:03:54 2011 +0900
+++ b/TaskManager/kernel/main.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -48,7 +48,9 @@
         } else if (strcmp(argv[i], "-poll") == 0) {
 			poll_pattern = 1;
 		} else if (strcmp(argv[i], "-ref") == 0) {
-			useRefDma = 1;
+			useRefDma |= 0x01;
+		} else if (strcmp(argv[i], "-pre") == 0) {
+			useRefDma |= 0x10;
 		}
 	}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Func.h	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,4 @@
+enum {
+#include "SysTasks.h"
+	NullTask,
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,24 @@
+default: macosx
+
+macosx: FORCE
+	@echo "Make for Mac OS X"
+	@$(MAKE) -f Makefile.macosx
+
+fifo64: FORCE
+	@echo "Make for Mac OS X 64bit mode"
+	@$(MAKE) -f Makefile.macosx ABIBIT=64
+
+linux: FORCE
+	@echo "Make for Linux"
+	@$(MAKE) -f Makefile.linux
+
+cell: FORCE
+	@echo "Make for PS3 (Cell)"
+	@$(MAKE) -f Makefile.cell
+
+FORCE:
+
+clean:
+	@$(MAKE) -f Makefile.macosx clean
+	@$(MAKE) -f Makefile.linux clean
+	@$(MAKE) -f Makefile.cell clean
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile.cell	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,45 @@
+include ./Makefile.def
+
+ABIBIT=32
+CFLAGS += -m$(ABIBIT)  -D__CERIUM_CELL__
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+TASK_DIR  = ppe
+TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
+TASK_SRCS_EXCLUDE = 
+TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
+TASK_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += -lCellManager -lspe2 -lpthread -Wl,--gc-sections 
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET) speobject
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) $(CFLAGS) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+speobject:
+	cd spe; $(MAKE) ABIBIT=$(ABIBIT)
+
+run:
+	./$(TARGET) -cpu 6 
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo ppu-gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	cd spe; $(MAKE) clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile.def	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,15 @@
+TARGET = null
+
+# include/library path
+# ex  macosx
+#CERIUM = /Users/gongo/Source/Cerium
+
+# ex  linux/ps3
+CERIUM = ../../../Cerium
+
+CC      = g++
+#CFLAGS  = -O9 -Wall
+CFLAGS  = -g -O0 -Wall
+
+INCLUDE = -I${CERIUM}/include/TaskManager -I. -I..
+LIBS = -L${CERIUM}/TaskManager
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile.linux	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,36 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+TASK_DIR  = ppe
+TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
+TASK_SRCS_EXCLUDE = 
+TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
+TASK_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += -lFifoManager
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	rm -f spe/*~ spe/\#*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/Makefile.macosx	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,36 @@
+include ./Makefile.def
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS_EXCLUDE =  # 除外するファイルを書く
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+TASK_DIR  = ppe
+TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
+TASK_SRCS_EXCLUDE = 
+TASK_SRCS = $(filter-out $(TASK_DIR)/$(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
+TASK_OBJS = $(TASK_SRCS:.cc=.o)
+
+LIBS += -lFifoManager `sdl-config --libs`
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS) $(TASK_OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+link:
+	$(CC) -o $(TARGET) $(OBJS) $(TASK_OBJS) $(LIBS)
+
+debug: $(TARGET)
+	sudo gdb ./$(TARGET) 
+
+clean:
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f *~ \#*
+	rm -f ppe/*~ ppe/\#*
+	rm -f spe/*~ spe/\#*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/main.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "TaskManager.h"
+#include "Func.h"
+
+extern void task_init(void);
+extern TaskManager *manager;
+
+static long task_num = 10;
+
+/* help文章 */
+const char *usr_help_str = "Usage: ./null [-cpu spe_num] [-num N]\n\
+							-cpu    Number of SPE (default 1) \n\
+							-num 	Task Num (default 10)";
+
+	int
+init(int argc, char **argv)
+{
+	for (int i = 1; argv[i]; ++i) {
+		if (strcmp(argv[i], "-num") == 0) {
+			task_num = atoi(argv[++i]);
+		}
+	}
+	return 0;
+}
+
+	void
+null_init(TaskManager *manager)
+{
+
+	// Create Task
+	for (long i = 0; i < task_num; i++) {
+		HTask *null = manager->create_task(NullTask);
+		null->set_cpu(SPE_ANY);
+		null->spawn();
+	}
+
+}
+
+	int
+TMmain(TaskManager *manager, int argc, char *argv[])
+{
+	if (init(argc, argv) < 0) {
+		return -1;
+	}
+
+	task_init();
+	null_init(manager);
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/ppe/NullTask.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <math.h>
+#include "SchedTask.h"
+#include "NullTask.h"
+#include "Func.h"
+
+SchedDefineTask1(NullTask, nullTask);
+
+	static int
+nullTask(SchedTask *smanager, void *rbuf, void *wbuf)
+{
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/ppe/NullTask.h	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,6 @@
+#ifndef INCLUDED_TASK_NULL
+#define INCLUDED_TASK_NULL
+
+#include "SchedTask.h"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/ppe/task_init.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,10 @@
+#include "Func.h"
+#include "Scheduler.h"
+
+SchedExternTask(NullTask);
+
+	void
+task_init()
+{
+	SchedRegister(NullTask);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/spe/Makefile	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,26 @@
+include ../Makefile.def
+
+TARGET = ../spe-main
+
+SRCS_TMP = $(wildcard *.cc)
+SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
+OBJS = $(SRCS:.cc=.o)
+
+CC      = spu-g++  -D__CERIUM_CELL__ -DABIBIT=$(ABIBIT)
+CFLAGS  = -O9 -g -Wall -fno-exceptions -fno-rtti#-DDEBUG
+INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I..
+LIBS = -L../${CERIUM}/TaskManager -lspemanager  -Wl,--gc-sections 
+
+.SUFFIXES: .cc .o
+
+.cc.o:
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+
+clean:
+	rm -f $(TARGET) $(OBJS)
+	rm -f *~ \#*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/spe/NullTask.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <math.h>
+#include "SchedTask.h"
+#include "NullTask.h"
+#include "Func.h"
+
+SchedDefineTask1(NullTask, nullTask);
+
+	static int
+nullTask(SchedTask *smanager, void *rbuf, void *wbuf)
+{
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/spe/NullTask.h	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,6 @@
+#ifndef INCLUDED_TASK_NULL
+#define INCLUDED_TASK_NULL
+
+#include "SchedTask.h"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/Null/spe/spe-main.cc	Fri Dec 02 15:04:34 2011 +0900
@@ -0,0 +1,11 @@
+#include "Func.h"
+#include "Scheduler.h"
+
+SchedExternTask(NullTask);
+
+void
+task_init(Scheduler *s)
+{
+	SchedRegister(NullTask);
+}
+