Mercurial > hg > Members > kono > Cerium
changeset 79:83b57e03d3ef
*** empty log message ***
author | gongo |
---|---|
date | Tue, 19 Feb 2008 17:28:04 +0900 |
parents | 3c6dec161ade |
children | 1c648675c2bd |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Test/simple_render/Makefile TaskManager/Test/simple_render/main.cpp TaskManager/Test/simple_render/spe/Makefile TaskManager/Test/simple_render/spe/spe-main.cpp TaskManager/Test/simple_render/viewer.cpp TaskManager/kernel/ppe/BufferManager.cc TaskManager/kernel/ppe/HTaskInfo.cc TaskManager/kernel/ppe/TaskManager.cc TaskManager/kernel/ppe/TaskManagerImpl.cc include/TaskManager/BufferManager.h include/TaskManager/HTaskInfo.h include/TaskManager/TaskManager.h include/TaskManager/TaskManagerImpl.h |
diffstat | 14 files changed, 85 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Tue Feb 19 17:28:04 2008 +0900 @@ -51,6 +51,7 @@ task = &list->tasks[list->length++]; task->command = htask->command; +#if 0 // Fix me !!!!! // ださいというか動かないだろこれ。 // かっこいい class 判定がないものか。typeinfoだっけ? @@ -65,6 +66,10 @@ } else { task->out_addr = 0; } +#else + task->in_addr = htask->in_addr; + task->out_addr = htask->out_addr; +#endif task->in_size = htask->in_size; task->self = htask;
--- a/TaskManager/Test/simple_render/Makefile Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/Test/simple_render/Makefile Tue Feb 19 17:28:04 2008 +0900 @@ -18,6 +18,7 @@ LIBS = `sdl-config --libs` -lSDL_image -lGL \ `xml2-config --libs` -L../.. $(EXTRA_LIBS) + .SUFFIXES: .cpp .o .cpp.o:
--- a/TaskManager/Test/simple_render/main.cpp Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/Test/simple_render/main.cpp Tue Feb 19 17:28:04 2008 +0900 @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) { - manager = new TaskManager(1); + manager = new TaskManager(3); manager->init(); task_initialize();
--- a/TaskManager/Test/simple_render/spe/Makefile Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/Test/simple_render/spe/Makefile Tue Feb 19 17:28:04 2008 +0900 @@ -4,9 +4,9 @@ OBJS = $(SRCS:.cpp=.o) CC = spu-g++ -CFLAGS = #-O9 #-g -Wall# -DDEBUG +CFLAGS = -O9 #-g -Wall# -DDEBUG INCLUDE = -I../../../../include/TaskManager -I. -I.. -LIBS = -L../../.. -lspemanager +LIBS = -L../../.. -lspemanager# -lm .SUFFIXES: .cpp .o
--- a/TaskManager/Test/simple_render/spe/spe-main.cpp Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/Test/simple_render/spe/spe-main.cpp Tue Feb 19 17:28:04 2008 +0900 @@ -1,6 +1,6 @@ -#include <stdio.h> #include <string.h> -#include <math.h> +//#include <simdmath.h> +#include <simdmath/sinf4.h> #include "polygon_pack.h" #include "scene_graph_pack.h" #include "sys.h" @@ -82,9 +82,9 @@ for(int i=0; i<4; i++) { - //xyz[i] = abc[0]*rot[i] + abc[1]*rot[i+4] + abc[2]*rot[i+8] + abc[3]*rot[i+12]; - xyz[i] = abc[0]*matrix[i] + abc[1]*matrix[i+4] + abc[2]*matrix[i+8] + abc[3]*matrix[i+12]; + xyz[i] = abc[0]*matrix[i] + abc[1]*matrix[i+4] + abc[2]*matrix[i+8] + abc[3]*matrix[i+12]; } + } void get_matrix( float *matrix, float *rxyz, float *txyz, float *stack) @@ -94,12 +94,28 @@ rady = rxyz[1]*3.14/180; radz = rxyz[2]*3.14/180; +#if 1 + vector float rad = (vector float){radx, rady, radz, 0}; + vector float in_sin = _sinf4(rad); + vector float in_cos = _sinf4(rad); + float *sin_d = (float *)&in_sin; + float *cos_d = (float *)&in_cos; + + float sinx = sin_d[0]; + float cosx = cos_d[0]; + float siny = sin_d[1]; + float cosy = cos_d[1]; + float sinz = sin_d[2]; + float cosz = cos_d[2]; + +#else float sinx = sin(radx); float cosx = cos(radx); float siny = sin(rady); float cosy = cos(rady); float sinz = sin(radz); float cosz = cos(radz); +#endif matrix[0] = cosz*cosy+sinz*sinx*siny; matrix[1] =sinz*cosx; @@ -137,6 +153,8 @@ //update_sgp(SceneGraphPack *sgp, SceneGraphPack *_sgp) update_sgp(void *rbuf, void *wbuf) { +#if 0 + SceneGraphPack *sgp = (SceneGraphPack*)rbuf; SceneGraphPack *_sgp = (SceneGraphPack*)wbuf; @@ -173,6 +191,8 @@ // in/out と update は分ける必要ある? // それはユーザ側で in/out になるように書かせるもの? memcpy(_sgp, sgp, sizeof(SceneGraphPack)); + +#endif return sizeof(SceneGraphPack); }
--- a/TaskManager/Test/simple_render/viewer.cpp Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/Test/simple_render/viewer.cpp Tue Feb 19 17:28:04 2008 +0900 @@ -1,8 +1,5 @@ #include <iostream> #include <SDL.h> -#include <SDL_opengl.h> -#include <math.h> -#include <unistd.h> #include "polygon.h" #include "viewer.h" #include "sys.h" @@ -222,10 +219,10 @@ SDL_PixelFormat *pixelFormat; Uint32 background; Polygon *polygon; -//SceneGraphPack *sgp; -//PolygonPack *pp; -DmaBuffer *sgp_buff __attribute__((aligned(DEFAULT_ALIGNMENT))); -DmaBuffer *pp_buff __attribute__((aligned(DEFAULT_ALIGNMENT))); +SceneGraphPack *sgp; +PolygonPack *pp; +//DmaBuffer *sgp_buff __attribute__((aligned(DEFAULT_ALIGNMENT))); +//DmaBuffer *pp_buff __attribute__((aligned(DEFAULT_ALIGNMENT))); void Viewer::run_init() @@ -245,6 +242,7 @@ polygon->set_data("cube.xml"); polygon->viewer = this; +#if 0 // 通信用 buffer の allocate // これじゃないと通信用に使えない(ように処理を書かないと!) sgp_buff = manager->allocate(sizeof(SceneGraphPack)); @@ -258,6 +256,12 @@ sgp_buff->swap_buffer(); pp_buff = manager->allocate(sizeof(PolygonPack)); +#else + sgp = new SceneGraphPack; + create_sgp(polygon, sgp); + + pp = new PolygonPack; +#endif pixels = new Uint32[width*height]; @@ -307,17 +311,19 @@ fd = manager->open("ViewerRunDraw"); task_update_sgp = manager->create_task(fd_update_sgp, sizeof(SceneGraphPack), - sgp_buff, sgp_buff, NULL); + //sgp_buff, sgp_buff, NULL); + (unsigned int)sgp, (unsigned int)sgp, NULL); task_create_pp = manager->create_task(fd_create_pp, sizeof(SceneGraphPack), - sgp_buff, pp_buff, NULL); + //sgp_buff, pp_buff, NULL); + (unsigned int)sgp, (unsigned int)pp, NULL); task = manager->create_task(fd, 0, 0, 0, NULL); task->set_depend(task_update_sgp); task->set_depend(task_create_pp); //task_update_sgp->set_cpu(CPU_SPE); - task_create_pp->set_cpu(CPU_SPE); + //task_create_pp->set_cpu(CPU_SPE); task_update_sgp->spawn(); task_create_pp->spawn(); @@ -332,9 +338,9 @@ HTaskPtr task; int fd; - PolygonPack *pp; + //PolygonPack *pp; - pp_buff->get_buffer(&pp); + //pp_buff->get_buffer(&pp); polygon->draw(pp); // test draw of PolygonPack SDL_BlitSurface(bitmap, NULL, screen, NULL);
--- a/TaskManager/kernel/ppe/BufferManager.cc Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/kernel/ppe/BufferManager.cc Tue Feb 19 17:28:04 2008 +0900 @@ -28,7 +28,8 @@ } HTaskPtr -BufferManager::create_task(int cmd, int siz, DmaBuffer *in, DmaBuffer *out) +//BufferManager::create_task(int cmd, int siz, DmaBuffer *in, DmaBuffer *out) +BufferManager::create_task(int cmd, int siz, unsigned int in, unsigned int out) { return htaskImpl->create(cmd, siz, in, out); }
--- a/TaskManager/kernel/ppe/HTaskInfo.cc Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/kernel/ppe/HTaskInfo.cc Tue Feb 19 17:28:04 2008 +0900 @@ -45,7 +45,8 @@ } HTaskPtr -HTaskInfo::create(int cmd, int size, DmaBuffer *in_addr, DmaBuffer *out_addr) +//HTaskInfo::create(int cmd, int size, DmaBuffer *in_addr, DmaBuffer *out_addr) +HTaskInfo::create(int cmd, int size, unsigned int in_addr, unsigned int out_addr) { HTaskPtr q;
--- a/TaskManager/kernel/ppe/TaskManager.cc Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/kernel/ppe/TaskManager.cc Tue Feb 19 17:28:04 2008 +0900 @@ -49,8 +49,10 @@ */ HTaskPtr -TaskManager::create_task(int cmd, int size, DmaBuffer *in, - DmaBuffer *out, void (*func)(void)) +//TaskManager::create_task(int cmd, int size, DmaBuffer *in, +// DmaBuffer *out, void (*func)(void)) +TaskManager::create_task(int cmd, int size, unsigned int in, + unsigned int out, void (*func)(void)) { return m_impl->create_task(cmd, size, in, out, func); }
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Tue Feb 19 15:49:40 2008 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Tue Feb 19 17:28:04 2008 +0900 @@ -29,8 +29,10 @@ } HTaskPtr -TaskManagerImpl::create_task(int cmd, int size, DmaBuffer *in_addr, - DmaBuffer *out_addr, void (*func)(void)) +//TaskManagerImpl::create_task(int cmd, int size, DmaBuffer *in_addr, +// DmaBuffer *out_addr, void (*func)(void)) +TaskManagerImpl::create_task(int cmd, int size, unsigned int in_addr, + unsigned int out_addr, void (*func)(void)) { HTaskPtr new_task; @@ -105,6 +107,7 @@ task = &list->tasks[list->length++]; task->command = htask->command; +#if 0 // Fix me !!!!! // ださい // かっこいい class 判定がないものか。typeinfoだっけ? @@ -119,6 +122,11 @@ } else { task->out_addr = 0; } +#else + task->in_addr = htask->in_addr; + task->out_addr = htask->out_addr; +#endif + task->in_size = htask->in_size; task->self = htask;
--- a/include/TaskManager/BufferManager.h Tue Feb 19 15:49:40 2008 +0900 +++ b/include/TaskManager/BufferManager.h Tue Feb 19 17:28:04 2008 +0900 @@ -45,7 +45,8 @@ virtual void init(void); TaskQueuePtr create_taskQueue(HTaskPtr); - HTaskPtr create_task(int cmd, int siz, DmaBuffer *in, DmaBuffer *out); + //HTaskPtr create_task(int cmd, int siz, DmaBuffer *in, DmaBuffer *out); + HTaskPtr create_task(int cmd, int siz, unsigned int in, unsigned int out); void free_taskQueue(TaskQueuePtr); void free_task(HTaskPtr);
--- a/include/TaskManager/HTaskInfo.h Tue Feb 19 15:49:40 2008 +0900 +++ b/include/TaskManager/HTaskInfo.h Tue Feb 19 17:28:04 2008 +0900 @@ -18,10 +18,10 @@ struct htask { int command; int in_size; - //unsigned int in_addr; - //unsigned int out_addr; - DmaBuffer *in_addr; - DmaBuffer *out_addr; + unsigned int in_addr; + unsigned int out_addr; + //DmaBuffer *in_addr; + //DmaBuffer *out_addr; TaskQueuePtr wait_me; // List of task waiting for me TaskQueuePtr wait_i; // List of task for which I am waiting void (*post_func)(void); @@ -42,7 +42,8 @@ /* functions */ int init(int num); - HTaskPtr create(int cmd,int size,DmaBuffer *in_addr, DmaBuffer *out_addr); + //HTaskPtr create(int cmd,int size,DmaBuffer *in_addr, DmaBuffer *out_addr); + HTaskPtr create(int cmd,int size, unsigned int in_addr, unsigned int out_addr); void free(HTaskPtr q); private:
--- a/include/TaskManager/TaskManager.h Tue Feb 19 15:49:40 2008 +0900 +++ b/include/TaskManager/TaskManager.h Tue Feb 19 17:28:04 2008 +0900 @@ -21,8 +21,10 @@ /* functions */ void init(void); void finish(void); - HTaskPtr create_task(int cmd, int siz, DmaBuffer *in_addr, - DmaBuffer *out_addr, void (*func)(void)); + //HTaskPtr create_task(int cmd, int siz, DmaBuffer *in_addr, + //DmaBuffer *out_addr, void (*func)(void)); + HTaskPtr create_task(int cmd, int siz, unsigned int in_addr, + unsigned int out_addr, void (*func)(void)); //void set_task_depend(HTaskPtr master, HTaskPtr slave); //void spawn_task(HTaskPtr); void run(void);
--- a/include/TaskManager/TaskManagerImpl.h Tue Feb 19 15:49:40 2008 +0900 +++ b/include/TaskManager/TaskManagerImpl.h Tue Feb 19 17:28:04 2008 +0900 @@ -31,8 +31,10 @@ void run(void); virtual MailQueuePtr mail_check(MailQueuePtr mail_list); - HTaskPtr create_task(int cmd, int siz, DmaBuffer *in_addr, - DmaBuffer *out_addr, void (*func)(void)); + //HTaskPtr create_task(int cmd, int siz, DmaBuffer *in_addr, + //DmaBuffer *out_addr, void (*func)(void)); + HTaskPtr create_task(int cmd, int siz, unsigned int in_addr, + unsigned int out_addr, void (*func)(void)); void set_task_depend(HTaskPtr master, HTaskPtr slave); virtual TaskListPtr set_task(void); virtual void spawn_task(HTaskPtr);