Mercurial > hg > Game > Cerium
changeset 233:a314d8cd2082 draft
fix
line wrap: on
line diff
--- a/TaskManager/Cell/spe/SchedMail.cc Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Cell/spe/SchedMail.cc Sun Mar 29 21:13:17 2009 +0900 @@ -8,24 +8,15 @@ scheduler = sched; } -void -SchedMail::read(void) -{ - - __debug("[SchedMail:%s]\n", __FUNCTION__); - - params_addr = scheduler->mail_read(); - - __debug(" params_addr = 0x%x\n", params_addr); -} - SchedTaskBase* SchedMail::next(Scheduler *m, SchedTaskBase *p) { delete p; + + params_addr = scheduler->mail_read(); __debug("[SchedMail:%s]\n", __FUNCTION__); - // if 文なくすには・・・関数ポインタ? + if ((int)params_addr == MY_SPE_COMMAND_EXIT) { return new SchedExit(); } else {
--- a/TaskManager/Cell/spe/SchedTask.cc Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Cell/spe/SchedTask.cc Sun Mar 29 21:13:17 2009 +0900 @@ -9,6 +9,8 @@ extern Scheduler::TaskObject task_list[MAX_TASK_OBJECT]; +//#define NO_PIPELINE + SchedTask* createSchedTask(TaskPtr task) { @@ -47,8 +49,6 @@ */ SchedTask::~SchedTask(void) { - //printf("%p\n", this); - if (__flag_renewTask == SCHED_TASK_RENEW) { free(__inListData); free(__outListData); @@ -110,8 +110,10 @@ sizeof(ListData), DMA_READ_IN_LIST); __scheduler->dma_load(__outListData, (uint32)__task->outData, sizeof(ListData), DMA_READ_OUT_LIST); +#if defined(NO_PIPELINE) __scheduler->dma_wait(DMA_READ_IN_LIST); __scheduler->dma_wait(DMA_READ_OUT_LIST); +#endif __taskGroup = new TaskGroup; __taskGroup->command = __task->self; @@ -144,16 +146,23 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); - // wait for load inListData +#if !defined(NO_PIPELINE) __scheduler->dma_wait(DMA_READ_IN_LIST); + __scheduler->dma_wait(DMA_READ_OUT_LIST); +#endif + __writebuf = __scheduler->allocate(__outListData->size); + // 読むデータが一つもなければ無視 - if (__inListData->length < 1 || __inListData->size == 0) return; + if (__inListData->length == 0) return; // load Input Data __readbuf = __scheduler->allocate(__inListData->size); __scheduler->dma_loadList(__inListData, __readbuf, DMA_READ); + +#if defined(NO_PIPELINE) __scheduler->dma_wait(DMA_READ); +#endif (this->*ex_read)(); } @@ -163,22 +172,13 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); - // wait for load outListData - __scheduler->dma_wait(DMA_READ_OUT_LIST); - __writebuf = __scheduler->allocate(__outListData->size); - - __debug(" task->command = %d\n", __task->command); - __debug(" task->in_size = %d\n", __task->in_size); - __debug(" task->in_addr = 0x%x\n", __task->in_addr); - __debug(" task->out_addr = 0x%x\n", __task->out_addr); - __debug(" list->next = 0x%x\n", (unsigned int)__list->next); - __debug(" list->length = 0x%x\n", (unsigned int)__list->length); - +#if !defined(NO_PIPELINE) __scheduler->dma_wait(DMA_READ); +#endif //run(__readbuf, __writebuf); + (this->*run_func)(__readbuf, __writebuf); - (this->*run_func)(__readbuf, __writebuf); free(__readbuf); if (__taskGroup->status() != 0) { @@ -189,9 +189,13 @@ // 書き込む領域がなければ無視 - if (__outListData->size > 0 || __outListData->length > 0) { + if (__outListData->length > 0) { __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE); + +#if defined(NO_PIPELINE) __scheduler->dma_wait(DMA_WRITE); + free(__writebuf); +#endif } (this->*ex_exec)(); @@ -201,9 +205,11 @@ SchedTask::write(void) { __debug("[SchedTask:%s]\n", __FUNCTION__); - + +#if !defined(NO_PIPELINE) __scheduler->dma_wait(DMA_WRITE); free(__writebuf); +#endif if (__task->self == MY_SPE_NOP) return;
--- a/TaskManager/Cell/spe/SchedTaskList.cc Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Cell/spe/SchedTaskList.cc Sun Mar 29 21:13:17 2009 +0900 @@ -42,7 +42,6 @@ list = scheduler->get_curListBuf(); scheduler->dma_load(list, params_addr, sizeof(TaskList), DMA_READ_TASKLIST); - scheduler->dma_wait(DMA_READ_TASKLIST); } else { list = (TaskListPtr)params_addr; }
--- a/TaskManager/Test/test_render/SceneGraph.cpp Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraph.cpp Sun Mar 29 21:13:17 2009 +0900 @@ -343,7 +343,7 @@ tmp->texture_info.pixels_orig = (Uint32*)texture_image->pixels; tmp->texture_info.pixels = tapestry; tmp->texture_info.scale_max = scale; - + if (unlink(image_name)) { cout << "unlink error\n"; @@ -613,7 +613,7 @@ list[id_count-1].pixels_orig = (Uint32*)texture_image->pixels; list[id_count-1].pixels = tapestry; list[id_count-1].scale_max = scale; - + texture_id = id_count-1; if (unlink(image_name))
--- a/TaskManager/Test/test_render/Tapestry.h Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Test/test_render/Tapestry.h Sun Mar 29 21:13:17 2009 +0900 @@ -73,12 +73,6 @@ struct texture_block { }; -#if 0 -struct TileList { - TilePtr tile; - int tix1, tiy1, tix2, tiy2; -}; -#endif typedef struct { uint32 pixel[TEXTURE_BLOCK_SIZE]; // 8*8
--- a/TaskManager/Test/test_render/init_position.cpp Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Test/test_render/init_position.cpp Sun Mar 29 21:13:17 2009 +0900 @@ -14,6 +14,7 @@ sgroot->createFromXMLfile("xml_file/player.xml"); back = sgroot->createSceneGraph(BACK); + //back = sgroot->createSceneGraph(); player = sgroot->createSceneGraph(IDLE); //bullet = sgroot->createSceneGraph(BULEBULLET); @@ -25,12 +26,11 @@ back->addChild(player); for (int i = 0; i < 10; i++) { - enemy = sgroot->createSceneGraph(E_PLANE); - enemy->set_move_collision(enemy_move, enemy_collision); - enemy->xyz[0] = 50.0*i; - back->addChild(enemy); + enemy = sgroot->createSceneGraph(E_PLANE); + enemy->set_move_collision(enemy_move, enemy_collision); + enemy->xyz[0] = 50.0*i; + back->addChild(enemy); } - //bullet->set_move_collision(null_move, null_collision); sgroot->setSceneData(back); }
--- a/TaskManager/Test/test_render/spe/CreateSpan.cpp Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Test/test_render/spe/CreateSpan.cpp Sun Mar 29 21:13:17 2009 +0900 @@ -384,6 +384,7 @@ (int)(span->tex_width*tex_x_len), (int)(span->tex_height*tex_y_len), tex_info->scale_max); + //scale = tex_info->scale_max; uint32 *tapestry = getTapestry(tex_info->width, tex_info->height, scale, @@ -393,7 +394,10 @@ span->tex_height = tex_info->height/scale; } #else - + + /** + * SIMD 荐菴違綽 + */ #endif
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Sun Mar 29 21:13:17 2009 +0900 @@ -374,6 +374,23 @@ //printf("%d\n", js); } +/** + * 激 1 紊с Span + * + * ャ∽(drawLine1) с + * : ≪ SPE 筝 Tile pixel + * : 篁ュт DMA load + * : drawLine2 т羂祉 + * cc筝頫c + * 篁 drawLine1 load -> wait -> rendering c障 + * (rendering crendering buffer 吾莨若 + * 障 main memory (frame buffer) dma store с) + * + * @param span Span + * @param startx 脂紮膀 + * @param endx 紫篋膀 + * @return span 篏臀障 rendering 腟c x 綺ф + */ int DrawSpan::drawLine1(SpanPtr span, int startx, int endx, int wait_tag) { @@ -433,12 +450,11 @@ tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - //set_rgb(tex_addr, wait_tag); - //ret = j; - //continue; - if (!isAvailableTile(tex_addr)) { #if 0 + // span 綽荀с tile 篋括 + // set_rgbs ц医 load + // 障筝c tex_x = tex1*(x_len-1-js)/(x_len-1) + tex2*js/(x_len-1); if (tex_x > 1) tex_x = 1; if (tex_x < 0) tex_x = 0; @@ -452,9 +468,6 @@ #else set_rgb(tex_addr, wait_tag); smanager->dma_wait(wait_tag); - ret = j; - //j -= 3; - continue; #endif } @@ -466,6 +479,17 @@ return ret; } +/** + * 激 1 紊с Span (2罧級) + * + * 筝drawLine2 篁с + * 罩g∈js startx ~ endx 膀峨紮c + * + * @param span Span + * @param startx 脂紮膀 + * @param endx 紫篋膀 + * @param js (drawLine1) span 障хc + */ void DrawSpan::drawLine2(SpanPtr span, int startx, int endx, int js, int wait_tag) { @@ -595,6 +619,9 @@ span = &spack->span[t]; + /** + * span 激cdrawLine drawDot 御 + */ next_span_x = (this->*drawFunc1[(span->length_x != 1)])( span, rangex_start, rangex_end, tl_tag[tl_tag_flg1]); @@ -613,9 +640,10 @@ tl_tag_flg2 ^= 1; } - (this->*drawFunc2[(resume_span->length_x != 1)])( - resume_span, rangex_start, rangex_end, resume_span_x, - tl_tag[tl_tag_flg1]); + // 憜 drawLine2drawDot2 罘純 + //(this->*drawFunc2[(resume_span->length_x != 1)])( + //resume_span, rangex_start, rangex_end, resume_span_x, + //tl_tag[tl_tag_flg1]); smanager->dma_wait(SPAN_PACK_LOAD);
--- a/TaskManager/Test/test_render/task/CreateSpan.cpp Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Test/test_render/task/CreateSpan.cpp Sun Mar 29 21:13:17 2009 +0900 @@ -161,13 +161,13 @@ if (tex_base > base) { int t_scale = tex_base/base; - while (t_scale >>= 1) { scale <<= 1; } } return (scale > scale_max) ? scale_max : scale; + //return scale_max; } /** @@ -373,6 +373,7 @@ span->tex_y1 = start_tex_y; span->tex_y2 = end_tex_y; + float tex_x_len = span->tex_x2 - span->tex_x1; /** @@ -383,17 +384,20 @@ (int)(span->tex_width*tex_x_len), (int)(span->tex_height*tex_y_len), tex_info->scale_max); + //scale = tex_info->scale_max; uint32 *tapestry = getTapestry(tex_info->width, tex_info->height, scale, tex_info->addr); - span->tex_addr = tapestry; span->tex_width = tex_info->width/scale; span->tex_height = tex_info->height/scale; } #else - + + /** + * SIMD 荐菴違綽 + */ #endif
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/Test/test_render/task/DrawSpan.cpp Sun Mar 29 21:13:17 2009 +0900 @@ -1,5 +1,6 @@ #include <stdlib.h> #include <string.h> +#include <spu_intrinsics.h> #include "DrawSpan.h" #include "polygon_pack.h" #include "texture.h" @@ -19,6 +20,31 @@ free((void*)((int)linebuf*doneWrite)); } +inline vector float +spu_re_nrm(vector float a) +{ + vector float unit = (vector float){1.0, 1.0, 1.0, 1.0}; + vector float approximation; + + approximation = spu_re(a); + return spu_madd(spu_nmsub(approximation, a, unit), + approximation, approximation); +} + + +vector signed int +getLocalPositionVec(vector signed int d, signed int offset) +{ + return spu_and(d, spu_splats(offset-1)); +} + +vector signed int +getLocalXVec(vector signed int x) +{ + return getLocalPositionVec(x, split_screen_w); +} + + /** * 鴻cTEXTURE_SPLIT_PIXEL^2 蚊 * @@ -110,9 +136,20 @@ float *buf = (float*)smanager->allocate(sizeof(float)*width*height); float def = 65535.0f; +#if 0 for (int i = 0; i < width*height; i++) { buf[i] = def; } +#else + vector float init = spu_splats(0.0f); + vector float defi = spu_splats(def); + + for (int i = 0; i < width*height; i += 4) { + vector float *out = (vector float *)&buf[i]; + + *out = spu_add(init, defi); + } +#endif return buf; } @@ -148,9 +185,6 @@ tile->texture_addr = addr; int index = hash->put(tile->texture_addr, tile); - if (index < 0) { - printf("haosa\n"); - } smanager->dma_load(tile->pixel, (uint32)addr, sizeof(uint32)*TEXTURE_BLOCK_SIZE, tag); } @@ -315,8 +349,7 @@ tex_xpos = (int)((span->tex_width-1) * tex); tex_ypos = (int)((span->tex_height-1) * tey); - if (0 < zpos && zpos < zRow[localx + (rangex*localy)]) { - //if (zpos < zRow[localx + (rangex*localy)]) { + if (zpos < zRow[localx + (rangex*localy)]) { tex_addr = getTile(tex_xpos, tex_ypos, span->tex_width, span->tex_addr); tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; @@ -341,6 +374,23 @@ //printf("%d\n", js); } +/** + * 激 1 紊с Span + * + * ャ∽(drawLine1) с + * : ≪ SPE 筝 Tile pixel + * : 篁ュт DMA load + * : drawLine2 т羂祉 + * cc筝頫c + * 篁 drawLine1 load -> wait -> rendering c障 + * (rendering crendering buffer 吾莨若 + * 障 main memory (frame buffer) dma store с) + * + * @param span Span + * @param startx 脂紮膀 + * @param endx 紫篋膀 + * @return span 篏臀障 rendering 腟c x 綺ф + */ int DrawSpan::drawLine1(SpanPtr span, int startx, int endx, int wait_tag) { @@ -376,36 +426,35 @@ float tex_x, tex_y, tex_z; localx = getLocalX(x-1+j); + tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); + + 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; + if (tex_y < 0) tex_y = 0; + tex_xpos = (int)((span->tex_width-1) * tex_x); + tex_ypos = (int)((span->tex_height-1) * tex_y); - if (0 < tex_z && tex_z < zRow[localx + (rangex*localy)]) { - //if (tex_z < zRow[localx + (rangex*localy)]) { + if (tex_z < zRow[localx + (rangex*localy)]) { // (tex_xpos, tex_ypos) Tile (筝喝)с綺ф // ≪(MainMemory) uint32 *tex_addr; int tex_localx; int tex_localy; - 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; - if (tex_y < 0) tex_y = 0; - tex_xpos = (int)((span->tex_width-1) * tex_x); - tex_ypos = (int)((span->tex_height-1) * tex_y); - tex_addr = getTile(tex_xpos, tex_ypos, span->tex_width, span->tex_addr); tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - - //set_rgb(tex_addr, wait_tag); - //ret = j; - //continue; if (!isAvailableTile(tex_addr)) { #if 0 + // span 綽荀с tile 篋括 + // set_rgbs ц医 load + // 障筝c tex_x = tex1*(x_len-1-js)/(x_len-1) + tex2*js/(x_len-1); if (tex_x > 1) tex_x = 1; if (tex_x < 0) tex_x = 0; @@ -418,9 +467,7 @@ return js; #else set_rgb(tex_addr, wait_tag); - //ret = j; smanager->dma_wait(wait_tag); - //continue; #endif } @@ -432,6 +479,17 @@ return ret; } +/** + * 激 1 紊с Span (2罧級) + * + * 筝drawLine2 篁с + * 罩g∈js startx ~ endx 膀峨紮c + * + * @param span Span + * @param startx 脂紮膀 + * @param endx 紫篋膀 + * @param js (drawLine1) span 障хc + */ void DrawSpan::drawLine2(SpanPtr span, int startx, int endx, int js, int wait_tag) { @@ -484,8 +542,7 @@ tex_xpos = (int)((span->tex_width-1) * tex_x); tex_ypos = (int)((span->tex_height-1) * tex_y); - if (0 < tex_z && tex_z < zRow[localx + (rangex*localy)]) { - //if (tex_z < zRow[localx + (rangex*localy)]) { + if (tex_z < zRow[localx + (rangex*localy)]) { tex_addr = getTile(tex_xpos, tex_ypos, span->tex_width, span->tex_addr); tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; @@ -531,7 +588,7 @@ tileList = (TileListPtr)smanager->global_get(GLOBAL_TILE_LIST); zRow = zRow_init(rangex, rangey); - //linebuf = linebuf_init(rangex, rangey, 0xffffffff); + //linebuf = linebuf_init(rangex, rangey, 0x00ffffff); linebuf = linebuf_init(rangex, rangey, 0); doneWrite = 0; @@ -562,6 +619,9 @@ span = &spack->span[t]; + /** + * span 激cdrawLine drawDot 御 + */ next_span_x = (this->*drawFunc1[(span->length_x != 1)])( span, rangex_start, rangex_end, tl_tag[tl_tag_flg1]); @@ -580,9 +640,10 @@ tl_tag_flg2 ^= 1; } - (this->*drawFunc2[(resume_span->length_x != 1)])( - resume_span, rangex_start, rangex_end, resume_span_x, - tl_tag[tl_tag_flg1]); + // 憜 drawLine2drawDot2 罘純 + //(this->*drawFunc2[(resume_span->length_x != 1)])( + //resume_span, rangex_start, rangex_end, resume_span_x, + //tl_tag[tl_tag_flg1]); smanager->dma_wait(SPAN_PACK_LOAD);
--- a/TaskManager/kernel/schedule/SchedMail.cc Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedMail.cc Sun Mar 29 21:13:17 2009 +0900 @@ -8,21 +8,12 @@ scheduler = sched; } -void -SchedMail::read(void) -{ - - __debug("[SchedMail:%s]\n", __FUNCTION__); - - params_addr = scheduler->mail_read(); - - __debug(" params_addr = 0x%x\n", params_addr); -} - SchedTaskBase* SchedMail::next(Scheduler *m, SchedTaskBase *p) { delete p; + + params_addr = scheduler->mail_read(); __debug("[SchedMail:%s]\n", __FUNCTION__); // if 文なくすには・・・関数ポインタ?
--- a/TaskManager/kernel/schedule/SchedTask.cc Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Sun Mar 29 21:13:17 2009 +0900 @@ -9,6 +9,8 @@ extern Scheduler::TaskObject task_list[MAX_TASK_OBJECT]; +//#define NO_PIPELINE + SchedTask* createSchedTask(TaskPtr task) { @@ -73,11 +75,11 @@ { __flag_renewTask = SCHED_TASK_RENEW; - ex_init = &SchedTask::ex_init_renew; - ex_read = &SchedTask::ex_read_renew; - ex_exec = &SchedTask::ex_exec_renew; - ex_write = &SchedTask::ex_write_renew; - ex_next = &SchedTask::ex_next_renew; + ex_init = &SchedTask::ex_init_renew; + ex_read = &SchedTask::ex_read_renew; + ex_exec = &SchedTask::ex_exec_renew; + ex_write = &SchedTask::ex_write_renew; + ex_next = &SchedTask::ex_next_renew; } void @@ -108,6 +110,10 @@ sizeof(ListData), DMA_READ_IN_LIST); __scheduler->dma_load(__outListData, (uint32)__task->outData, sizeof(ListData), DMA_READ_OUT_LIST); +#if defined(NO_PIPELINE) + __scheduler->dma_wait(DMA_READ_IN_LIST); + __scheduler->dma_wait(DMA_READ_OUT_LIST); +#endif __taskGroup = new TaskGroup; __taskGroup->command = __task->self; @@ -140,16 +146,24 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); - // wait for load inListData +#if !defined(NO_PIPELINE) __scheduler->dma_wait(DMA_READ_IN_LIST); + __scheduler->dma_wait(DMA_READ_OUT_LIST); +#endif + __writebuf = __scheduler->allocate(__outListData->size); + // 読むデータが一つもなければ無視 - if (__inListData->length < 1 || __inListData->size == 0) return; + if (__inListData->length == 0) return; // load Input Data __readbuf = __scheduler->allocate(__inListData->size); __scheduler->dma_loadList(__inListData, __readbuf, DMA_READ); +#if defined(NO_PIPELINE) + __scheduler->dma_wait(DMA_READ); +#endif + (this->*ex_read)(); } @@ -158,22 +172,13 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); - // wait for load outListData - __scheduler->dma_wait(DMA_READ_OUT_LIST); - __writebuf = __scheduler->allocate(__outListData->size); - - __debug(" task->command = %d\n", __task->command); - __debug(" task->in_size = %d\n", __task->in_size); - __debug(" task->in_addr = 0x%x\n", __task->in_addr); - __debug(" task->out_addr = 0x%x\n", __task->out_addr); - __debug(" list->next = 0x%x\n", (unsigned int)__list->next); - __debug(" list->length = 0x%x\n", (unsigned int)__list->length); - +#if !defined(NO_PIPELINE) __scheduler->dma_wait(DMA_READ); +#endif //run(__readbuf, __writebuf); + (this->*run_func)(__readbuf, __writebuf); - (this->*run_func)(__readbuf, __writebuf); free(__readbuf); if (__taskGroup->status() != 0) { @@ -182,6 +187,17 @@ __taskGroup = NULL; } + + // 書き込む領域がなければ無視 + if (__outListData->length > 0) { + __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE); + +#if defined(NO_PIPELINE) + __scheduler->dma_wait(DMA_WRITE); + free(__writebuf); +#endif + } + (this->*ex_exec)(); } @@ -189,12 +205,15 @@ SchedTask::write(void) { __debug("[SchedTask:%s]\n", __FUNCTION__); - + +#if !defined(NO_PIPELINE) + __scheduler->dma_wait(DMA_WRITE); + free(__writebuf); +#endif - // 書き込む領域がなければ無視 - if (__outListData->size > 0 || __outListData->length > 0) { - __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE); - } + if (__task->self == MY_SPE_NOP) return; + + (this->*ex_write)(); } /** @@ -282,11 +301,6 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); - __scheduler->dma_wait(DMA_WRITE); - free(__writebuf); - - (this->*ex_write)(); - delete p; return (this->*ex_next)();
--- a/TaskManager/kernel/schedule/SchedTaskList.cc Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskList.cc Sun Mar 29 21:13:17 2009 +0900 @@ -42,7 +42,6 @@ list = scheduler->get_curListBuf(); scheduler->dma_load(list, params_addr, sizeof(TaskList), DMA_READ_TASKLIST); - scheduler->dma_wait(DMA_READ_TASKLIST); } else { list = (TaskListPtr)params_addr; } @@ -57,6 +56,8 @@ delete p; + scheduler->dma_wait(DMA_READ_TASKLIST); + if (list->length < 1) { nextSched = new SchedNop2Ready(scheduler);
--- a/TaskManager/kernel/schedule/Scheduler.cc Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Sun Mar 29 21:13:17 2009 +0900 @@ -151,7 +151,7 @@ TaskListPtr list = renewTop_taskList; renewTop_taskList = renewTop_taskList->next; renewCur_taskList = NULL; - + list->next = NULL; SchedTaskList *sched = createSchedTaskList((uint32)list, this, SCHED_TASKLIST_RENEW);
--- a/TaskManager/kernel/schedule/TaskGroup.cc Tue Feb 24 15:28:51 2009 +0900 +++ b/TaskManager/kernel/schedule/TaskGroup.cc Sun Mar 29 21:13:17 2009 +0900 @@ -29,7 +29,12 @@ } } - +/** + * TaskGroup Task 罧c NULL 菴 + * 帥鴻腟篋違 TaskGroup 篏c + * (筝帥鴻帥鴻茵c)帥鴻 PPE 菴鴻c + * command 菴 + */ unsigned int TaskGroup::status(void) { /**
--- a/example/many_task/spe/QuickSort.cc Tue Feb 24 15:28:51 2009 +0900 +++ b/example/many_task/spe/QuickSort.cc Sun Mar 29 21:13:17 2009 +0900 @@ -1,6 +1,7 @@ #include "QuickSort.h" #include <stdio.h> #include <string.h> +#include "SpeProfile.h" SchedDefineTask(QuickSort); @@ -10,11 +11,16 @@ int end = smanager->get_param(0); DataPtr r_data = (DataPtr)smanager->get_input(0); DataPtr w_data = (DataPtr)smanager->get_output(0); + //SpeProfile *prof = new SpeProfile; + //prof->ProfStart(); quick_sort(r_data, begin, end-1); //bubble_sort(r_data, begin, end-1); memcpy(w_data, r_data, sizeof(Data)*end); + //prof->ProfStop(); + //prof->ProfPrint(); + //delete prof; return 0; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/many_task/spe/SpeProfile.cc Sun Mar 29 21:13:17 2009 +0900 @@ -0,0 +1,35 @@ +/** + * SPU Decrementerを用いた処理時間計測 + */ + +#include "SpeProfile.h" +/* DMA転送に関する関数を使用するために必要なインクルードファイル */ +#include <spu_intrinsics.h> +#include <stdio.h> + +/* SPU Decrementerの初期値 */ +#define SPU_DECREMENTER_INITIAL_VALUE 0x7FFFFFFFU + +SpeProfile::SpeProfile(void): profile(0) {} + +void SpeProfile::ProfStart(void) +{ + /* SPU Decrementerに初期値を設定 */ + spu_writech(SPU_WrDec, SPU_DECREMENTER_INITIAL_VALUE); + + /* 計測開始時間をSPU Decrementerから読み取る */ + profile = spu_readch(SPU_RdDec); +} + +void SpeProfile::ProfStop(void) +{ + /* 計測終了時間をSPU Decrementerから読み取り, 計測開始時間との差を計算 */ + profile -= spu_readch(SPU_RdDec); +} + +void SpeProfile::ProfPrint(void) +{ + /* 処理時間を出力 */ + printf("SPE time by SPU Decrementer: %f\n", + profile / 79800000.0f * 1000.0f); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/many_task/spe/SpeProfile.h Sun Mar 29 21:13:17 2009 +0900 @@ -0,0 +1,12 @@ +class SpeProfile { +public: + SpeProfile(void); + + unsigned int profile; + + void ProfStart(void); + void ProfStop(void); + void ProfPrint(void); + unsigned int ProfGet(void); + void ProfPrint(unsigned int time); +};
--- a/include/TaskManager/DmaManager.h Tue Feb 24 15:28:51 2009 +0900 +++ b/include/TaskManager/DmaManager.h Sun Mar 29 21:13:17 2009 +0900 @@ -14,11 +14,11 @@ #endif enum dma_tag { - DMA_READ_TASKLIST = 27, - DMA_READ_IN_LIST = 28, - DMA_READ_OUT_LIST = 29, - DMA_READ = 30, - DMA_WRITE = 31, + DMA_READ = 25, + DMA_WRITE = 27, + DMA_READ_IN_LIST = 29, + DMA_READ_OUT_LIST = 30, + DMA_READ_TASKLIST = 31, }; class DmaManager {
--- a/include/TaskManager/SchedMail.h Tue Feb 24 15:28:51 2009 +0900 +++ b/include/TaskManager/SchedMail.h Sun Mar 29 21:13:17 2009 +0900 @@ -27,10 +27,10 @@ Scheduler* scheduler; /* functions */ - void read(void); SchedTaskBase* next(Scheduler *, SchedTaskBase *); #if DEBUG + void read(void) { __debug("[SchedMail:%s]\n", __FUNCTION__); } void exec(void) { __debug("[SchedMail:%s]\n", __FUNCTION__); } void write(void) { __debug("[SchedMail:%s]\n", __FUNCTION__); } #endif