changeset 778:558c6c856f89 draft

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 05 Mar 2010 12:51:36 +0900
parents c38799cc3f60 (diff) 6074168273de (current diff)
children 4d83a6a958fd
files
diffstat 9 files changed, 52 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.def	Tue Jan 12 10:29:20 2010 +0900
+++ b/Renderer/Engine/Makefile.def	Fri Mar 05 12:51:36 2010 +0900
@@ -5,7 +5,7 @@
 ABIBIT = 32 
 ABI = -m$(ABIBIT)
 CC      = g++
-OPT	= -g -O2
+OPT	= -g #-O2
 CFLAGS  = -g -Wall $(ABI) $(OPT)  #  -DDEBUG
 
 INCLUDE = -I$(CERIUM)/include/TaskManager -I.
--- a/Renderer/Engine/viewer.cc	Tue Jan 12 10:29:20 2010 +0900
+++ b/Renderer/Engine/viewer.cc	Fri Mar 05 12:51:36 2010 +0900
@@ -100,6 +100,8 @@
     this_time  = 0;
     frames     = 0;
 
+    if (spe_num == 0) spe_num = 1;
+
     sgroot = new SceneGraphRoot(this->width, this->height);
     sgroot->tmanager = manager;
     
@@ -117,13 +119,13 @@
     data_load->set_param(1,(memaddr)Light);
     data_load->set_cpu((CPU_TYPE)((int)SPE_0));
     data_load->spawn();
-
+    
     for(int i = 1; i < spe_num; i++) {
-      data_load = manager->create_task(DataLoad);
-      data_load->set_param(0,(memaddr)size);
-      data_load->set_param(1,(memaddr)Light);
-      data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i));
-      data_load->spawn();
+	data_load = manager->create_task(DataLoad);
+	data_load->set_param(0,(memaddr)size);
+	data_load->set_param(1,(memaddr)Light);
+	data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i));
+	data_load->spawn();
     }
 
     MainLoop *mainloop = app->init(this, this->width, this->height);
@@ -173,9 +175,9 @@
     // ここは、Iterator を用意するべきだよね
     for (int i = 0; i < spe_num; i++) {
         task_tex = manager->create_task(LoadTexture);
-        task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i));
-        task_next->wait_for(task_tex);
-        task_tex->spawn();
+	task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i));
+	task_next->wait_for(task_tex);
+	task_tex->spawn();	
     }
 
     return task_next;
@@ -239,7 +241,7 @@
     viewer->getKey();
     HTaskPtr update_key = viewer->manager->create_task(UpdateKey);
     update_key->add_inData(viewer->keyPtr, sizeof(key_stat));
-    update_key->set_cpu(SPE_0);
+    //update_key->set_cpu(SPE_0);
     update_key->spawn();
     
     /* TASK_MOVE は外から引数で取ってくるべき */
@@ -415,8 +417,9 @@
     task_create_pp->set_param(1,(memaddr)ppack);
 
     task_next->wait_for(task_create_pp);
-    
-    int range_base = spe_num;
+
+    int  range_base = spe_num;
+
     // 切り上げのつもり
     int range = (spackList_length + range_base - 1) / range_base;
 
@@ -428,7 +431,7 @@
 	HTaskPtr task_create_sp = manager->create_task(CreateSpan);
 
         task_create_sp->set_param(0,index_start);
-
+	
         /**
          * ex. screen_height が 480, spenum が 6 の場合、各SPEのy担当範囲
          *   [  1.. 80] [ 81..160] [161..240]
@@ -438,6 +441,7 @@
          *   [  1..216] [217..432] [433..648]
          *   [649..864] [865..1080]
          */
+
         task_create_sp->set_param(1,index_start*split_screen_h + 1);
         task_create_sp->set_param(2,index_end*split_screen_h);
 
@@ -449,10 +453,11 @@
         task_next->wait_for(task_create_sp);
         task_create_sp->wait_for(task_create_pp);
 
-        task_create_sp->set_cpu(SPE_ANY);
+	task_create_sp->set_cpu(SPE_ANY);
         task_create_sp->spawn();
     }
 
+
     task_create_pp->spawn();
 }
 
@@ -481,15 +486,14 @@
     data_update_wait->set_param(1,Light);
     data_update_wait->set_cpu((CPU_TYPE)((int)SPE_0));
 
-
     for (int i = 1; i < spe_num; i++) {
-      data_update = manager->create_task(DataUpdate);
-      data_update->add_inData(light_xyz,sizeof(float)*size);
-      data_update->set_param(0,size);
-      data_update->set_param(1,Light);
-      data_update->set_cpu((CPU_TYPE)((int)SPE_0 + i));
-      data_update_wait->wait_for(data_update);
-      data_update->spawn();
+	data_update = manager->create_task(DataUpdate);
+	data_update->add_inData(light_xyz,sizeof(float)*size);
+	data_update->set_param(0,size);
+	data_update->set_param(1,Light);
+	data_update->set_cpu((CPU_TYPE)((int)SPE_0 + i));
+	data_update_wait->wait_for(data_update);
+	data_update->spawn();
     }
     
     data_update_wait->spawn();
@@ -533,7 +537,7 @@
 				break;
             }
 
-            task_draw->set_cpu(SPE_ANY);
+	    task_draw->set_cpu(SPE_ANY);
             task_next->wait_for(task_draw);
 	    task_draw->wait_for(data_update_wait);
             task_draw->spawn();
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Tue Jan 12 10:29:20 2010 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Fri Mar 05 12:51:36 2010 +0900
@@ -131,7 +131,7 @@
         if (htask->command==TaskArray1) {
             // compatibility
 	    // Task with ListData is stored in the ListData
-            int next = (htask->r_size+sizeof(SimpleTask))/sizeof(SimpleTask);
+            int next = (htask->r_size)/sizeof(SimpleTask) + 1;
             if (list->length+next>=TASK_MAX_SIZE) {
                 list->length--;
                 TaskListPtr newList = taskListImpl->create();
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc	Tue Jan 12 10:29:20 2010 +0900
+++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc	Fri Mar 05 12:51:36 2010 +0900
@@ -107,7 +107,7 @@
 
 	if (htask->command==TaskArray1) {
 	    // compatibility
-	    int next = (htask->r_size+sizeof(SimpleTask))/sizeof(SimpleTask);
+	    int next = ((htask->r_size)/sizeof(SimpleTask))+1;
 	    if (list->length+next>=TASK_MAX_SIZE) {
 		list->length--;
 		TaskListPtr newList = taskListImpl->create();
@@ -117,6 +117,9 @@
 	    }
 	    Task *array = (Task*)&list->tasks[list->length];
 	    list->length += next;
+	    if (list->length>=TASK_MAX_SIZE) {
+		perror("task array1 overflow\n");
+	    }
 	    memcpy(array, htask->rbuf, htask->r_size);
 	    free(htask->rbuf);
 	    htask->rbuf = 0; htask->r_size = 0;
--- a/TaskManager/Makefile	Tue Jan 12 10:29:20 2010 +0900
+++ b/TaskManager/Makefile	Fri Mar 05 12:51:36 2010 +0900
@@ -1,5 +1,4 @@
 include ./Makefile.def
--include ./Makefile.dep
 
 TAGS       = gtags
 TAGSOPTION = 
@@ -46,3 +45,5 @@
 
 tags:
 	$(TAGS) $(TAGSOPTION)
+
+-include ./Makefile.dep
--- a/TaskManager/Makefile.def	Tue Jan 12 10:29:20 2010 +0900
+++ b/TaskManager/Makefile.def	Fri Mar 05 12:51:36 2010 +0900
@@ -30,7 +30,7 @@
 ABIBIT = 32
 
 
-OPT = -O9 
+OPT = #-O9 
 OPT =  -g
 
 CC     = g++   
--- a/TaskManager/kernel/schedule/SchedTask.cc	Tue Jan 12 10:29:20 2010 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.cc	Fri Mar 05 12:51:36 2010 +0900
@@ -50,7 +50,7 @@
     scheduler   = sc;
     cur_index   = index;
 
-    scheduler->mainMem_wait();
+    scheduler->mainMem_wait();   // これはなんで?
 
 }
 
--- a/TaskManager/kernel/schedule/SchedTaskArray.cc	Tue Jan 12 10:29:20 2010 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskArray.cc	Fri Mar 05 12:51:36 2010 +0900
@@ -137,14 +137,6 @@
     free(writebuf);
     free(inListData.bound);
     free(outListData.bound);
-
-    // このTaskArrayは終り。終了を知らせる。
-    if (!array || atask->next() >= last()) {
-	SchedTask *s = (SchedTask *)savedTask;
-	scheduler->mail_write((memaddr)s->task->self);
-	free(array);
-    }
-
 }
 
 Task *SchedTaskArray::last()
@@ -164,7 +156,12 @@
     } else {
 	// このTaskArrayは終り。save していた Task の次を返す。
 	// savedTask の read/exec は実行されない (command = TaskArray)
-	return savedTask->next(scheduler, savedTask);
+	SchedTask *s = (SchedTask *)savedTask;
+	SchedTaskBase *n =  savedTask->next(scheduler, savedTask);
+	scheduler->mail_write((memaddr)savedTask->task->self);
+	free(array);
+	delete savedTask;
+	return n;
     }
 }
 
--- a/TaskManager/kernel/schedule/SchedTaskBase.h	Tue Jan 12 10:29:20 2010 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskBase.h	Fri Mar 05 12:51:36 2010 +0900
@@ -9,16 +9,19 @@
 class SchedTaskBase {
 public:
     /* constructor */
-    SchedTaskBase(void) {}
-    virtual ~SchedTaskBase(void) {}
+    // void *called ;  // for debug
+    SchedTaskBase() {
+	// called = __builtin_return_address(1);
+    }
+    virtual ~SchedTaskBase() {}
 
     BASE_NEW_DELETE(SchedTaskBase);
 
     // noaction in default
-    virtual void load(void)  {}
-    virtual void read(void)  {}
-    virtual void exec(void)  {}
-    virtual void write(void) {}
+    virtual void load()  {}
+    virtual void read()  {}
+    virtual void exec()  {}
+    virtual void write() {}
 
     /* functions */
     virtual SchedTaskBase* next(Scheduler *, SchedTaskBase*) {return 0;}