1 | #ifndef I386PORT_H |
---|
2 | #define I386PORT_H |
---|
3 | |
---|
4 | int videodiscontinuityskip(struct dvbdev* node, int flag) |
---|
5 | { |
---|
6 | return 0; |
---|
7 | } |
---|
8 | |
---|
9 | void fbsave() |
---|
10 | { |
---|
11 | } |
---|
12 | |
---|
13 | void fbrestore() |
---|
14 | { |
---|
15 | } |
---|
16 | |
---|
17 | void setfbvarsize(struct fb* newnode) |
---|
18 | { |
---|
19 | if(newnode != NULL) |
---|
20 | newnode->varfbsize = newnode->width * newnode->height * newnode->colbytes; |
---|
21 | } |
---|
22 | |
---|
23 | void enablemanualblit() |
---|
24 | { |
---|
25 | } |
---|
26 | |
---|
27 | //flag 0 = no animation |
---|
28 | //flag 1 = animation |
---|
29 | void blitfb2(struct fb* fbnode, int flag) |
---|
30 | { |
---|
31 | int i = 0; |
---|
32 | |
---|
33 | if(fbnode == NULL) return; |
---|
34 | |
---|
35 | #ifdef NOFB |
---|
36 | if(status.rguidfd > -1) |
---|
37 | { |
---|
38 | unsigned char* buf = NULL; |
---|
39 | buf = scale(fbnode->fb, fbnode->width, fbnode->height, 4, 320, 240, 0); |
---|
40 | if(buf != NULL) |
---|
41 | { |
---|
42 | socksend(&status.rguidfd, (unsigned char*)buf, 320 * 240 * 4, 5000 * 1000); |
---|
43 | free(buf); buf = NULL; |
---|
44 | } |
---|
45 | } |
---|
46 | if(status.write_png == 1 && status.infobaraktiv == 0) |
---|
47 | { |
---|
48 | unsigned char* buf = NULL; |
---|
49 | buf = scale(fbnode->fb, fbnode->width, fbnode->height, 4, 320, 240, 0); |
---|
50 | if(buf != NULL) |
---|
51 | { |
---|
52 | if(writeFBfile.ActBuf == NULL) |
---|
53 | { |
---|
54 | writeFBfile.buf1 = malloc(4 * 320 * 240); |
---|
55 | writeFBfile.ActBuf = writeFBfile.buf1; |
---|
56 | memcpy(writeFBfile.buf1, (unsigned char*)buf, 4 * 320 * 240); |
---|
57 | addtimer(&fb2png_thread, START, 10000, 1, NULL, NULL, NULL); |
---|
58 | } |
---|
59 | else if(writeFBfile.buf1 == writeFBfile.ActBuf) |
---|
60 | { |
---|
61 | if(writeFBfile.buf2 == NULL) |
---|
62 | writeFBfile.buf2 = malloc(4 * 320 * 240); |
---|
63 | memcpy(writeFBfile.buf2, (unsigned char*)buf, 4 * 320 * 240); |
---|
64 | } |
---|
65 | else if(writeFBfile.buf2 == writeFBfile.ActBuf) |
---|
66 | { |
---|
67 | if(writeFBfile.buf1 == NULL) |
---|
68 | writeFBfile.buf1 = malloc(4 * 320 * 240); |
---|
69 | memcpy(writeFBfile.buf1, (unsigned char*)buf, 4 * 320 * 240); |
---|
70 | } |
---|
71 | //fb2png((unsigned char*)buf, 320, 240, "/tmp/titanlcd.png"); |
---|
72 | free(buf); buf = NULL; |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | if(fbnode != fb) |
---|
77 | { |
---|
78 | for(i = 0; i < fbnode->height; i++) |
---|
79 | { |
---|
80 | memcpy(fb->fb + (i * fb->pitch), fbnode->fb + (i * fbnode->pitch), fbnode->width * fbnode->colbytes); |
---|
81 | } |
---|
82 | } |
---|
83 | system("killall -9 xloadimage"); |
---|
84 | |
---|
85 | FILE *fd; |
---|
86 | fd=fopen("titan.png", "w"); |
---|
87 | fwrite(fb->fb, fb->varfbsize, 1, fd); |
---|
88 | fclose(fd); |
---|
89 | |
---|
90 | system("fbgrab -f titan.png -w 1280 -h 720 -b 32 titan1.png > /dev/null"); |
---|
91 | system("xloadimage titan1.png > /dev/null &"); |
---|
92 | #endif |
---|
93 | } |
---|
94 | |
---|
95 | void setfbtransparent(int value) |
---|
96 | { |
---|
97 | } |
---|
98 | |
---|
99 | int allocbpamem(size_t size, int *memfd, unsigned char **mem) |
---|
100 | { |
---|
101 | return -1; |
---|
102 | } |
---|
103 | |
---|
104 | void freebpamem(int memfd, unsigned char* mem, size_t len) |
---|
105 | { |
---|
106 | } |
---|
107 | |
---|
108 | //mode 0: with fill (draw to skinfb) |
---|
109 | //mode 1: without fill (draw to skinfb) |
---|
110 | //mode 2: with fill (draw to fb) |
---|
111 | //mode 3: without fill (draw to fb) |
---|
112 | void blitrect(int posx, int posy, int width, int height, long color, int transparent, int mode) |
---|
113 | { |
---|
114 | int y, x; |
---|
115 | unsigned long tmpcol; |
---|
116 | |
---|
117 | if(posx < 0) posx = 0; |
---|
118 | if(posx > skinfb->width) posx = skinfb->width; |
---|
119 | if(posy < 0) posy = 0; |
---|
120 | if(posy > skinfb->height) posy = skinfb->height; |
---|
121 | if(posx + width > skinfb->width) width = skinfb->width - posx; |
---|
122 | if(posy + height > skinfb->height) height = skinfb->height - posy; |
---|
123 | |
---|
124 | if(width <= 0 || height <= 0) return; |
---|
125 | |
---|
126 | transparent = (transparent - 255) * -1; |
---|
127 | tmpcol = color | ((transparent & 0xff) << 24); |
---|
128 | |
---|
129 | if(mode == 0 || mode == 2) |
---|
130 | { |
---|
131 | for(y = 0; y < height; y++) |
---|
132 | { |
---|
133 | for(x = 0; x < width; x++) |
---|
134 | { |
---|
135 | drawpixel(posx + x, posy + y, tmpcol); |
---|
136 | } |
---|
137 | } |
---|
138 | } |
---|
139 | else if(mode == 1 || mode == 3) |
---|
140 | { |
---|
141 | //topline |
---|
142 | for(x = 0; x < width; x++) |
---|
143 | drawpixel(posx + x, posy, tmpcol); |
---|
144 | //bottomline |
---|
145 | for(x = 0; x < width; x++) |
---|
146 | drawpixel(posx + x, posy + height - 1, tmpcol); |
---|
147 | //leftline |
---|
148 | for(y = 0; y < height; y++) |
---|
149 | drawpixel(posx, posy + y, tmpcol); |
---|
150 | //rightline |
---|
151 | for(y = 0; y < height; y++) |
---|
152 | drawpixel(posx + width - 1, posy + y, tmpcol); |
---|
153 | } |
---|
154 | } |
---|
155 | |
---|
156 | int readjpg(const char* filename, unsigned long* width, unsigned long* height, unsigned long* rowbytes, int* channels, unsigned char **mem, int *memfd) |
---|
157 | { |
---|
158 | return -1; |
---|
159 | } |
---|
160 | |
---|
161 | //flag 0: blit from accelfb to skinfb |
---|
162 | //flag 1: blit from skinfb to accelfb |
---|
163 | void blitscale(int posx, int posy, int width, int height, int scalewidth, int scaleheight, int flag) |
---|
164 | { |
---|
165 | } |
---|
166 | |
---|
167 | void blitjpg(unsigned char* buf, int posx, int posy, int width, int height, int scalewidth, int scaleheight, int mwidth, int mheight, int halign, int valign) |
---|
168 | { |
---|
169 | } |
---|
170 | |
---|
171 | void initsignal(struct sigaction* sa) |
---|
172 | { |
---|
173 | sigaction(SIGILL, sa, NULL); |
---|
174 | sigaction(SIGBUS, sa, NULL); |
---|
175 | sigaction(SIGFPE, sa, NULL); |
---|
176 | sigaction(SIGUSR1, sa, NULL); |
---|
177 | sigaction(SIGSEGV, sa, NULL); |
---|
178 | sigaction(SIGUSR2, sa, NULL); |
---|
179 | sigaction(SIGPIPE, sa, NULL); |
---|
180 | sigaction(SIGALRM, sa, NULL); |
---|
181 | sigaction(SIGSTKFLT, sa, NULL); |
---|
182 | sigaction(SIGABRT, sa, NULL); |
---|
183 | |
---|
184 | signal(SIGHUP, SIG_IGN); |
---|
185 | signal(SIGINT, SIG_IGN); |
---|
186 | signal(SIGTRAP, SIG_IGN); |
---|
187 | signal(SIGTERM, SIG_IGN); |
---|
188 | signal(SIGXCPU, SIG_IGN); |
---|
189 | signal(SIGXFSZ, SIG_IGN); |
---|
190 | signal(SIGVTALRM, SIG_IGN); |
---|
191 | signal(SIGPROF, SIG_IGN); |
---|
192 | signal(SIGPOLL, SIG_IGN); |
---|
193 | signal(SIGRTMAX, SIG_IGN); |
---|
194 | signal(SIGPWR, SIG_IGN); |
---|
195 | signal(SIGSYS, SIG_IGN); |
---|
196 | } |
---|
197 | |
---|
198 | void sighandler(int sig, struct sigcontext ctx) |
---|
199 | { |
---|
200 | switch(sig) |
---|
201 | { |
---|
202 | case SIGALRM: |
---|
203 | { |
---|
204 | err("got signal sigalrm but ignore it"); |
---|
205 | break; |
---|
206 | } |
---|
207 | case SIGPIPE: |
---|
208 | { |
---|
209 | err("got signal sigpipe but ignore it"); |
---|
210 | break; |
---|
211 | } |
---|
212 | case SIGUSR1: |
---|
213 | { |
---|
214 | //todo all configs |
---|
215 | reloadconfig(status.configfile); |
---|
216 | reloadconfig(getconfig("ownconfig", NULL)); |
---|
217 | break; |
---|
218 | } |
---|
219 | case SIGUSR2: //called if hanging mainthread detect |
---|
220 | { |
---|
221 | debugstack(sig, NULL, NULL); |
---|
222 | break; |
---|
223 | } |
---|
224 | case SIGILL: |
---|
225 | case SIGBUS: |
---|
226 | case SIGFPE: |
---|
227 | case SIGSEGV: |
---|
228 | case SIGSTKFLT: |
---|
229 | { |
---|
230 | //intel |
---|
231 | debugstack(sig, (void *)ctx.eip, NULL); |
---|
232 | err("got signal %d (%s), fault address 0x%lx from 0x%lx", sig, strsignal(sig), ctx.cr2, ctx.eip); |
---|
233 | |
---|
234 | if(getconfigint("saverun", NULL) == 1 && status.longjumpbuf != NULL) |
---|
235 | siglongjmp(status.longjumpbuf, 999); |
---|
236 | else |
---|
237 | exit(100); |
---|
238 | break; |
---|
239 | } |
---|
240 | } |
---|
241 | } |
---|
242 | |
---|
243 | #endif |
---|