Mercurial > hg > Game > Cerium
changeset 387:b6fce69839b5 draft
no compile error but not worked.
line wrap: on
line diff
--- a/TaskManager/Test/test_render/ChangeLog Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/ChangeLog Thu Aug 06 22:40:52 2009 +0900 @@ -1,3 +1,9 @@ +2009-08-06 Shinji Kono <kono@ie.u-ryukyu.ac.jp> + +DrawSpan の reboot/ TASK_DRAW_SPAN2 は、使ってないのね。 + + + 2009-03-29 Wataru MIYAGUNI <gongo@cr.ie.u-ryukyu.ac.jp> * Makefile
--- a/TaskManager/Test/test_render/Func.h Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/Func.h Thu Aug 06 22:40:52 2009 +0900 @@ -16,7 +16,7 @@ TASK_CS_START, TASK_CS_RUN, TASK_DRAW_SPAN, - TASK_DRAW_SPAN2, +// TASK_DRAW_SPAN2, TASK_DRAW_BACK, TASK_SET_TEXTURE, TASK_DUMMY,
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Thu Aug 06 22:40:52 2009 +0900 @@ -206,6 +206,7 @@ return data[(TEXTURE_SPLIT_PIXEL)*ty+tx]; } +#if 0 /** * DrawSpan の再起動 (DrawSpanRenew 生成) * @@ -265,6 +266,7 @@ doneWrite = 1; } +#endif /** * zRow と Linebuf を更新する
--- a/TaskManager/Test/test_render/spe/DrawSpan.h Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.h Thu Aug 06 22:40:52 2009 +0900 @@ -32,8 +32,9 @@ void updateBuffer(float zpos, int rangex, int x, int y, int tex_x, int tex_y, TilePtr tile); - +#if 0 void reboot(SpanPackPtr spack, int cur_span_x); +#endif int drawDot1(SpanPtr span, int startx, int endx, int wait_tag); void drawDot2(SpanPtr span, int startx, int endx, int js, int wait_tag);
--- a/TaskManager/Test/test_render/spe/DrawSpanRenew.cpp Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpanRenew.cpp Thu Aug 06 22:40:52 2009 +0900 @@ -1,3 +1,4 @@ +#if 0 // #define DEBUG #include "error.h" @@ -234,3 +235,4 @@ return 0; } +#endif
--- a/TaskManager/Test/test_render/spe/DrawSpanRenew.h Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpanRenew.h Thu Aug 06 22:40:52 2009 +0900 @@ -1,3 +1,4 @@ +#if 0 #ifndef INCLUDED_TASK_DRAW_SPAN2 #define INCLUDED_TASK_DRAW_SPAN2 @@ -16,3 +17,4 @@ }; #endif +#endif
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.cpp Thu Aug 06 22:40:52 2009 +0900 @@ -168,6 +168,7 @@ return data[(TEXTURE_SPLIT_PIXEL)*ty+tx]; } +#if 0 /** * DrawSpan の再起動 (DrawSpanRenew 生成) * @@ -214,6 +215,7 @@ // next_spack は free() するので wait する smanager->dma_wait(SPAN_PACK_LOAD); } +#endif void DrawSpan::writebuffer(unsigned int display, int buf_width, int height, @@ -310,9 +312,8 @@ tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; #if USE_MEMHASH - TilePtr tile = smanager->get_segement(tex_addr, - sizeof(uint32)*TEXTURE_BLOCK_SIZE); - smanager->wait_segement(tileid); + TilePtr tile = smanager->get_segment(tex_addr,tileList); + smanager->wait_segment(tile); #else TilePtr tile; if (!(tile = isAvailableTile(tex_addr))) { @@ -422,9 +423,8 @@ tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; #if USE_MEMHASH - TilePtr tile = smanager->get_segement(tex_addr, - sizeof(uint32)*TEXTURE_BLOCK_SIZE); - smanager->wait_segement(tile); + TilePtr tile = smanager->get_segment(tex_addr,tileList); + smanager->wait_segment(tile); #else TilePtr tile; if (!(tile = isAvailableTile(tex_addr))) {
--- a/TaskManager/Test/test_render/task/DrawSpanRenew.cpp Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpanRenew.cpp Thu Aug 06 22:40:52 2009 +0900 @@ -1,3 +1,4 @@ +#if 0 #include <stdlib.h> #include <string.h> #include "DrawSpanRenew.h" @@ -219,3 +220,4 @@ return 0; } +#endif
--- a/TaskManager/Test/test_render/task/DrawSpanRenew.h Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpanRenew.h Thu Aug 06 22:40:52 2009 +0900 @@ -1,3 +1,4 @@ +#if 0 #ifndef INCLUDED_TASK_DRAW_SPAN2 #define INCLUDED_TASK_DRAW_SPAN2 @@ -16,3 +17,4 @@ }; #endif +#endif
--- a/TaskManager/Test/test_render/task/task_init.cpp Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/Test/test_render/task/task_init.cpp Thu Aug 06 22:40:52 2009 +0900 @@ -31,7 +31,7 @@ SchedRegisterTask(TASK_CREATE_SPAN, CreateSpan); SchedRegisterTask(TASK_DRAW_SPAN, DrawSpan); - SchedRegisterTask(TASK_DRAW_SPAN2, DrawSpanRenew); +// SchedRegisterTask(TASK_DRAW_SPAN2, DrawSpanRenew); SchedRegisterTask(TASK_DRAW_BACK, DrawBack); SchedRegisterTask(TASK_INIT_TEXTURE, LoadTexture);
--- a/TaskManager/include/types.h Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/include/types.h Thu Aug 06 22:40:52 2009 +0900 @@ -3,6 +3,7 @@ #include <stdint.h> +typedef uint16_t uint16; typedef uint32_t uint32; typedef uint64_t uint64; #ifdef SPU
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/kernel/memory/MemHash.cc Thu Aug 06 22:40:52 2009 +0900 @@ -0,0 +1,90 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "MemHash.h" + +static unsigned short PRIME[8] = { + 0x002, 0x065, 0x0c7, 0x133, 0x191, 0x1f3, 0x259, 0x2bd, +}; + +int +MemHash::hash(memaddr data) +{ + int value = 0; + int n = 0; + int key; + + for (uint32 i = 0; i < sizeof(memaddr) * 2; i ++) { + key = data & 0xf; + value += key * PRIME[n++ & 7]; + data >>= 4; + } + + return value % hashSize; +} + +MemHash::MemHash(void) +{ + //hashSize = 263; + //tableSize = sizeof(MemorySegmentPtr)*hashSize; + + table = (MemorySegmentPtr*)malloc(tableSize); + clear(); +} + +int +MemHash::put(memaddr key, MemorySegmentPtr data) +{ + int hashval = hash(key); + + for (int i = 0; i < hashSize/2; i++) { + int index = (hashval + i*i)%hashSize; + + if (table[index] == 0) { // 空の table に入れる + table[index] = data; + return index; + } + } + + return -1; +} + +MemorySegmentPtr +MemHash::get(memaddr key) +{ + int hashval = hash(key); + + for (int i = 0; i < hashSize/2; i++) { + int index = (hashval + i*i)%hashSize; + + if (table[index] != NULL && + table[index]->address == key) { + return table[index]; + } + } + + return NULL; +} + +void +MemHash::remove(memaddr key) +{ + int hashval = hash(key); + + for (int i = 0; i < hashSize/2; i++) { + int index = (hashval + i*i)%hashSize; + + if (table[index] != NULL && + table[index]->address == key) { + table[index] = NULL; + } + } +} + +void +MemHash::clear(void) +{ + bzero(table, tableSize); +} + +/* end */
--- a/TaskManager/kernel/memory/MemHash.cpp Thu Aug 06 19:31:51 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include "MemHash.h" - -static unsigned short PRIME[8] = { - 0x002, 0x065, 0x0c7, 0x133, 0x191, 0x1f3, 0x259, 0x2bd, -}; - -int -MemHash::hash(memaddr data) -{ - int value = 0; - int n = 0; - int key; - - for (uint32 i = 0; i < sizeof(memaddr) * 2; i ++) { - key = data & 0xf; - value += key * PRIME[n++ & 7]; - data >>= 4; - } - - return value % hashSize; -} - -MemHash::MemHash(void) -{ - //hashSize = 263; - //tableSize = sizeof(MemorySegmentPtr)*hashSize; - - table = (MemorySegmentPtr*)malloc(tableSize); - clear(); -} - -int -MemHash::put(memaddr key, MemorySegmentPtr data) -{ - int hashval = hash(key); - - for (int i = 0; i < hashSize/2; i++) { - int index = (hashval + i*i)%hashSize; - - if (table[index] == 0) { // 空の table に入れる - table[index] = data; - return index; - } - } - - return -1; -} - -MemorySegmentPtr -MemHash::get(memaddr key) -{ - int hashval = hash(key); - - for (int i = 0; i < hashSize/2; i++) { - int index = (hashval + i*i)%hashSize; - - if (table[index] != NULL && - table[index]->address == key) { - return table[index]; - } - } - - return NULL; -} - -void -MemHash::remove(memaddr key) -{ - int hashval = hash(key); - - for (int i = 0; i < hashSize/2; i++) { - int index = (hashval + i*i)%hashSize; - - if (table[index] != NULL && - table[index]->address == key) { - table[index] = NULL; - } - } -} - -void -MemHash::clear(void) -{ - bzero(table, tableSize); -} - -/* end */
--- a/TaskManager/kernel/memory/MemHash.h Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/kernel/memory/MemHash.h Thu Aug 06 22:40:52 2009 +0900 @@ -1,6 +1,8 @@ #ifndef INCLUDED_MEM_HASH #define INCLUDED_MEM_HASH +#include "MemorySegment.h" + class MemHash { public: MemHash(void); @@ -11,7 +13,7 @@ public: void clear(void); int hash(memaddr data); - int put(memaddr addr, MemPtr tile); + int put(memaddr addr, MemorySegmentPtr ms); MemorySegmentPtr get(memaddr addr); void remove(memaddr addr); }; @@ -19,7 +21,7 @@ typedef MemHash* MemHashPtr; const int hashSize = 263; -const int tableSize = sizeof(MemorySegementPtr)*hashSize; +const int tableSize = sizeof(MemorySegmentPtr)*hashSize; #endif
--- a/TaskManager/kernel/memory/MemorySegment.h Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/kernel/memory/MemorySegment.h Thu Aug 06 22:40:52 2009 +0900 @@ -6,11 +6,12 @@ public: MemorySegment* next; MemorySegment* prev; - uint32 size; + uint16 tag; + uint16 size; memaddr address; void* data; }; -typedef MemorySegment *MemorySegementPtr; +typedef MemorySegment *MemorySegmentPtr; #endif
--- a/TaskManager/kernel/schedule/SchedTask.cc Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Thu Aug 06 22:40:52 2009 +0900 @@ -572,4 +572,19 @@ __scheduler->show_dma_wait(); } + +MemorySegment * SchedTask::get_segment(memaddr addr, MemList *m) { + return __scheduler->get_segment(addr,m); +} + +void SchedTask::put_segment(MemorySegment *s) { + __scheduler->put_segment(s); +} + +void SchedTask::wait_segment(MemorySegment *s) { + __scheduler->wait_segment(s); +} + + + /* end */
--- a/TaskManager/kernel/schedule/SchedTask.h Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Thu Aug 06 22:40:52 2009 +0900 @@ -133,6 +133,13 @@ void mainMem_wait(); void* mainMem_get(int id); + MemorySegment * get_segment(memaddr addr, MemList *m); + uint32 get_tag(); + void put_segment(MemorySegment *s); + void wait_segment(MemorySegment *s); + + + void *allocate(int size); void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask);
--- a/TaskManager/kernel/schedule/Scheduler.cc Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Thu Aug 06 22:40:52 2009 +0900 @@ -374,7 +374,7 @@ memory directory にあるべきだが... */ -MemorySegement * +MemorySegment * Scheduler::get_segment(memaddr addr, MemList *m) { MemorySegment *s = hash->get(addr); @@ -388,8 +388,8 @@ m->moveToFirst(s); memaddr old_addr = s->address; - s->tag = getTag(); - smanager->dma_load(s->data, addr, + s->tag = get_tag(); + dma_load(s->data, addr, s->size, s->tag); /* 前のをhashから削除 */ hash->remove(old_addr); @@ -421,7 +421,7 @@ void Scheduler::put_segment(MemorySegment *s) { - smanager->dma_store(s->data, s->addr, + dma_store(s->data, s->address, s->size, s->tag); } @@ -433,9 +433,9 @@ */ void -Scheduelr::wait_segment(MemorySegment *s) +Scheduler::wait_segment(MemorySegment *s) { - smanager->dma_wait(s->tag); + dma_wait(s->tag); } /* end */
--- a/TaskManager/kernel/schedule/Scheduler.h Thu Aug 06 19:31:51 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Thu Aug 06 22:40:52 2009 +0900 @@ -9,6 +9,7 @@ #include "SchedTaskList.h" #include "TaskGroup.h" #include "MemList.h" +#include "MemHash.h" #define MAX_USER_TASK 32 #define MAX_SYSTEM_TASK 2 @@ -28,6 +29,7 @@ /* variables */ int id; + MemHash *hash; // double buffering TaskListPtr buff_taskList[2]; @@ -135,6 +137,14 @@ virtual void mainMem_wait(void) {}; void *mainMem_get(int id); + MemorySegment * Scheduler::get_segment(memaddr addr, MemList *m); + 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);