00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _EFFECT_SPE_HPP_
00025 #define _EFFECT_SPE_HPP_
00026
00027 #include <libspe2.h>
00028 #include <pthread.h>
00029 #include "frz_pixbuf.hpp"
00030
00031 typedef int qword __attribute__((vector_size(16)));
00032
00033 #include "spu_engine.h"
00034
00035 #define SPE_COUNT 6
00036
00037 namespace Frz {
00038
00045 class CellGfx : public Pixbuf
00046 {
00047 public:
00054 CellGfx(int w, int h, bool allocPixbuf = false);
00055 ~CellGfx();
00056
00057 protected:
00065 void in_mbox_write(int i, uint32_t* array, int count);
00072 int out_mbox_status(int i) {
00073 return spe_out_mbox_status(thr[i].context);
00074 }
00081 uint32_t out_mbox_read(int i) {
00082 uint32_t ret;
00083 spe_out_mbox_read(thr[i].context, &ret, 1);
00084 return ret;
00085 }
00095 uint32_t out_intr_mbox_read(int i=0) {
00096 uint32_t ret;
00097 spe_out_intr_mbox_read(thr[i].context, &ret, 1, SPE_MBOX_ALL_BLOCKING);
00098 return ret;
00099 }
00100
00101 private:
00102 struct ThrData {
00103 pthread_t id;
00104 spe_context_ptr_t context;
00105 spe_data data __attribute((aligned(16)));
00106 };
00107
00108 ThrData thr[SPE_COUNT] __attribute((aligned(16)));
00109 static void * thread_main(void * arg);
00110 };
00111
00112 };
00113
00114 #endif