# HG changeset patch # User Shinji KONO # Date 1249569026 -32400 # Node ID 82cb9368e3ff7a94a11f767e9df2dec9c6b91caa # Parent 5e2d30bfbf235cd6c9d8fbee994d676b53ee9666 MemHash (OS X version) diff -r 5e2d30bfbf23 -r 82cb9368e3ff TaskManager/Cell/spe/CellScheduler.cc --- a/TaskManager/Cell/spe/CellScheduler.cc Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/Cell/spe/CellScheduler.cc Thu Aug 06 23:30:26 2009 +0900 @@ -6,10 +6,10 @@ // ユーザプログラムで定義 // なんだけど、それは微妙じゃね? -extern void task_init(void); +extern void task_init(); void -CellScheduler::init_impl(void) +CellScheduler::init_impl() { connector = new CellDmaManager; @@ -45,7 +45,7 @@ } void -CellScheduler::mainMem_wait(void) +CellScheduler::mainMem_wait() { uint32 id; uint32 addr; @@ -58,3 +58,25 @@ mainMemNum--; } } + +/* + dma channel を返す + 本来、SPU用に閉じているはず。ユーザが明示的に使うことはない。 + 良くわからないが、ある分だけcounterで廻せば良い。しかし、 + そのためには、全部で、get_tag()する必要があるはず。 + + */ + +#define TEX_LOAD1 0 +#define TEX_LOAD2 1 + +uint32 +CellScheduler::get_tag() +{ + static int count = 0; + int i = (count++ % 2); + return TEX_LOAD1*i + TEX_LOAD2*(1-i); +} + + +/* end */ diff -r 5e2d30bfbf23 -r 82cb9368e3ff TaskManager/Cell/spe/CellScheduler.h --- a/TaskManager/Cell/spe/CellScheduler.h Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/Cell/spe/CellScheduler.h Thu Aug 06 23:30:26 2009 +0900 @@ -13,6 +13,7 @@ void *allocate(int size); void mainMem_alloc(int id, int size); void mainMem_wait(void); + uint32 get_tag(); private: int mainMemNum; diff -r 5e2d30bfbf23 -r 82cb9368e3ff TaskManager/Test/test_render/chain.cpp --- a/TaskManager/Test/test_render/chain.cpp Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/Test/test_render/chain.cpp Thu Aug 06 23:30:26 2009 +0900 @@ -1,4 +1,4 @@ -#include +#include #include #include "SceneGraphRoot.h" #include "SGList.h" diff -r 5e2d30bfbf23 -r 82cb9368e3ff TaskManager/kernel/memory/MemHash.cc --- a/TaskManager/kernel/memory/MemHash.cc Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/kernel/memory/MemHash.cc Thu Aug 06 23:30:26 2009 +0900 @@ -23,7 +23,7 @@ return value % hashSize; } -MemHash::MemHash(void) +MemHash::MemHash() { //hashSize = 263; //tableSize = sizeof(MemorySegmentPtr)*hashSize; diff -r 5e2d30bfbf23 -r 82cb9368e3ff TaskManager/kernel/schedule/Scheduler.cc --- a/TaskManager/kernel/schedule/Scheduler.cc Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Thu Aug 06 23:30:26 2009 +0900 @@ -23,6 +23,7 @@ void Scheduler::init(void) { + hash = 0; init_impl(); for (int i = 0; i < 2; i++) { @@ -352,6 +353,10 @@ char* mseg = (char*)allocate(seg_size*count); MemList* mlist = new MemList((MemorySegment*)mseg); + if (!hash) { + hash = new MemHash(); + } + for(int i = 0; i < count; i++) { MemorySegment* next = (MemorySegment*)(mseg+seg_size*i); char* data = (char*)next+head_size; diff -r 5e2d30bfbf23 -r 82cb9368e3ff TaskManager/kernel/schedule/Scheduler.h --- a/TaskManager/kernel/schedule/Scheduler.h Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Thu Aug 06 23:30:26 2009 +0900 @@ -138,13 +138,10 @@ void *mainMem_get(int id); MemorySegment * Scheduler::get_segment(memaddr addr, MemList *m); - uint32 Scheduler::get_tag(); + virtual uint32 Scheduler::get_tag(); void Scheduler::put_segment(MemorySegment *s); void Scheduler::wait_segment(MemorySegment *s); - - - /* DMA Transfer */ void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask); void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask);