Mercurial > hg > Game > Cerium
changeset 1162:8917aff8629c draft
global allocate
author | Yutaka_Kinjyo |
---|---|
date | Thu, 05 May 2011 13:11:59 +0900 |
parents | cc1a50cac83d |
children | b417abf82193 |
files | Renderer/Engine/RenderingTasks.h Renderer/Engine/SpanPack.h Renderer/Engine/Tapestry.h Renderer/Engine/global_alloc.h Renderer/Engine/polygon_pack.h Renderer/Engine/spe/AllocateSegment.cc Renderer/Engine/spe/AllocateSegment.h Renderer/Engine/spe/Load_Texture.cc Renderer/Engine/spe/Load_Texture.h Renderer/Engine/spe/spe-main.cc Renderer/Engine/task/AllocateSegment.cc Renderer/Engine/task/AllocateSegment.h Renderer/Engine/task/CreateSpan.cc Renderer/Engine/task/Load_Texture.cc Renderer/Engine/task/Load_Texture.h Renderer/Engine/task/task_init.cc Renderer/Engine/viewer.cc TaskManager/kernel/schedule/Scheduler.cc |
diffstat | 18 files changed, 110 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/RenderingTasks.h Thu May 05 00:15:43 2011 +0900 +++ b/Renderer/Engine/RenderingTasks.h Thu May 05 13:11:59 2011 +0900 @@ -20,7 +20,8 @@ CREATE_SP_TASK, DRAW_TASK, - LoadTexture, + //LoadTexture, + AllocateSegment, SetTexture, // Move,
--- a/Renderer/Engine/SpanPack.h Thu May 05 00:15:43 2011 +0900 +++ b/Renderer/Engine/SpanPack.h Thu May 05 13:11:59 2011 +0900 @@ -4,6 +4,7 @@ #include "Span.h" #define MAX_SIZE_SPAN 64 +#define SPANPACK_SEGMENT_NUM 2 class SpanPack { public: /* fields */
--- a/Renderer/Engine/Tapestry.h Thu May 05 00:15:43 2011 +0900 +++ b/Renderer/Engine/Tapestry.h Thu May 05 13:11:59 2011 +0900 @@ -75,6 +75,7 @@ #define MAX_TILE 128 + /** * TileList 中の Tile の追い出しは、現在 FIFO で実装している * これは汎用のサイズ別 freelist に置き換える
--- a/Renderer/Engine/global_alloc.h Thu May 05 00:15:43 2011 +0900 +++ b/Renderer/Engine/global_alloc.h Thu May 05 13:11:59 2011 +0900 @@ -7,5 +7,7 @@ GLOBAL_TEXTURE_HASH, GLOBAL_TILE_LIST, + GLOBAL_POLYGONPACK_LIST, KEY_STATUS, LOAD_ID, +
--- a/Renderer/Engine/polygon_pack.h Thu May 05 00:15:43 2011 +0900 +++ b/Renderer/Engine/polygon_pack.h Thu May 05 13:11:59 2011 +0900 @@ -6,6 +6,8 @@ #define MAX_SIZE_TRIANGLE 128 //#define MAX_SIZE_TRIANGLE 1 +#define POLYGONPACK_SEGMENT_NUM 2 + typedef struct VertexPack { float x; float y;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Renderer/Engine/spe/AllocateSegment.cc Thu May 05 13:11:59 2011 +0900 @@ -0,0 +1,26 @@ +#include <stdlib.h> +#include <string.h> +#include "AllocateSegment.h" +#include "task_texture.h" +#include "Func.h" +#include "Tapestry.h" +#include "polygon_pack.h" + +SchedDefineTask(AllocateSegment); + +/** + * 各種 MemorySegment の用意はここでするのか? + * + */ + +static int +run(SchedTask *smanager, void *rbuf , void *wbuf) +{ + MemList *ml = smanager->createMemList(sizeof(uint32) * TEXTURE_BLOCK_SIZE, MAX_TILE); + smanager->global_set(GLOBAL_TILE_LIST, (void *)ml); + +// ml = smanager->createMemList(sizeof(PolygonPack), MAX_POLYGON); +// smanager->global_set(GLOBAL_POLYGONPACK_LIST, (void *)ml); + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Renderer/Engine/spe/AllocateSegment.h Thu May 05 13:11:59 2011 +0900 @@ -0,0 +1,8 @@ +#ifndef INCLUDED_TASK_ALLOCATE_SEGMENT +#define INCLUDED_TASK_ALLOCATE_SEGMENT + +#include "SchedTask.h" +#include "Tapestry.h" + + +#endif
--- a/Renderer/Engine/spe/Load_Texture.cc Thu May 05 00:15:43 2011 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -// #define DEBUG -#include "error.h" - -#include <stdlib.h> -#include <string.h> -#include "Load_Texture.h" -#include "task_texture.h" -#include "Func.h" - -SchedDefineTask(LoadTexture); - -/** - * 「Load」といいながら、結局 DrawSpan で使う - * Hash の準備だけなので、名前変えないとなー - */ -static int -run(SchedTask *smanager, void *rbuf , void *wbuf) -{ - __debug_spe("LoadTexture\n"); - - MemList *ml = smanager->createMemList(sizeof(uint32) * TEXTURE_BLOCK_SIZE, MAX_TILE); - smanager->global_set(GLOBAL_TILE_LIST, (void *)ml); - - // smanager->printf("%d\n",GLOBAL_TILE_LIST); - - return 0; -}
--- a/Renderer/Engine/spe/Load_Texture.h Thu May 05 00:15:43 2011 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#ifndef INCLUDED_TASK_LOAD_TEXTURE -#define INCLUDED_TASK_LOAD_TEXTURE - -#include "SchedTask.h" -#include "Tapestry.h" - - -#endif
--- a/Renderer/Engine/spe/spe-main.cc Thu May 05 00:15:43 2011 +0900 +++ b/Renderer/Engine/spe/spe-main.cc Thu May 05 13:11:59 2011 +0900 @@ -5,7 +5,7 @@ SchedExternTask(DataUpdate); SchedExternTask(DataFree); -SchedExternTask(LoadTexture); +SchedExternTask(AllocateSegment); SchedExternTask(DrawSpan); SchedExternTask(DrawSpanEnd); SchedExternTask(DrawSpanRenew); @@ -34,7 +34,7 @@ SchedRegister( DataUpdate); SchedRegister( DataFree); - SchedRegister( LoadTexture); + SchedRegister( AllocateSegment); SchedRegister( DrawSpan); //SchedRegister( ChainCal);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Renderer/Engine/task/AllocateSegment.cc Thu May 05 13:11:59 2011 +0900 @@ -0,0 +1,33 @@ +#include <stdlib.h> +#include <string.h> +#include "AllocateSegment.h" +#include "task_texture.h" +#include "Func.h" +#include "Tapestry.h" +#include "polygon_pack.h" +#include "SpanPack.h" + +SchedDefineTask(AllocateSegment); + +/** + * 各種 MemorySegment の用意はここでするのか? + * いづれは、MemorySegment は大きく最初にガバっと領域を確保 + * MemorySegment は可変な大きさになって、要求したサイズだけ、poolから領域を与える。。 + * みたいな感じか。Cell以外のアーキテクチャではどうなんだろう。Segmentを管理ってのは必須なのか + */ + +static int +run(SchedTask *smanager, void *rbuf , void *wbuf) +{ + MemList *ml = smanager->createMemList(sizeof(uint32) * TEXTURE_BLOCK_SIZE, MAX_TILE); + smanager->global_set(GLOBAL_TILE_LIST, (void *)ml); + + ml = smanager->createMemList(sizeof(PolygonPack), POLYGONPACK_SEGMENT_NUM); + smanager->global_set(GLOBAL_POLYGONPACK_LIST, (void *)ml); + + ml = smanager->createMemList(sizeof(SpanPack), SPANPACK_SEGMENT_NUM); + smanager->global_set(GLOBAL_SPANPACK_LIST, (void *)ml); + + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Renderer/Engine/task/AllocateSegment.h Thu May 05 13:11:59 2011 +0900 @@ -0,0 +1,8 @@ +#ifndef INCLUDED_TASK_ALLOCATE_SEGMENT +#define INCLUDED_TASK_ALLOCATE_SEGMENT + +#include "SchedTask.h" +#include "Tapestry.h" + + +#endif
--- a/Renderer/Engine/task/CreateSpan.cc Thu May 05 00:15:43 2011 +0900 +++ b/Renderer/Engine/task/CreateSpan.cc Thu May 05 13:11:59 2011 +0900 @@ -3,6 +3,8 @@ #include "viewer_types.h" #include "matrix_calc.h" #include "Tapestry.h" +#include "Func.h" + // DMA channel static const int SPAN_PACK_LOAD = 5; @@ -289,10 +291,11 @@ send_spack = tmp_spack; /* - smanager->wait_segment(spack); - smanager->put_segment(spack); - SpanPackPtr spack = smanager->get_segment(addr, g->spanList); - smanager->wait_segment(spack); + smanager->wait_segment(prev_ms); + send_ms = smanager->put_segment(); + smanager->put_segment(cur_ms); + cur_ms = smanager->get_segment((memaddr)spackList[index], ml); + smanager->wait_segment(cur_ms); */ @@ -441,13 +444,23 @@ static int run(SchedTask *smanager, void *rbuf, void *wbuf) { + /* + + get_segmentを使うと、input buffer からの入力は要らなくなる + Task化するなら、get_segment は取り去る。 + 途中でloadが入ってるのは DMA転送のサイズの限界と、SPEのLSの容量の少なさにある + 必要なときに、必要な分だけ load するのは、自動的にやってほしいから、get_segment も + いづれは、Task の内部で処理されるものになるのかな。 + そうすると、Task の input , output のデータの大きさはスケーラブルになるのか。 + + */ PolygonPack *pp = (PolygonPack*)smanager->get_input(rbuf, 0); #ifdef USE_SEGMENT int stock_num = 2; //2つの領域を使い回すイメージで。最初、rbufのinputで受けてるけど、これどうなん? - // global に取ったほうがいい? このListどうやって消してやろうか。 - MemList *ml = smanager->createMemList(sizeof(PolygonPack), stock_num); + // global に取った。 このListどうやって消してやろうか。 + MemList *ml = (MemList*)smanager->global_get(GLOBAL_POLYGONPACK_LIST); MemorySegmentPtr ms; //Tileみたいに typedef したほうがいいのか。でもPolygonPackはすでに使われてるし。 PolygonPackPtr next_pp; @@ -586,8 +599,7 @@ #ifdef USE_SEGMENT - // MemList に memory 解放の関数いれるべきかな - // ml->free(); + // Global でSegmentとったので、いつか解放しないといかないなぁ。 #else
--- a/Renderer/Engine/task/Load_Texture.cc Thu May 05 00:15:43 2011 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#include <stdlib.h> -#include <string.h> -#include "Load_Texture.h" -#include "task_texture.h" -#include "Func.h" -#include "Tapestry.h" - -SchedDefineTask(LoadTexture); - -/** - * 「Load」といいながら、結局 DrawSpan で使う - * Hash の準備だけなので、名前変えないとなー - */ -static int -run(SchedTask *smanager, void *rbuf , void *wbuf) -{ - MemList *ml = smanager->createMemList(sizeof(uint32) * TEXTURE_BLOCK_SIZE, MAX_TILE); - smanager->global_set(GLOBAL_TILE_LIST, (void *)ml); - - return 0; -}
--- a/Renderer/Engine/task/Load_Texture.h Thu May 05 00:15:43 2011 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#ifndef INCLUDED_TASK_LOAD_TEXTURE -#define INCLUDED_TASK_LOAD_TEXTURE - -#include "SchedTask.h" -#include "Tapestry.h" - - -#endif
--- a/Renderer/Engine/task/task_init.cc Thu May 05 00:15:43 2011 +0900 +++ b/Renderer/Engine/task/task_init.cc Thu May 05 13:11:59 2011 +0900 @@ -20,7 +20,7 @@ SchedExternTask(CREATE_SP_TASK); SchedExternTask(DRAW_TASK); -SchedExternTask(LoadTexture); +SchedExternTask(AllocateSegment); // SchedExternTask(Move); SchedExternTask(Draw); @@ -65,7 +65,7 @@ SchedRegister(CREATE_SP_TASK); SchedRegister(DRAW_TASK); - SchedRegister( LoadTexture); + SchedRegister( AllocateSegment); // SchedRegister( Move); SchedRegister( Draw);
--- a/Renderer/Engine/viewer.cc Thu May 05 00:15:43 2011 +0900 +++ b/Renderer/Engine/viewer.cc Thu May 05 13:11:59 2011 +0900 @@ -187,7 +187,7 @@ // ここは、Iterator を用意するべきだよね for (int j = 0; j < spe_num; j++) { - task_tex = manager->create_task(LoadTexture,0,0,0,0); + task_tex = manager->create_task(AllocateSegment,0,0,0,0); task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + j)); task_next->wait_for(task_tex); task_tex->spawn();
--- a/TaskManager/kernel/schedule/Scheduler.cc Thu May 05 00:15:43 2011 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Thu May 05 13:11:59 2011 +0900 @@ -407,6 +407,7 @@ #else //addr が空だった場合はどうなるか + //こうすると単純にFIFOか MemorySegment *s = m->getLast(); m->moveToFirst(s); @@ -479,6 +480,7 @@ void Scheduler::put_segment(MemorySegment *s) { + s->tag = get_tag(); dma_store(s->data, s->address, s->size, s->tag); }