changeset 182:df3cfc04e796

add get_inputAddr, get_outputAddr
author gongo@gendarme.cr.ie.u-ryukyu.ac.jp
date Tue, 23 Dec 2008 16:27:07 +0900
parents a4d17bc4efef
children 54787f182881 907bda4a1a14
files TaskManager/Cell/spe/SchedTask.cc TaskManager/ChangeLog TaskManager/Test/test_render/Makefile.def TaskManager/Test/test_render/spe/DrawSpan.cpp TaskManager/Test/test_render/task/DrawSpan.cpp TaskManager/kernel/schedule/SchedTask.cc include/TaskManager/SchedTask.h
diffstat 7 files changed, 98 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/spe/SchedTask.cc	Tue Dec 23 15:54:09 2008 +0900
+++ b/TaskManager/Cell/spe/SchedTask.cc	Tue Dec 23 16:27:07 2008 +0900
@@ -286,7 +286,7 @@
 }
 
 /**
- * task->add_input で与えられた順番に対応する index (0〜n-1) で、
+ * task->add_inData で与えられた順番に対応する index (0〜n-1) で、
  * buffer から対応するデータを返す。
  */
 void*
@@ -300,6 +300,15 @@
 }
 
 /**
+ * get_input(index) のアドレスを返す
+ */
+uint32
+SchedTask::get_inputAddr(int index)
+{
+    return __inListData->element[index].addr;
+}
+
+/**
  * write buffer の領域を返す。
  */
 void*
@@ -312,6 +321,15 @@
     }
 }
 
+/**
+ * get_output(index) のアドレスを返す
+ */
+uint32
+SchedTask::get_outputAddr(int index)
+{
+    return __outListData->element[index].addr;
+}
+
 int
 SchedTask::get_param(int index)
 {
--- a/TaskManager/ChangeLog	Tue Dec 23 15:54:09 2008 +0900
+++ b/TaskManager/ChangeLog	Tue Dec 23 16:27:07 2008 +0900
@@ -1,3 +1,10 @@
+2008-12-23  Wataru MIYAGUNI  <gongo@cr.ie.u-ryukyu.ac.jp>
+
+	* Cell/spe/SchedTask.cc (SchedTask::get_outputAddr)
+	(SchedTask::get_inputAddr): add
+
+	in/out 若帥≪鴻鴻
+
 2008-12-22  Wataru MIYAGUNI  <gongo@cr.ie.u-ryukyu.ac.jp>
 
 	* Cell/spe/SchedTask.cc (SchedTask::__init__, SchedTask::read)
--- a/TaskManager/Test/test_render/Makefile.def	Tue Dec 23 15:54:09 2008 +0900
+++ b/TaskManager/Test/test_render/Makefile.def	Tue Dec 23 16:27:07 2008 +0900
@@ -3,10 +3,10 @@
 # include/library path
 # ex: macosx
 #CERIUM = /Users/gongo/Source/Concurrency/Game_project/Cerium
-#CERIUM = /Users/gongo/Source/hg/Cerium
+CERIUM = /Users/gongo/Source/hg/Cerium
 
 # ex: linux/ps3
-CERIUM = /home/gongo/Cerium
+#CERIUM = /home/gongo/Cerium
 #CERIUM = /Users/tkaito/hg/Game/Cerium
 
 #CERIUM = ../../..
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp	Tue Dec 23 15:54:09 2008 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp	Tue Dec 23 16:27:07 2008 +0900
@@ -123,20 +123,23 @@
 int
 DrawSpan::run(void *rbuf, void *wbuf)
 {
-    SpanPack *sp = (SpanPack*)smanager->get_input(0);
-    SpanPack *next_sp =
+    SpanPack *spack = (SpanPack*)smanager->get_input(0);
+    SpanPack *next_spack =
 	(SpanPack*)smanager->allocate(sizeof(SpanPack));
-    SpanPack *free_sp = next_sp; // next_sp の free() 用
-    SpanPack *tmp_sp = NULL;
+    SpanPack *free_spack = next_spack; // next_spack の free() 用
     Span *span;
 
     hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH);
     tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST);
 
-    int rangex_start  = get_param(0); // このタスクが担当する x の範囲の始点
-    int rangex_end    = get_param(1); // 終点 (start <= x <= end)
-    int rangey        = get_param(2); // y の範囲 (render_y + rangey - 1)
+    int rangex_start  = smanager->get_param(0);
+    int rangex_end    = smanager->get_param(1); 
+
+    // このタスクが担当する x の範囲
     int rangex        = rangex_end - rangex_start + 1;
+
+    // y の範囲 (render_y + rangey - 1)
+    int rangey        = smanager->get_param(2);
     
     float *zRow = (float*)smanager->get_input(1);
     int **linebuf = (int**)smanager->allocate(sizeof(int*)*rangey);
@@ -152,15 +155,15 @@
 	 * 現在の SpanPack を処理してる間に
 	 * 次の SpanPack の DMA 転送を行う
 	 */
-	if (sp->next != NULL) {
-	    smanager->dma_load(next_sp, (uint32)sp->next,
+	if (spack->next != NULL) {
+	    smanager->dma_load(next_spack, (uint32)spack->next,
 			       sizeof(SpanPack), SPAN_PACK_LOAD);
 	} else {
-	    next_sp = NULL;
+	    next_spack = NULL;
 	}
 
-	for (int t = sp->info.start; t < sp->info.size; t++) {	  
-	    span = &sp->span[t];
+	for (int t = 0; t < spack->info.size; t++) {	  
+	    span = &spack->span[t];
 
 	    Uint32 rgb = 0x00ff00;
 	    float tex1 = span->tex_x1;
@@ -224,9 +227,6 @@
 
 		    tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1);
 		    tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1);
-		    /**
-		     * ・・・なんかかっこいい書き方ないかな
-		     */
 		    if (tex_x > 1) tex_x = 1;
 		    if (tex_x < 0) tex_x = 0;
 		    if (tex_y > 1) tex_y = 1;
@@ -251,12 +251,12 @@
 
 	smanager->dma_wait(SPAN_PACK_LOAD);
 
-	tmp_sp = sp;
-	sp = next_sp;
-	next_sp = tmp_sp;
-    } while (sp);
+	SpanPack *tmp_spack = spack;
+	spack = next_spack;
+	next_spack = tmp_spack;
+    } while (spack);
 
-    free(free_sp);
+    free(free_spack);
     free(linebuf);
 
     return 0;
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp	Tue Dec 23 15:54:09 2008 +0900
+++ b/TaskManager/Test/test_render/task/DrawSpan.cpp	Tue Dec 23 16:27:07 2008 +0900
@@ -123,20 +123,23 @@
 int
 DrawSpan::run(void *rbuf, void *wbuf)
 {
-    SpanPack *sp = (SpanPack*)smanager->get_input(0);
-    SpanPack *next_sp =
+    SpanPack *spack = (SpanPack*)smanager->get_input(0);
+    SpanPack *next_spack =
 	(SpanPack*)smanager->allocate(sizeof(SpanPack));
-    SpanPack *free_sp = next_sp; // next_sp の free() 用
-    SpanPack *tmp_sp = NULL;
+    SpanPack *free_spack = next_spack; // next_spack の free() 用
     Span *span;
 
     hash = (TileHashPtr)smanager->global_get(GLOBAL_TEXTURE_HASH);
     tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST);
 
-    int rangex_start  = get_param(0); // このタスクが担当する x の範囲の始点
-    int rangex_end    = get_param(1); // 終点 (start <= x <= end)
-    int rangey        = get_param(2); // y の範囲 (render_y + rangey - 1)
+    int rangex_start  = smanager->get_param(0);
+    int rangex_end    = smanager->get_param(1); 
+
+    // このタスクが担当する x の範囲
     int rangex        = rangex_end - rangex_start + 1;
+
+    // y の範囲 (render_y + rangey - 1)
+    int rangey        = smanager->get_param(2);
     
     float *zRow = (float*)smanager->get_input(1);
     int **linebuf = (int**)smanager->allocate(sizeof(int*)*rangey);
@@ -152,15 +155,15 @@
 	 * 現在の SpanPack を処理してる間に
 	 * 次の SpanPack の DMA 転送を行う
 	 */
-	if (sp->next != NULL) {
-	    smanager->dma_load(next_sp, (uint32)sp->next,
+	if (spack->next != NULL) {
+	    smanager->dma_load(next_spack, (uint32)spack->next,
 			       sizeof(SpanPack), SPAN_PACK_LOAD);
 	} else {
-	    next_sp = NULL;
+	    next_spack = NULL;
 	}
 
-	for (int t = 0; t < sp->info.size; t++) {	  
-	    span = &sp->span[t];
+	for (int t = 0; t < spack->info.size; t++) {	  
+	    span = &spack->span[t];
 
 	    Uint32 rgb = 0x00ff00;
 	    float tex1 = span->tex_x1;
@@ -224,9 +227,6 @@
 
 		    tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1);
 		    tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1);
-		    /**
-		     * ・・・なんかかっこいい書き方ないかな
-		     */
 		    if (tex_x > 1) tex_x = 1;
 		    if (tex_x < 0) tex_x = 0;
 		    if (tex_y > 1) tex_y = 1;
@@ -251,12 +251,12 @@
 
 	smanager->dma_wait(SPAN_PACK_LOAD);
 
-	tmp_sp = sp;
-	sp = next_sp;
-	next_sp = tmp_sp;
-    } while (sp);
+	SpanPack *tmp_spack = spack;
+	spack = next_spack;
+	next_spack = tmp_spack;
+    } while (spack);
 
-    free(free_sp);
+    free(free_spack);
     free(linebuf);
 
     return 0;
--- a/TaskManager/kernel/schedule/SchedTask.cc	Tue Dec 23 15:54:09 2008 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.cc	Tue Dec 23 16:27:07 2008 +0900
@@ -247,8 +247,7 @@
     uint32 cmd;
 	
     __taskGroup->remove(__task);
-    cmd = __taskGroup->status();
-    
+    cmd = __taskGroup->status();    
 
     // タスク内で作られた全てのタスクが終了した
     if (cmd != 0) {
@@ -287,7 +286,7 @@
 }
 
 /**
- * task->add_input で与えられた順番に対応する index (0〜n-1) で、
+ * task->add_inData で与えられた順番に対応する index (0〜n-1) で、
  * buffer から対応するデータを返す。
  */
 void*
@@ -301,6 +300,15 @@
 }
 
 /**
+ * get_input(index) のアドレスを返す
+ */
+uint32
+SchedTask::get_inputAddr(int index)
+{
+    return __inListData->element[index].addr;
+}
+
+/**
  * write buffer の領域を返す。
  */
 void*
@@ -313,6 +321,15 @@
     }
 }
 
+/**
+ * get_output(index) のアドレスを返す
+ */
+uint32
+SchedTask::get_outputAddr(int index)
+{
+    return __outListData->element[index].addr;
+}
+
 int
 SchedTask::get_param(int index)
 {
--- a/include/TaskManager/SchedTask.h	Tue Dec 23 15:54:09 2008 +0900
+++ b/include/TaskManager/SchedTask.h	Tue Dec 23 16:27:07 2008 +0900
@@ -98,6 +98,8 @@
 
     void* get_input(void *buff, int index);
     void* get_output(void *buff, int index);
+    uint32 get_inputAddr(int index);
+    uint32 get_outputAddr(int index);
     int get_param(int index);
 
     TaskPtr create_task(int cmd);
@@ -135,6 +137,14 @@
 	    return outer->get_output(outer->__writebuf, index);
 	}
 
+	uint32 get_inputAddr(int index) {
+	    return outer->get_inputAddr(index);
+	}
+
+	uint32 get_outputAddr(int index) {
+	    return outer->get_outputAddr(index);
+	}
+
 	int get_param(int index) {
 	    return outer->get_param(index);
 	}