1 | #ifndef MIPSELPORT_H |
---|
2 | #define MIPSELPORT_H |
---|
3 | |
---|
4 | #ifndef FBIO_BLIT |
---|
5 | //#define FBIO_SET_MANUAL_BLIT _IOW('F', 0x20, __u32) |
---|
6 | #define FBIO_SET_MANUAL_BLIT _IOW('F', 0x21, __u8) |
---|
7 | #define FBIO_BLIT 0x22 |
---|
8 | #endif |
---|
9 | |
---|
10 | #ifndef FBIO_WAITFORVSYNC |
---|
11 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) |
---|
12 | #endif |
---|
13 | |
---|
14 | //fuer Funktion memcpy_word |
---|
15 | volatile char *memcpy_word_src; |
---|
16 | volatile char *memcpy_word_dest; |
---|
17 | volatile long memcpy_word_anzw = 0; |
---|
18 | |
---|
19 | //fuer Funktion memcpy_byte |
---|
20 | volatile char *memcpy_byte_src; |
---|
21 | volatile char *memcpy_byte_dest; |
---|
22 | volatile long memcpy_byte_anzb = 0; |
---|
23 | |
---|
24 | unsigned char *lfb = NULL; |
---|
25 | int g_manual_blit = 0; |
---|
26 | struct fb_fix_screeninfo fix_screeninfo; |
---|
27 | struct fb_var_screeninfo var_screeninfo; |
---|
28 | |
---|
29 | void memcpy_area(unsigned char* targetADDR, unsigned char* startADDR, long pxAbs, long hight, long widthAbs, long FBwidthAbs); |
---|
30 | |
---|
31 | int setmixer(struct dvbdev* node, int left, int right) |
---|
32 | { |
---|
33 | return audiosetmixer(node, left, right); |
---|
34 | } |
---|
35 | |
---|
36 | int setencoding(struct channel* chnode, struct dvbdev* videonode) |
---|
37 | { |
---|
38 | int ret = 1; |
---|
39 | if(chnode == NULL) return ret; |
---|
40 | |
---|
41 | switch(chnode->videocodec) |
---|
42 | { |
---|
43 | case MPEGV: |
---|
44 | ret = videosetstreamtype(videonode, 0); |
---|
45 | break; |
---|
46 | case MPEG4V: |
---|
47 | ret = videosetstreamtype(videonode, 4); |
---|
48 | break; |
---|
49 | case H264: |
---|
50 | ret = videosetstreamtype(videonode, 1); |
---|
51 | break; |
---|
52 | case VC1: |
---|
53 | ret = videosetstreamtype(videonode, 3); |
---|
54 | break; |
---|
55 | default: |
---|
56 | ret = videosetstreamtype(videonode, 0); |
---|
57 | } |
---|
58 | return ret; |
---|
59 | } |
---|
60 | |
---|
61 | int videodiscontinuityskip(struct dvbdev* node, int flag) |
---|
62 | { |
---|
63 | return 0; |
---|
64 | } |
---|
65 | |
---|
66 | void fbsave() |
---|
67 | { |
---|
68 | } |
---|
69 | |
---|
70 | void fbrestore() |
---|
71 | { |
---|
72 | } |
---|
73 | |
---|
74 | void setfbvarsize(struct fb* newnode) |
---|
75 | { |
---|
76 | if(newnode != NULL) |
---|
77 | newnode->varfbsize = 1920 * 1080 * newnode->colbytes; |
---|
78 | // newnode->varfbsize = 1920 * 1080 * (newnode->colbytes * 8); |
---|
79 | |
---|
80 | } |
---|
81 | |
---|
82 | void enablemanualblit() |
---|
83 | { |
---|
84 | unsigned char tmp = 1; |
---|
85 | if (ioctl(fb->fd, FBIO_SET_MANUAL_BLIT, &tmp)<0) |
---|
86 | perror("FBIO_SET_MANUAL_BLIT"); |
---|
87 | else |
---|
88 | g_manual_blit = 1; |
---|
89 | } |
---|
90 | |
---|
91 | void disablemanualblit() |
---|
92 | { |
---|
93 | unsigned char tmp = 0; |
---|
94 | if (ioctl(fb->fd, FBIO_SET_MANUAL_BLIT, &tmp)<0) |
---|
95 | perror("FBIO_SET_MANUAL_BLIT"); |
---|
96 | else |
---|
97 | g_manual_blit = 0; |
---|
98 | } |
---|
99 | |
---|
100 | void blit() |
---|
101 | { |
---|
102 | if (g_manual_blit == 1) { |
---|
103 | if (ioctl(fb->fd, FBIO_BLIT) < 0) |
---|
104 | perror("FBIO_BLIT"); |
---|
105 | } |
---|
106 | } |
---|
107 | |
---|
108 | int waitvsync() |
---|
109 | { |
---|
110 | int c = 0; |
---|
111 | return ioctl(fb->fd, FBIO_WAITFORVSYNC, &c); |
---|
112 | } |
---|
113 | |
---|
114 | void fbsetoffset(int x, int y) |
---|
115 | { |
---|
116 | struct fb_var_screeninfo var_screeninfo; |
---|
117 | |
---|
118 | var_screeninfo.xoffset = x; |
---|
119 | var_screeninfo.yoffset = y; |
---|
120 | |
---|
121 | if(ioctl(fb->fd, FBIOPAN_DISPLAY, &var_screeninfo) < 0) |
---|
122 | { |
---|
123 | perr("FBIOPAN_DISPLAY"); |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | //flag 0 = no animation |
---|
128 | //flag 1 = animation |
---|
129 | void blitfb2(struct fb* fbnode, int flag) |
---|
130 | { |
---|
131 | int doblit = 1; |
---|
132 | struct fb_var_screeninfo var_screeninfo; |
---|
133 | |
---|
134 | var_screeninfo.xres_virtual = fb->width; |
---|
135 | var_screeninfo.xres = fb->width; |
---|
136 | var_screeninfo.yres_virtual = fb->height * 2; |
---|
137 | var_screeninfo.yres = fb->height; |
---|
138 | var_screeninfo.height = 0; |
---|
139 | var_screeninfo.width = 0; |
---|
140 | var_screeninfo.xoffset = 0; |
---|
141 | var_screeninfo.yoffset = 0; |
---|
142 | var_screeninfo.bits_per_pixel = fb->colbytes * 8; |
---|
143 | |
---|
144 | switch(fb->colbytes) |
---|
145 | { |
---|
146 | case 2: |
---|
147 | var_screeninfo.transp.offset = 15; |
---|
148 | var_screeninfo.transp.length = 1; |
---|
149 | var_screeninfo.red.offset = 10; |
---|
150 | var_screeninfo.red.length = 5; |
---|
151 | var_screeninfo.green.offset = 5; |
---|
152 | var_screeninfo.green.length = 5; |
---|
153 | var_screeninfo.blue.offset = 0; |
---|
154 | var_screeninfo.blue.length = 5; |
---|
155 | break; |
---|
156 | case 4: |
---|
157 | var_screeninfo.transp.offset = 24; |
---|
158 | var_screeninfo.transp.length = 8; |
---|
159 | var_screeninfo.red.offset = 16; |
---|
160 | var_screeninfo.red.length = 8; |
---|
161 | var_screeninfo.green.offset = 8; |
---|
162 | var_screeninfo.green.length = 8; |
---|
163 | var_screeninfo.blue.offset = 0; |
---|
164 | var_screeninfo.blue.length = 8; |
---|
165 | break; |
---|
166 | } |
---|
167 | |
---|
168 | debug(444, "FB: line_length %d", fix_screeninfo.line_length); |
---|
169 | debug(444, "FB: var_screeninfo.xres %d", var_screeninfo.xres); |
---|
170 | debug(444, "FB: var_screeninfo.yres %d", var_screeninfo.yres); |
---|
171 | debug(444, "FB: var_screeninfo.xres_virt %d", var_screeninfo.xres_virtual); |
---|
172 | debug(444, "FB: var_screeninfo.yres_virt %d", var_screeninfo.yres_virtual); |
---|
173 | debug(444, "FB: var_screeninfo.xoffset %d", var_screeninfo.xoffset); |
---|
174 | debug(444, "FB: var_screeninfo.yoffset %d", var_screeninfo.yoffset); |
---|
175 | debug(444, "FB: var_screeninfo.bits_per_pixel %d", var_screeninfo.bits_per_pixel); |
---|
176 | debug(444, "FB: var_screeninfo.grayscale %d", var_screeninfo.grayscale); |
---|
177 | |
---|
178 | if(ioctl(fb->fd, FBIOPUT_VSCREENINFO, &var_screeninfo) < 0) |
---|
179 | { |
---|
180 | var_screeninfo.yres_virtual = fb->height; |
---|
181 | if(ioctl(fb->fd, FBIOPUT_VSCREENINFO, &var_screeninfo) < 0) |
---|
182 | { |
---|
183 | perr("FBIOPUT_VSCREENINFO"); |
---|
184 | } |
---|
185 | debug(444, "FB: double buffering not available"); |
---|
186 | } |
---|
187 | else |
---|
188 | { |
---|
189 | debug(444, "FB: double buffering available!"); |
---|
190 | } |
---|
191 | |
---|
192 | ioctl(fb->fd, FBIOGET_VSCREENINFO, &var_screeninfo); |
---|
193 | if ((var_screeninfo.xres!=fb->width) && (var_screeninfo.yres!=fb->height) && (var_screeninfo.bits_per_pixel!=fb->colbytes)) |
---|
194 | { |
---|
195 | debug(444, "SetMode failed: wanted: %dx%dx%d, got %dx%dx%d", |
---|
196 | fb->width, fb->height, fb->colbytes, |
---|
197 | var_screeninfo.xres, var_screeninfo.yres, var_screeninfo.bits_per_pixel); |
---|
198 | } |
---|
199 | |
---|
200 | int posx = 0; |
---|
201 | int posy = 0; |
---|
202 | int width = 0; |
---|
203 | int height = 0; |
---|
204 | |
---|
205 | if(status.bcm == 1 && status.usedirectfb == 0) |
---|
206 | { |
---|
207 | width = (fb->width - posx) - (getconfigint("fbrightoffset", NULL) * 5); |
---|
208 | height = (fb->height - posy) - (getconfigint("fbbottomoffset", NULL) * 5); |
---|
209 | posx = getconfigint("fbleftoffset", NULL) * 5; |
---|
210 | posy = getconfigint("fbtopoffset", NULL) * 5; |
---|
211 | } |
---|
212 | else |
---|
213 | { |
---|
214 | width = (720 - posx) - (getconfigint("fbrightoffset", NULL)); |
---|
215 | height = (576 - posy) - (getconfigint("fbbottomoffset", NULL)); |
---|
216 | posx = getconfigint("fbleftoffset", NULL); |
---|
217 | posy = getconfigint("fbtopoffset", NULL); |
---|
218 | } |
---|
219 | |
---|
220 | //printf("posx:%i posy:%i width:%i height:%i\n", posx, posy, width, height); |
---|
221 | |
---|
222 | int i = 0, max = 1, wstep = 0, hstep = 0; |
---|
223 | int dst_left = 0, dst_width = 0, dst_top = 0, dst_height = 0; |
---|
224 | int mode3d = 0; |
---|
225 | |
---|
226 | if(flag == 0) |
---|
227 | { |
---|
228 | if(status.bcm == 1 && status.usedirectfb == 0) |
---|
229 | bcm_accel_blit(skinfb->data_phys, skinfb->width, skinfb->height, skinfb->pitch, 0, fb->data_phys, fb->width, fb->height, fb->pitch, 0, 0, skinfb->width, skinfb->height, posx, posy, width, height, 0, 0); |
---|
230 | else |
---|
231 | blit(); |
---|
232 | } |
---|
233 | |
---|
234 | if(flag == 1 && status.screenanim > 0 && mode3d == 0) |
---|
235 | { |
---|
236 | doblit = 0; |
---|
237 | //max = 25; |
---|
238 | max = 8; |
---|
239 | dst_left = posx; |
---|
240 | dst_width = width; |
---|
241 | dst_top = posy; |
---|
242 | dst_height = height; |
---|
243 | |
---|
244 | char* fbleftdev = "/proc/stb/fb/dst_left"; |
---|
245 | char* fbwidthdev = "/proc/stb/fb/dst_width"; |
---|
246 | char* fbtopdev = "/proc/stb/fb/dst_top"; |
---|
247 | char* fbheightdev = "/proc/stb/fb/dst_height"; |
---|
248 | |
---|
249 | if(status.screenanim == 1 || status.screenanim == 3) |
---|
250 | { |
---|
251 | dst_left = (width / 2) - 1; |
---|
252 | dst_width = 2; |
---|
253 | } |
---|
254 | if(status.screenanim == 2 || status.screenanim == 3) |
---|
255 | { |
---|
256 | dst_top = (height / 2) - 1; |
---|
257 | dst_height = 2; |
---|
258 | } |
---|
259 | wstep = width / max; |
---|
260 | hstep = height / max; |
---|
261 | |
---|
262 | for(i = 0; i <= max; i++) |
---|
263 | { |
---|
264 | if(status.screenanim == 1 || status.screenanim == 3) |
---|
265 | { |
---|
266 | int tmpleft = dst_left - (wstep/2); |
---|
267 | int tmpwidth = dst_width + wstep; |
---|
268 | if(tmpleft < posx) |
---|
269 | tmpleft = posx; |
---|
270 | if(tmpwidth > width) |
---|
271 | tmpwidth = width; |
---|
272 | dst_left = tmpleft; |
---|
273 | dst_width = tmpwidth; |
---|
274 | } |
---|
275 | if(status.screenanim == 2 || status.screenanim == 3) |
---|
276 | { |
---|
277 | int tmptop = dst_top - (hstep/2); |
---|
278 | int tmpheight = dst_height + hstep; |
---|
279 | if(tmptop < posy) |
---|
280 | tmptop = posy; |
---|
281 | if(tmpheight > height) |
---|
282 | tmpheight = height; |
---|
283 | dst_top = tmptop; |
---|
284 | dst_height = tmpheight; |
---|
285 | } |
---|
286 | |
---|
287 | if((dst_width + dst_left) > width) |
---|
288 | dst_width = dst_width - dst_left; |
---|
289 | |
---|
290 | if((dst_height + dst_top) > height) |
---|
291 | dst_height = dst_height - dst_top; |
---|
292 | |
---|
293 | //printf("left:%i width:%i top:%i height:%i\n", dst_left, dst_width, dst_top, dst_height); |
---|
294 | //waitvsync(); |
---|
295 | if(status.bcm == 1 && status.usedirectfb == 0) |
---|
296 | bcm_accel_blit(skinfb->data_phys, skinfb->width, skinfb->height, skinfb->pitch, 0, fb->data_phys, fb->width, fb->height, fb->pitch, 0, 0, skinfb->width, skinfb->height, dst_left, dst_top, dst_width, dst_height, 0, 0); |
---|
297 | else |
---|
298 | { |
---|
299 | setfbosddev(fbleftdev, dst_left); |
---|
300 | setfbosddev(fbwidthdev, dst_width); |
---|
301 | setfbosddev(fbtopdev, dst_top); |
---|
302 | setfbosddev(fbheightdev, dst_height); |
---|
303 | usleep(1000); |
---|
304 | } |
---|
305 | if(status.screenanim > 0) usleep(status.screenanimspeed * 1000); |
---|
306 | blit(); |
---|
307 | } |
---|
308 | if(status.bcm == 1 && status.usedirectfb == 0) |
---|
309 | bcm_accel_blit(skinfb->data_phys, skinfb->width, skinfb->height, skinfb->pitch, 0, fb->data_phys, fb->width, fb->height, fb->pitch, 0, 0, skinfb->width, skinfb->height, posx, posy, width, height, 0, 0); |
---|
310 | else |
---|
311 | { |
---|
312 | setfbosddev(fbleftdev, posx); |
---|
313 | setfbosddev(fbwidthdev, width); |
---|
314 | setfbosddev(fbtopdev, posy); |
---|
315 | setfbosddev(fbheightdev, height); |
---|
316 | } |
---|
317 | blit(); |
---|
318 | } |
---|
319 | else |
---|
320 | bcm_accel_blit(skinfb->data_phys, skinfb->width, skinfb->height, skinfb->pitch, 0, fb->data_phys, fb->width, fb->height, fb->pitch, 0, 0, skinfb->width, skinfb->height, posx, posy, width, height, 0, 0); |
---|
321 | |
---|
322 | if(doblit == 1) |
---|
323 | blit(); |
---|
324 | |
---|
325 | /* |
---|
326 | int xRes, yRes, stride, bpp; |
---|
327 | |
---|
328 | xRes=var_screeninfo.xres; |
---|
329 | yRes=var_screeninfo.yres; |
---|
330 | bpp=var_screeninfo.bits_per_pixel; |
---|
331 | // fb_fix_screeninfo fix; |
---|
332 | // struct fb_fix_screeninfo fix_screeninfo; |
---|
333 | if (ioctl(fb->fd, FBIOGET_FSCREENINFO, &fix_screeninfo)<0) |
---|
334 | { |
---|
335 | perror("FBIOGET_FSCREENINFO"); |
---|
336 | printf("fb failed\n"); |
---|
337 | } |
---|
338 | stride=fix_screeninfo.line_length; |
---|
339 | memset(lfb, 0, stride*yRes); |
---|
340 | */ |
---|
341 | // blit(); |
---|
342 | |
---|
343 | /* |
---|
344 | int i = 0, max = 1, wstep = 0, hstep = 0, ret = 0; |
---|
345 | unsigned char buf[10]; |
---|
346 | |
---|
347 | if(fbnode == NULL) return; |
---|
348 | #ifndef NOHWBLIT |
---|
349 | if(fbnode == fb) return; |
---|
350 | |
---|
351 | if(status.rguidfd > -1) |
---|
352 | { |
---|
353 | m_lock(&status.accelfbmutex, 16); |
---|
354 | |
---|
355 | int zlen = 0; |
---|
356 | char* zbuf = NULL; |
---|
357 | blitscale(0, 0, fbnode->width, fbnode->height, 440, 330, 1); |
---|
358 | ret = ozip((char*)accelfb->fb, 440 * 330 * 4, &zbuf, &zlen, 1); |
---|
359 | |
---|
360 | if(ret == 0) |
---|
361 | { |
---|
362 | memset(buf, 0, 10); |
---|
363 | char* tmpnr = oitoa(zlen); |
---|
364 | memcpy(buf, tmpnr, strlen(tmpnr)); |
---|
365 | free(tmpnr); tmpnr = NULL; |
---|
366 | socksend(&status.rguidfd, buf, 10, 5000 * 1000); |
---|
367 | socksend(&status.rguidfd, (unsigned char*)zbuf, zlen, 5000 * 1000); |
---|
368 | } |
---|
369 | free(zbuf); zbuf = NULL; |
---|
370 | zlen = 0; |
---|
371 | |
---|
372 | m_unlock(&status.accelfbmutex, 16); |
---|
373 | } |
---|
374 | |
---|
375 | if(status.write_png == 1 && status.infobaraktiv == 0) |
---|
376 | { |
---|
377 | m_lock(&status.accelfbmutex, 16); |
---|
378 | blitscale(0, 0, fbnode->width, fbnode->height, 320, 240, 1); |
---|
379 | if(writeFBfile.ActBuf == NULL) |
---|
380 | { |
---|
381 | writeFBfile.buf1 = malloc(4 * 320 * 240); |
---|
382 | writeFBfile.ActBuf = writeFBfile.buf1; |
---|
383 | memcpy(writeFBfile.buf1, accelfb->fb, 4 * 320 * 240); |
---|
384 | addtimer(&fb2png_thread, START, 10000, 1, NULL, NULL, NULL); |
---|
385 | } |
---|
386 | else if(writeFBfile.buf1 == writeFBfile.ActBuf) |
---|
387 | { |
---|
388 | if(writeFBfile.buf2 == NULL) |
---|
389 | writeFBfile.buf2 = malloc(4 * 320 * 240); |
---|
390 | memcpy(writeFBfile.buf2, accelfb->fb, 4 * 320 * 240); |
---|
391 | } |
---|
392 | else if(writeFBfile.buf2 == writeFBfile.ActBuf) |
---|
393 | { |
---|
394 | if(writeFBfile.buf1 == NULL) |
---|
395 | writeFBfile.buf1 = malloc(4 * 320 * 240); |
---|
396 | memcpy(writeFBfile.buf1, accelfb->fb, 4 * 320 * 240); |
---|
397 | } |
---|
398 | m_unlock(&status.accelfbmutex, 16); |
---|
399 | } |
---|
400 | |
---|
401 | int mode3d = 0, leftoffset = 0, rightoffset = 0, topoffset = 0, bottomoffset = 0; |
---|
402 | char* mode3dstr = NULL; |
---|
403 | |
---|
404 | if(status.leftoffset != 0) blitrect(0, 0, status.leftoffset, fb->height, 0, 255, 2); |
---|
405 | if(status.rightoffset != 0) blitrect(fb->width - status.rightoffset, 0, status.rightoffset, fb->height, 0, 255, 2); |
---|
406 | if(status.topoffset != 0) blitrect(0, 0, fb->width, status.topoffset, 0, 255, 2); |
---|
407 | if(status.bottomoffset != 0) blitrect(0, fb->height - status.bottomoffset, fb->width, status.bottomoffset, 0, 255, 2); |
---|
408 | |
---|
409 | mode3dstr = getconfig("av_mode3d", NULL); |
---|
410 | if(ostrcmp(mode3dstr, "sbs") == 0) |
---|
411 | mode3d = 1; |
---|
412 | else if(ostrcmp(mode3dstr, "tab") == 0) |
---|
413 | mode3d = 2; |
---|
414 | |
---|
415 | STMFBIO_BLT_DATA bltData; |
---|
416 | memset(&bltData, 0, sizeof(STMFBIO_BLT_DATA)); |
---|
417 | |
---|
418 | bltData.operation = BLT_OP_COPY; |
---|
419 | bltData.srcOffset = fbnode->fb - fb->fb; |
---|
420 | bltData.srcPitch = fbnode->pitch; |
---|
421 | bltData.src_top = 0; |
---|
422 | bltData.src_left = 0; |
---|
423 | bltData.src_right = fbnode->width; |
---|
424 | bltData.src_bottom = fbnode->height; |
---|
425 | bltData.srcFormat = SURF_BGRA8888; |
---|
426 | bltData.srcMemBase = STMFBGP_FRAMEBUFFER; |
---|
427 | |
---|
428 | bltData.dstOffset = 0; |
---|
429 | bltData.dstPitch = fb->pitch; |
---|
430 | bltData.dst_left = status.leftoffset; |
---|
431 | bltData.dst_top = status.topoffset; |
---|
432 | if(mode3d == 1) |
---|
433 | bltData.dst_right = (fb->width - status.rightoffset) / 2; |
---|
434 | else |
---|
435 | bltData.dst_right = fb->width - status.rightoffset; |
---|
436 | if(mode3d == 2) |
---|
437 | bltData.dst_bottom = (fb->height - status.bottomoffset) / 2; |
---|
438 | else |
---|
439 | bltData.dst_bottom = fb->height - status.bottomoffset; |
---|
440 | bltData.dstFormat = SURF_BGRA8888; |
---|
441 | bltData.dstMemBase = STMFBGP_FRAMEBUFFER; |
---|
442 | |
---|
443 | if(flag == 1 && status.screenanim > 0 && mode3d == 0) |
---|
444 | { |
---|
445 | int width = (fb->width - status.rightoffset) - status.leftoffset; |
---|
446 | int height = (fb->height - status.topoffset) - status.bottomoffset; |
---|
447 | max = 25; |
---|
448 | if(status.screenanim == 1 || status.screenanim == 3) |
---|
449 | { |
---|
450 | bltData.dst_left = (width / 2) - 1; |
---|
451 | bltData.dst_right = (width / 2) + 1; |
---|
452 | } |
---|
453 | if(status.screenanim == 2 || status.screenanim == 3) |
---|
454 | { |
---|
455 | bltData.dst_top = (height / 2) - 1; |
---|
456 | bltData.dst_bottom = (height / 2) + 1; |
---|
457 | } |
---|
458 | wstep = width / max; |
---|
459 | hstep = height / max; |
---|
460 | } |
---|
461 | |
---|
462 | for(i = 0; i < max; i++) |
---|
463 | { |
---|
464 | |
---|
465 | if(status.screenanim == 1 || status.screenanim == 3) |
---|
466 | { |
---|
467 | int tmpleft = bltData.dst_left - wstep; |
---|
468 | int tmpright = bltData.dst_right + wstep; |
---|
469 | if(tmpleft < status.leftoffset) |
---|
470 | tmpleft = status.leftoffset; |
---|
471 | if(tmpright > fb->width - status.rightoffset) |
---|
472 | tmpright = fb->width - status.rightoffset; |
---|
473 | bltData.dst_left = tmpleft; |
---|
474 | bltData.dst_right = tmpright; |
---|
475 | } |
---|
476 | |
---|
477 | if(status.screenanim == 2 || status.screenanim == 3) |
---|
478 | { |
---|
479 | int tmptop = bltData.dst_top - hstep; |
---|
480 | int tmpbottom = bltData.dst_bottom + hstep; |
---|
481 | if(tmptop < status.topoffset) |
---|
482 | tmptop = status.topoffset; |
---|
483 | if(tmpbottom > fb->height - status.bottomoffset) |
---|
484 | tmpbottom = fb->height - status.bottomoffset; |
---|
485 | bltData.dst_top = tmptop; |
---|
486 | bltData.dst_bottom = tmpbottom; |
---|
487 | } |
---|
488 | |
---|
489 | if(status.screenanim > 0) usleep(status.screenanimspeed * 1000); |
---|
490 | |
---|
491 | if (ioctl(fb->fd, STMFBIO_BLT, &bltData) < 0) |
---|
492 | { |
---|
493 | perr("ioctl STMFBIO_BLT"); |
---|
494 | } |
---|
495 | if(ioctl(fb->fd, STMFBIO_SYNC_BLITTER) < 0) |
---|
496 | { |
---|
497 | perr("ioctl STMFBIO_SYNC_BLITTER"); |
---|
498 | } |
---|
499 | |
---|
500 | if(mode3d != 0) |
---|
501 | { |
---|
502 | if(mode3d == 1) |
---|
503 | bltData.dst_left = 0 + status.leftoffset + ((fb->width - status.rightoffset) / 2); |
---|
504 | if(mode3d == 2) |
---|
505 | bltData.dst_top = 0 + status.topoffset + ((fb->height - status.bottomoffset) / 2); |
---|
506 | bltData.dst_right = fb->width - status.rightoffset; |
---|
507 | bltData.dst_bottom = fb->height - status.bottomoffset; |
---|
508 | |
---|
509 | if (ioctl(fb->fd, STMFBIO_BLT, &bltData) < 0) |
---|
510 | { |
---|
511 | perr("ioctl STMFBIO_BLT"); |
---|
512 | } |
---|
513 | if(ioctl(fb->fd, STMFBIO_SYNC_BLITTER) < 0) |
---|
514 | { |
---|
515 | perr("ioctl STMFBIO_SYNC_BLITTER"); |
---|
516 | } |
---|
517 | } |
---|
518 | } |
---|
519 | #else |
---|
520 | #ifdef NOFB |
---|
521 | if(status.rguidfd > -1) |
---|
522 | { |
---|
523 | char* buf = NULL; |
---|
524 | buf = scale(fbnode->fb, fbnode->width, fbnode->height, 4, 320, 240, 0); |
---|
525 | if(buf != NULL) |
---|
526 | { |
---|
527 | socksend(&status.rguidfd, (unsigned char*)buf, 320 * 240 * 4, 5000 * 1000); |
---|
528 | free(buf); buf = NULL; |
---|
529 | } |
---|
530 | } |
---|
531 | if(status.write_png == 1 && status.infobaraktiv == 0) |
---|
532 | { |
---|
533 | char* buf = NULL; |
---|
534 | buf = scale(fbnode->fb, fbnode->width, fbnode->height, 4, 320, 240, 0); |
---|
535 | if(buf != NULL) |
---|
536 | { |
---|
537 | if(writeFBfile.ActBuf == NULL) |
---|
538 | { |
---|
539 | writeFBfile.buf1 = malloc(4 * 320 * 240); |
---|
540 | writeFBfile.ActBuf = writeFBfile.buf1; |
---|
541 | memcpy(writeFBfile.buf1, (unsigned char*)buf, 4 * 320 * 240); |
---|
542 | addtimer(&fb2png_thread, START, 10000, 1, NULL, NULL, NULL); |
---|
543 | } |
---|
544 | else if(writeFBfile.buf1 == writeFBfile.ActBuf) |
---|
545 | { |
---|
546 | if(writeFBfile.buf2 == NULL) |
---|
547 | writeFBfile.buf2 = malloc(4 * 320 * 240); |
---|
548 | memcpy(writeFBfile.buf2, (unsigned char*)buf, 4 * 320 * 240); |
---|
549 | } |
---|
550 | else if(writeFBfile.buf2 == writeFBfile.ActBuf) |
---|
551 | { |
---|
552 | if(writeFBfile.buf1 == NULL) |
---|
553 | writeFBfile.buf1 = malloc(4 * 320 * 240); |
---|
554 | memcpy(writeFBfile.buf1, (unsigned char*)buf, 4 * 320 * 240); |
---|
555 | } |
---|
556 | //fb2png((unsigned char*)buf, 320, 240, "/tmp/titanlcd.png"); |
---|
557 | free(buf); buf = NULL; |
---|
558 | } |
---|
559 | } |
---|
560 | |
---|
561 | if(fbnode != fb) |
---|
562 | { |
---|
563 | for(i = 0; i < fbnode->height; i++) |
---|
564 | { |
---|
565 | memcpy(fb->fb + (i * fb->pitch), fbnode->fb + (i * fbnode->pitch), fbnode->width * fbnode->colbytes); |
---|
566 | } |
---|
567 | } |
---|
568 | system("killall -9 xloadimage"); |
---|
569 | |
---|
570 | FILE *fd; |
---|
571 | fd=fopen("titan.png", "w"); |
---|
572 | fwrite(fb->fb, fb->varfbsize, 1, fd); |
---|
573 | fclose(fd); |
---|
574 | |
---|
575 | system("fbgrab -f titan.png -w 1280 -h 720 -b 32 titan1.png > /dev/null"); |
---|
576 | system("xloadimage titan1.png > /dev/null &"); |
---|
577 | #endif |
---|
578 | #endif |
---|
579 | */ |
---|
580 | } |
---|
581 | |
---|
582 | void setfbtransparent(int value) |
---|
583 | { |
---|
584 | char* transparentdev; |
---|
585 | |
---|
586 | transparentdev = getconfig("transparentdev", NULL); |
---|
587 | |
---|
588 | if(transparentdev != NULL /*&& checkdev(transparentdev)*/) |
---|
589 | { |
---|
590 | debug(100, "set %s to %d", transparentdev, value); |
---|
591 | writesysint(transparentdev, value, 1); |
---|
592 | return; |
---|
593 | } |
---|
594 | /* |
---|
595 | #ifndef SIMULATE |
---|
596 | struct stmfbio_var_screeninfo_ex varEx = {0}; |
---|
597 | |
---|
598 | varEx.layerid = 0; |
---|
599 | varEx.activate = STMFBIO_ACTIVATE_IMMEDIATE; |
---|
600 | varEx.caps = STMFBIO_VAR_CAPS_OPACITY; |
---|
601 | varEx.opacity = value; |
---|
602 | |
---|
603 | |
---|
604 | if(ioctl(fb->fd, STMFBIO_SET_VAR_SCREENINFO_EX, &varEx) < 0) |
---|
605 | perr("STMFBIO_SET_VAR_SCREENINFO_EX"); |
---|
606 | #endif |
---|
607 | */ |
---|
608 | } |
---|
609 | |
---|
610 | int allocbpamem(size_t size, int *memfd, unsigned char **mem) |
---|
611 | { |
---|
612 | return -1; |
---|
613 | } |
---|
614 | |
---|
615 | void freebpamem(int memfd, unsigned char* mem, size_t len) |
---|
616 | { |
---|
617 | } |
---|
618 | |
---|
619 | //mode 0: with fill (draw to skinfb) |
---|
620 | //mode 1: without fill (draw to skinfb) |
---|
621 | //mode 2: with fill (draw to fb) |
---|
622 | //mode 3: without fill (draw to fb) |
---|
623 | void blitrect(int posx, int posy, int width, int height, long color, int transparent, int mode) |
---|
624 | { |
---|
625 | int y, x; |
---|
626 | unsigned long tmpcol; |
---|
627 | struct fb* tmpfb = NULL; |
---|
628 | |
---|
629 | if(posx < 0) posx = 0; |
---|
630 | if(posy < 0) posy = 0; |
---|
631 | if(mode < 2) |
---|
632 | tmpfb = skinfb; |
---|
633 | else |
---|
634 | tmpfb = fb; |
---|
635 | |
---|
636 | if(posx > tmpfb->width) posx = tmpfb->width; |
---|
637 | if(posy > tmpfb->height) posy = tmpfb->height; |
---|
638 | if(posx + width > tmpfb->width) width = tmpfb->width - posx; |
---|
639 | if(posy + height > tmpfb->height) height = tmpfb->height - posy; |
---|
640 | |
---|
641 | if(width <= 0 || height <= 0) return; |
---|
642 | |
---|
643 | transparent = (transparent - 255) * -1; |
---|
644 | tmpcol = color | ((transparent & 0xff) << 24); |
---|
645 | |
---|
646 | if(mode == 0 || mode == 2) |
---|
647 | { |
---|
648 | |
---|
649 | if(status.bcm == 1 && tmpfb->data_phys != 0) |
---|
650 | { |
---|
651 | bcm_accel_fill(tmpfb->data_phys, tmpfb->width, tmpfb->height, tmpfb->pitch, posx, posy, width, height, tmpcol); |
---|
652 | } |
---|
653 | else |
---|
654 | { |
---|
655 | int yend = (posy + height) * tmpfb->width; |
---|
656 | posy *= tmpfb->width; |
---|
657 | int xend = posx + width; |
---|
658 | // int xlen = (xend - posx) * tmpfb->colbytes; |
---|
659 | int r = 0; |
---|
660 | unsigned char* from = tmpfb->fb + (posy + posx) * tmpfb->colbytes; |
---|
661 | |
---|
662 | for(y = posy; y < yend; y += tmpfb->width) |
---|
663 | { |
---|
664 | if(r == 0) |
---|
665 | { |
---|
666 | r = 1; |
---|
667 | for(x = posx; x < xend; x++) |
---|
668 | drawpixelfastfb(tmpfb, x, y, tmpcol); |
---|
669 | } |
---|
670 | else |
---|
671 | { |
---|
672 | //memcpy(tmpfb->fb + (y + posx) * tmpfb->colbytes, from, xlen); |
---|
673 | memcpy_area(tmpfb->fb + (y + posx) * tmpfb->colbytes, from, posx * 4, height-1, width*4, tmpfb->width*4); |
---|
674 | y = yend; |
---|
675 | } |
---|
676 | |
---|
677 | } |
---|
678 | } |
---|
679 | } |
---|
680 | else if(mode == 1 || mode == 3) |
---|
681 | { |
---|
682 | //topline |
---|
683 | for(x = 0; x < width; x++) |
---|
684 | drawpixelfb(tmpfb, posx + x, posy, tmpcol); |
---|
685 | //bottomline |
---|
686 | for(x = 0; x < width; x++) |
---|
687 | drawpixelfb(tmpfb, posx + x, posy + height - 1, tmpcol); |
---|
688 | //leftline |
---|
689 | for(y = 0; y < height; y++) |
---|
690 | drawpixelfb(tmpfb, posx, posy + y, tmpcol); |
---|
691 | //rightline |
---|
692 | for(y = 0; y < height; y++) |
---|
693 | drawpixelfb(tmpfb, posx + width - 1, posy + y, tmpcol); |
---|
694 | } |
---|
695 | |
---|
696 | /* |
---|
697 | unsigned long tmpcol; |
---|
698 | |
---|
699 | transparent = (transparent - 255) * -1; |
---|
700 | tmpcol = color | ((transparent & 0xff) << 24); |
---|
701 | |
---|
702 | STMFBIO_BLT_DATA bltData; |
---|
703 | memset(&bltData, 0, sizeof(STMFBIO_BLT_DATA)); |
---|
704 | |
---|
705 | if(posx < 0) posx = 0; |
---|
706 | if(posy < 0) posy = 0; |
---|
707 | if(mode < 2) |
---|
708 | { |
---|
709 | if(posx > skinfb->width) posx = skinfb->width; |
---|
710 | if(posy > skinfb->height) posy = skinfb->height; |
---|
711 | if(posx + width > skinfb->width) width = skinfb->width - posx; |
---|
712 | if(posy + height > skinfb->height) height = skinfb->height - posy; |
---|
713 | } |
---|
714 | else |
---|
715 | { |
---|
716 | if(posx > fb->width) posx = fb->width; |
---|
717 | if(posy > fb->height) posy = fb->height; |
---|
718 | if(posx + width > fb->width) width = fb->width - posx; |
---|
719 | if(posy + height > fb->height) height = fb->height - posy; |
---|
720 | } |
---|
721 | |
---|
722 | if(width <= 0 || height <= 0) return; |
---|
723 | |
---|
724 | if(mode == 0 || mode == 2) |
---|
725 | bltData.operation = BLT_OP_FILL; |
---|
726 | else if(mode == 1 || mode == 3) |
---|
727 | bltData.operation = BLT_OP_DRAW_RECTANGLE; |
---|
728 | bltData.colour = tmpcol; |
---|
729 | bltData.srcFormat = SURF_ARGB8888; |
---|
730 | bltData.srcMemBase = STMFBGP_FRAMEBUFFER; |
---|
731 | |
---|
732 | if(status.usedirectfb == 1) |
---|
733 | bltData.dstOffset = 0; |
---|
734 | else |
---|
735 | { |
---|
736 | if(mode < 2) |
---|
737 | bltData.dstOffset = fb->varfbsize; |
---|
738 | else |
---|
739 | bltData.dstOffset = 0; |
---|
740 | } |
---|
741 | if(mode < 2) |
---|
742 | bltData.dstPitch = skinfb->pitch; |
---|
743 | else |
---|
744 | bltData.dstPitch = fb->pitch; |
---|
745 | bltData.dst_top = posy; |
---|
746 | bltData.dst_left = posx; |
---|
747 | bltData.dst_bottom = posy + height; |
---|
748 | bltData.dst_right = posx + width; |
---|
749 | bltData.dstFormat = SURF_ARGB8888; |
---|
750 | bltData.dstMemBase = STMFBGP_FRAMEBUFFER; |
---|
751 | |
---|
752 | if(ioctl(fb->fd, STMFBIO_BLT, &bltData) < 0) |
---|
753 | { |
---|
754 | perr("ioctl STMFBIO_BLT"); |
---|
755 | } |
---|
756 | if(ioctl(fb->fd, STMFBIO_SYNC_BLITTER) < 0) |
---|
757 | { |
---|
758 | perr("ioctl STMFBIO_SYNC_BLITTER"); |
---|
759 | } |
---|
760 | */ |
---|
761 | } |
---|
762 | |
---|
763 | int readjpg(const char* filename, unsigned long* width, unsigned long* height, unsigned long* rowbytes, int* channels, unsigned char **mem, int *memfd) |
---|
764 | { |
---|
765 | /* |
---|
766 | #ifndef SIMULATE |
---|
767 | FILE *fp; |
---|
768 | unsigned int temp1, temp2; |
---|
769 | |
---|
770 | if(filename == NULL) return -1; |
---|
771 | |
---|
772 | debug(200, "hardware decode picture (%s)...", filename); |
---|
773 | |
---|
774 | if (!(fp = fopen(filename, "rb"))) |
---|
775 | return -1; |
---|
776 | |
---|
777 | if(get_jpeg_img_size(fp, &temp1, &temp2) != LIBMMEIMG_SUCCESS) |
---|
778 | return -1; |
---|
779 | |
---|
780 | *width = temp1; |
---|
781 | *height = temp2; |
---|
782 | *channels = 3; |
---|
783 | *rowbytes = *channels * temp1; |
---|
784 | |
---|
785 | if(allocbpamem(temp1 * temp2 * (*channels), memfd, mem) != 0) |
---|
786 | { |
---|
787 | fclose(fp); |
---|
788 | return -1; |
---|
789 | } |
---|
790 | |
---|
791 | if(decode_jpeg_noalloc(fp, temp1, temp2, temp1, temp2, (char *)*mem, 1) == LIBMMEIMG_SUCCESS) |
---|
792 | { |
---|
793 | fclose(fp); |
---|
794 | return 0; |
---|
795 | } |
---|
796 | |
---|
797 | fclose(fp); |
---|
798 | freebpamem(*memfd, *mem, temp1 * temp2 * (*channels)); |
---|
799 | err("hardware decode error"); |
---|
800 | #endif |
---|
801 | return -1; |
---|
802 | */ |
---|
803 | return -1; |
---|
804 | } |
---|
805 | |
---|
806 | //flag 0: blit from accelfb to skinfb |
---|
807 | //flag 1: blit from skinfb to accelfb |
---|
808 | void blitscale(int posx, int posy, int width, int height, int scalewidth, int scaleheight, int flag) |
---|
809 | { |
---|
810 | #ifndef SIMULATE |
---|
811 | //#ifdef BLITHELP |
---|
812 | unsigned char *source = NULL; |
---|
813 | unsigned char *target = NULL; |
---|
814 | int zpitch = 0; |
---|
815 | int zheight = 0; |
---|
816 | int zwidth = 0; |
---|
817 | int qpitch = 0; |
---|
818 | int qheight = 0; |
---|
819 | int qwidth = 0; |
---|
820 | unsigned long source_phys = 0; |
---|
821 | unsigned long target_phys = 0; |
---|
822 | |
---|
823 | if(scalewidth == 0) scalewidth = width; |
---|
824 | if(scaleheight == 0) scaleheight = height; |
---|
825 | |
---|
826 | if(posx < 0) posx = 0; |
---|
827 | if(posx > skinfb->width) posx = skinfb->width; |
---|
828 | if(posy < 0) posy = 0; |
---|
829 | if(posy > skinfb->height) posy = skinfb->height; |
---|
830 | if(posx + scalewidth > skinfb->width) scalewidth = skinfb->width - posx; |
---|
831 | if(posy + scaleheight > skinfb->height) scaleheight = skinfb->height - posy; |
---|
832 | |
---|
833 | if(width <= 0 || height <= 0 || scalewidth <= 0 || scaleheight <= 0) return; |
---|
834 | |
---|
835 | if(flag == 1 && (scalewidth * scaleheight * 4) > accelfb->varfbsize) |
---|
836 | { |
---|
837 | err("accelfb to small %d -> %lu ", scalewidth * scaleheight * 4, accelfb->varfbsize); |
---|
838 | return; |
---|
839 | } |
---|
840 | if(flag == 0) |
---|
841 | { |
---|
842 | source = accelfb->fb; |
---|
843 | source_phys = accelfb->data_phys; |
---|
844 | target_phys = skinfb->data_phys; |
---|
845 | |
---|
846 | target = skinfb->fb + (posy * skinfb->pitch) + (posx*4); |
---|
847 | zpitch = skinfb->pitch; |
---|
848 | zheight = skinfb->height; |
---|
849 | zwidth = skinfb->width; |
---|
850 | qpitch = width*4; |
---|
851 | qheight = height; |
---|
852 | qwidth = width; |
---|
853 | } |
---|
854 | else |
---|
855 | { |
---|
856 | source = skinfb->fb; |
---|
857 | source_phys = skinfb->data_phys; |
---|
858 | target_phys = accelfb->data_phys; |
---|
859 | |
---|
860 | target = accelfb->fb + (posy * accelfb->pitch) + (posx*4); |
---|
861 | zpitch = accelfb->pitch; |
---|
862 | zheight = accelfb->height; |
---|
863 | zwidth = accelfb->width; |
---|
864 | qpitch = width*4; |
---|
865 | qheight = height; |
---|
866 | qwidth = width; |
---|
867 | } |
---|
868 | |
---|
869 | if(status.bcm == 1 && source_phys > 0 && target_phys >0) |
---|
870 | { |
---|
871 | bcm_accel_blit(source_phys, qwidth, qheight, qpitch, 0, target_phys, zwidth, zheight, zpitch, 0, 0, width, height, posx, posy, scalewidth, scaleheight, 0, 0); |
---|
872 | flag = 1; |
---|
873 | } |
---|
874 | else |
---|
875 | { |
---|
876 | unsigned char *helpbuf = NULL; |
---|
877 | helpbuf = scale(source, width, height, 4, scalewidth, scaleheight, 0); |
---|
878 | |
---|
879 | size_t helpb = 0; |
---|
880 | size_t helpz = 0; |
---|
881 | size_t help = 0; |
---|
882 | |
---|
883 | while(helpz < scaleheight && helpz < (zheight - posy)) { |
---|
884 | //memcpy(target[help], helpbuf[helpb], scalewidth*4); |
---|
885 | memcpy(target+help, helpbuf+helpb, scalewidth*4); |
---|
886 | help = help + zpitch; |
---|
887 | helpb = helpb + scalewidth*4; |
---|
888 | helpz = helpz + 1; |
---|
889 | } |
---|
890 | free(helpbuf); |
---|
891 | } |
---|
892 | |
---|
893 | |
---|
894 | if(flag == 0) |
---|
895 | blit(); |
---|
896 | |
---|
897 | //#endif |
---|
898 | |
---|
899 | /* |
---|
900 | STMFBIO_BLT_DATA blt_data; |
---|
901 | memset(&blt_data, 0, sizeof(STMFBIO_BLT_DATA)); |
---|
902 | |
---|
903 | if(scalewidth == 0) scalewidth = width; |
---|
904 | if(scaleheight == 0) scaleheight = height; |
---|
905 | |
---|
906 | if(posx < 0) posx = 0; |
---|
907 | if(posx > skinfb->width) posx = skinfb->width; |
---|
908 | if(posy < 0) posy = 0; |
---|
909 | if(posy > skinfb->height) posy = skinfb->height; |
---|
910 | if(posx + scalewidth > skinfb->width) scalewidth = skinfb->width - posx; |
---|
911 | if(posy + scaleheight > skinfb->height) scaleheight = skinfb->height - posy; |
---|
912 | |
---|
913 | if(width <= 0 || height <= 0 || scalewidth <= 0 || scaleheight <= 0) return; |
---|
914 | |
---|
915 | if(flag == 1 && (scalewidth * scaleheight * 4) > accelfb->varfbsize) |
---|
916 | { |
---|
917 | err("accelfb to small %d -> %lu ", scalewidth * scaleheight * 4, accelfb->varfbsize); |
---|
918 | return; |
---|
919 | } |
---|
920 | |
---|
921 | blt_data.operation = BLT_OP_COPY; |
---|
922 | |
---|
923 | if(flag == 0) |
---|
924 | { |
---|
925 | if(status.usedirectfb == 1) |
---|
926 | blt_data.srcOffset = fb->varfbsize; |
---|
927 | else |
---|
928 | blt_data.srcOffset = fb->varfbsize + skinfb->varfbsize; |
---|
929 | } |
---|
930 | else |
---|
931 | { |
---|
932 | if(status.usedirectfb == 1) |
---|
933 | blt_data.srcOffset = 0; |
---|
934 | else |
---|
935 | blt_data.srcOffset = fb->varfbsize; |
---|
936 | } |
---|
937 | |
---|
938 | blt_data.srcPitch = width * 4; |
---|
939 | blt_data.src_top = 0; |
---|
940 | blt_data.src_left = 0; |
---|
941 | blt_data.src_right = width; |
---|
942 | blt_data.src_bottom = height; |
---|
943 | blt_data.srcFormat = SURF_ARGB8888; |
---|
944 | blt_data.srcMemBase = STMFBGP_FRAMEBUFFER; |
---|
945 | |
---|
946 | if(flag == 0) |
---|
947 | { |
---|
948 | if(status.usedirectfb == 1) |
---|
949 | { |
---|
950 | blt_data.dstOffset = 0; |
---|
951 | blt_data.dstPitch = fb->pitch; |
---|
952 | } |
---|
953 | else |
---|
954 | { |
---|
955 | blt_data.dstOffset = fb->varfbsize; |
---|
956 | blt_data.dstPitch = skinfb->pitch; |
---|
957 | } |
---|
958 | } |
---|
959 | else |
---|
960 | { |
---|
961 | if(status.usedirectfb == 1) |
---|
962 | { |
---|
963 | blt_data.dstOffset = fb->varfbsize; |
---|
964 | blt_data.dstPitch = skinfb->pitch; |
---|
965 | } |
---|
966 | else |
---|
967 | { |
---|
968 | blt_data.dstOffset = fb->varfbsize + skinfb->varfbsize; |
---|
969 | blt_data.dstPitch = scalewidth * 4; |
---|
970 | } |
---|
971 | } |
---|
972 | |
---|
973 | blt_data.dst_left = posx; |
---|
974 | blt_data.dst_top = posy; |
---|
975 | blt_data.dst_right = posx + scalewidth; |
---|
976 | blt_data.dst_bottom = posy + scaleheight; |
---|
977 | blt_data.dstFormat = SURF_ARGB8888; |
---|
978 | blt_data.dstMemBase = STMFBGP_FRAMEBUFFER; |
---|
979 | |
---|
980 | if (ioctl(fb->fd, STMFBIO_BLT, &blt_data) < 0) |
---|
981 | { |
---|
982 | perr("ioctl STMFBIO_BLT"); |
---|
983 | } |
---|
984 | if(ioctl(fb->fd, STMFBIO_SYNC_BLITTER) < 0) |
---|
985 | { |
---|
986 | perr("ioctl STMFBIO_SYNC_BLITTER"); |
---|
987 | } |
---|
988 | */ |
---|
989 | #endif |
---|
990 | } |
---|
991 | |
---|
992 | 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) |
---|
993 | //void blitjpg(unsigned char* buf, int posx, int posy, int width, int height, int scalewidth, int scaleheight) |
---|
994 | { |
---|
995 | #ifndef SIMULATE |
---|
996 | #ifdef BLITHELP |
---|
997 | unsigned char *helpbuf = NULL; |
---|
998 | unsigned char *framebuf = NULL; |
---|
999 | |
---|
1000 | if(scalewidth != 0 || scaleheight != 0) { |
---|
1001 | helpbuf = scale(buf, width, height, 3, scalewidth, scaleheight, 1); |
---|
1002 | if(helpbuf == NULL) |
---|
1003 | return; |
---|
1004 | } |
---|
1005 | else { |
---|
1006 | helpbuf = buf; |
---|
1007 | scalewidth = width; |
---|
1008 | scaleheight = height; |
---|
1009 | } |
---|
1010 | size_t helpb = 0; |
---|
1011 | size_t helpz = 0; |
---|
1012 | size_t help = 0; |
---|
1013 | |
---|
1014 | framebuf = skinfb->fb; |
---|
1015 | framebuf = framebuf + (posy * skinfb->pitch) + (posx*4); |
---|
1016 | |
---|
1017 | while(helpz < scaleheight && helpz < (skinfb->height - posy)) { |
---|
1018 | help = 0; |
---|
1019 | while(help < (scalewidth*4) && help < (skinfb->pitch - (posx*4))) { |
---|
1020 | framebuf[help+0] = helpbuf[helpb+2]; |
---|
1021 | framebuf[help+1] = helpbuf[helpb+1]; |
---|
1022 | framebuf[help+2] = helpbuf[helpb+0]; |
---|
1023 | framebuf[help+3] = 0xff; |
---|
1024 | help = help + 4; |
---|
1025 | helpb = helpb + 3; |
---|
1026 | } |
---|
1027 | if(help >= (skinfb->pitch - (posx*4))) |
---|
1028 | helpb = (helpz+1) * (scalewidth*3); |
---|
1029 | framebuf = framebuf + skinfb->pitch; |
---|
1030 | helpz = helpz + 1; |
---|
1031 | } |
---|
1032 | free(helpbuf); |
---|
1033 | blit(); |
---|
1034 | #endif |
---|
1035 | |
---|
1036 | /* |
---|
1037 | STMFBIO_BLT_EXTERN_DATA blt_data; |
---|
1038 | memset(&blt_data, 0, sizeof(STMFBIO_BLT_EXTERN_DATA)); |
---|
1039 | |
---|
1040 | blt_data.operation = BLT_OP_COPY; |
---|
1041 | blt_data.ulFlags = 0; |
---|
1042 | blt_data.srcOffset = 0; |
---|
1043 | blt_data.srcPitch = width * 3; |
---|
1044 | blt_data.dstOffset = 0; |
---|
1045 | blt_data.dstPitch = skinfb->pitch; |
---|
1046 | blt_data.src_top = 0; |
---|
1047 | blt_data.src_left = 0; |
---|
1048 | blt_data.src_right = width; |
---|
1049 | blt_data.src_bottom = height; |
---|
1050 | blt_data.dst_left = posx; |
---|
1051 | blt_data.dst_top = posy; |
---|
1052 | |
---|
1053 | if(scalewidth == 0) scalewidth = width; |
---|
1054 | if(scaleheight == 0) scaleheight = height; |
---|
1055 | |
---|
1056 | blt_data.dst_right = posx + scalewidth; |
---|
1057 | blt_data.dst_bottom = posy + scaleheight; |
---|
1058 | blt_data.srcFormat = SURF_BGR888; |
---|
1059 | blt_data.dstFormat = SURF_ARGB8888; |
---|
1060 | blt_data.srcMemBase = (char *)buf; |
---|
1061 | blt_data.dstMemBase = (char *)skinfb->fb; |
---|
1062 | blt_data.srcMemSize = width * height * 3; |
---|
1063 | blt_data.dstMemSize = skinfb->pitch * skinfb->height; |
---|
1064 | |
---|
1065 | if(ioctl(skinfb->fd, STMFBIO_BLT_EXTERN, &blt_data) < 0) |
---|
1066 | { |
---|
1067 | err("ioctl STMFBIO_BLT_EXTERN"); |
---|
1068 | } |
---|
1069 | if(ioctl(fb->fd, STMFBIO_SYNC_BLITTER) < 0) |
---|
1070 | { |
---|
1071 | perr("ioctl STMFBIO_SYNC_BLITTER"); |
---|
1072 | } |
---|
1073 | */ |
---|
1074 | |
---|
1075 | #endif |
---|
1076 | } |
---|
1077 | |
---|
1078 | void initsignal(struct sigaction* sa) |
---|
1079 | { |
---|
1080 | sigaction(SIGILL, sa, NULL); |
---|
1081 | sigaction(SIGBUS, sa, NULL); |
---|
1082 | sigaction(SIGFPE, sa, NULL); |
---|
1083 | sigaction(SIGUSR1, sa, NULL); |
---|
1084 | sigaction(SIGSEGV, sa, NULL); |
---|
1085 | sigaction(SIGUSR2, sa, NULL); |
---|
1086 | sigaction(SIGPIPE, sa, NULL); |
---|
1087 | sigaction(SIGALRM, sa, NULL); |
---|
1088 | // sigaction(SIGSTKFLT, sa, NULL); |
---|
1089 | sigaction(SIGABRT, sa, NULL); |
---|
1090 | |
---|
1091 | signal(SIGHUP, SIG_IGN); |
---|
1092 | signal(SIGINT, SIG_IGN); |
---|
1093 | signal(SIGTRAP, SIG_IGN); |
---|
1094 | signal(SIGXCPU, SIG_IGN); |
---|
1095 | signal(SIGXFSZ, SIG_IGN); |
---|
1096 | signal(SIGVTALRM, SIG_IGN); |
---|
1097 | signal(SIGPROF, SIG_IGN); |
---|
1098 | signal(SIGPOLL, SIG_IGN); |
---|
1099 | signal(SIGRTMAX, SIG_IGN); |
---|
1100 | signal(SIGPWR, SIG_IGN); |
---|
1101 | signal(SIGSYS, SIG_IGN); |
---|
1102 | } |
---|
1103 | |
---|
1104 | void sighandler(int sig, struct sigcontext ctx) |
---|
1105 | { |
---|
1106 | switch(sig) |
---|
1107 | { |
---|
1108 | case SIGALRM: |
---|
1109 | { |
---|
1110 | err("got signal sigalrm but ignore it"); |
---|
1111 | break; |
---|
1112 | } |
---|
1113 | case SIGPIPE: |
---|
1114 | { |
---|
1115 | err("got signal sigpipe but ignore it"); |
---|
1116 | break; |
---|
1117 | } |
---|
1118 | case SIGUSR1: |
---|
1119 | { |
---|
1120 | //todo all configs |
---|
1121 | reloadconfig(status.configfile); |
---|
1122 | reloadconfig(getconfig("ownconfig", NULL)); |
---|
1123 | break; |
---|
1124 | } |
---|
1125 | case SIGUSR2: //called if hanging mainthread detect |
---|
1126 | { |
---|
1127 | debugstack(sig, NULL, NULL); |
---|
1128 | break; |
---|
1129 | } |
---|
1130 | case SIGILL: |
---|
1131 | case SIGBUS: |
---|
1132 | case SIGFPE: |
---|
1133 | case SIGSEGV: |
---|
1134 | // case SIGSTKFLT: |
---|
1135 | { |
---|
1136 | /* |
---|
1137 | #ifdef SIMULATE |
---|
1138 | //intel |
---|
1139 | debugstack((void *)ctx.eip, NULL); |
---|
1140 | err("got signal %d, fault address 0x%lx from 0x%lx", sig, ctx.cr2, ctx.eip); |
---|
1141 | #else |
---|
1142 | // sh4 |
---|
1143 | //unsigned long sc_regs[16]; |
---|
1144 | //unsigned long sc_pc; //programm counter register |
---|
1145 | //unsigned long sc_pr; //procedure register |
---|
1146 | //unsigned long sc_sr; //status register |
---|
1147 | //unsigned long sc_gbr; |
---|
1148 | //unsigned long sc_mach; |
---|
1149 | //unsigned long sc_macl; |
---|
1150 | |
---|
1151 | debugstack(sig, (void *)ctx.sc_pr, (void *)ctx.sc_pc); |
---|
1152 | err("got signal %d (%s), programm counter reg: 0x%lx, procedure reg: 0x%lx", sig, strsignal(sig), ctx.sc_pc, ctx.sc_pr); |
---|
1153 | #endif |
---|
1154 | */ |
---|
1155 | if(getconfigint("saverun", NULL) == 1 && status.longjumpbuf != NULL) |
---|
1156 | siglongjmp(status.longjumpbuf, 999); |
---|
1157 | else |
---|
1158 | exit(100); |
---|
1159 | break; |
---|
1160 | } |
---|
1161 | } |
---|
1162 | } |
---|
1163 | |
---|
1164 | int setvmpeg(struct dvbdev* node, int value, int flag) |
---|
1165 | { |
---|
1166 | debug(4440, "in"); |
---|
1167 | char* vmpegdev = NULL, *tmpstr = NULL, *buf = NULL; |
---|
1168 | int ret = 0; |
---|
1169 | |
---|
1170 | if(node == NULL) return 1; |
---|
1171 | if(flag == 0) vmpegdev = getconfig("vmpegleftdev", NULL); |
---|
1172 | if(flag == 1) vmpegdev = getconfig("vmpegtopdev", NULL); |
---|
1173 | if(flag == 2) vmpegdev = getconfig("vmpegwidthdev", NULL); |
---|
1174 | if(flag == 3) vmpegdev = getconfig("vmpegheightdev", NULL); |
---|
1175 | if(flag == 99) vmpegdev = getconfig("vmpegapplydev", NULL); |
---|
1176 | |
---|
1177 | if(vmpegdev != NULL) |
---|
1178 | { |
---|
1179 | buf = malloc(MINMALLOC); |
---|
1180 | if(buf == NULL) |
---|
1181 | { |
---|
1182 | err("no mem"); |
---|
1183 | return 1; |
---|
1184 | } |
---|
1185 | |
---|
1186 | tmpstr = malloc(10); |
---|
1187 | if(tmpstr == NULL) |
---|
1188 | { |
---|
1189 | err("no mem"); |
---|
1190 | free(buf); |
---|
1191 | return 1; |
---|
1192 | } |
---|
1193 | |
---|
1194 | snprintf(buf, MINMALLOC, vmpegdev, node->devnr); |
---|
1195 | snprintf(tmpstr, 10, "%x", value); |
---|
1196 | debug(444, "set %s to %s", buf, tmpstr); |
---|
1197 | status.tvpic = 1; |
---|
1198 | ret = writesys(buf, tmpstr, 1); |
---|
1199 | |
---|
1200 | free(tmpstr); |
---|
1201 | free(buf); |
---|
1202 | return ret; |
---|
1203 | } |
---|
1204 | |
---|
1205 | debug(4440, "out"); |
---|
1206 | return 0; |
---|
1207 | } |
---|
1208 | |
---|
1209 | //flag 0: wh = width |
---|
1210 | //flag 1: wh = height |
---|
1211 | int setvmpegrect(struct dvbdev* node, int left, int top, int wh, int flag) |
---|
1212 | { |
---|
1213 | int ret = 0; |
---|
1214 | |
---|
1215 | ret = setvmpeg(node, left, 0); |
---|
1216 | ret = setvmpeg(node, top, 1); |
---|
1217 | |
---|
1218 | if(flag == 0) |
---|
1219 | { |
---|
1220 | ret = setvmpeg(node, wh, 2); |
---|
1221 | ret = setvmpeg(node, wh / 1.4, 3); |
---|
1222 | } |
---|
1223 | if(flag == 1) |
---|
1224 | { |
---|
1225 | ret = setvmpeg(node, wh, 3); |
---|
1226 | ret = setvmpeg(node, wh * 1.3, 2); |
---|
1227 | } |
---|
1228 | |
---|
1229 | setvmpeg(node, 0, 99); |
---|
1230 | |
---|
1231 | return ret; |
---|
1232 | } |
---|
1233 | |
---|
1234 | int resetvmpeg(struct dvbdev* node) |
---|
1235 | { |
---|
1236 | int ret = 0; |
---|
1237 | |
---|
1238 | ret = setvmpeg(node, 0, 0); |
---|
1239 | ret = setvmpeg(node, 0, 1); |
---|
1240 | ret = setvmpeg(node, 0, 2); |
---|
1241 | ret = setvmpeg(node, 0, 3); |
---|
1242 | |
---|
1243 | ret = setvmpeg(node, 0, 99); |
---|
1244 | |
---|
1245 | status.tvpic = 0; |
---|
1246 | |
---|
1247 | return ret; |
---|
1248 | } |
---|
1249 | |
---|
1250 | int resettvpic() |
---|
1251 | { |
---|
1252 | /* |
---|
1253 | if(status.tvpic == 1 && status.aktservice != NULL) |
---|
1254 | { |
---|
1255 | status.tvpic = 0; |
---|
1256 | resetvmpeg(status.aktservice->videodev); |
---|
1257 | } |
---|
1258 | */ |
---|
1259 | int ret = 0; |
---|
1260 | |
---|
1261 | if(status.tvpic > 0 && status.aktservice != NULL) |
---|
1262 | ret = resetvmpeg(status.aktservice->videodev); |
---|
1263 | |
---|
1264 | return ret; |
---|
1265 | } |
---|
1266 | |
---|
1267 | int cagetslotinfo(struct dvbdev* node, ca_slot_info_t* info) |
---|
1268 | { |
---|
1269 | int ret = 0; |
---|
1270 | |
---|
1271 | if(node == NULL || info == NULL) |
---|
1272 | { |
---|
1273 | err("NULL detect"); |
---|
1274 | return 1; |
---|
1275 | } |
---|
1276 | |
---|
1277 | struct pollfd fds; |
---|
1278 | |
---|
1279 | fds.fd = node->fd; |
---|
1280 | fds.events = POLLOUT | POLLPRI | POLLIN; |
---|
1281 | |
---|
1282 | info->flags = 0; |
---|
1283 | |
---|
1284 | ret = TEMP_FAILURE_RETRY(poll(&fds, 1, 1000)); |
---|
1285 | |
---|
1286 | if(ret < 0) |
---|
1287 | { |
---|
1288 | err("poll data"); |
---|
1289 | return 1; //error |
---|
1290 | } |
---|
1291 | else if(ret == 0) |
---|
1292 | return 0; //timeout |
---|
1293 | else if(ret > 0) |
---|
1294 | { |
---|
1295 | if(fds.revents & POLLOUT) |
---|
1296 | info->flags = CA_CI_MODULE_READY; |
---|
1297 | if(fds.revents & POLLIN) |
---|
1298 | info->flags = CA_CI_MODULE_READY; |
---|
1299 | if(fds.revents & POLLPRI) |
---|
1300 | info->flags = 0; |
---|
1301 | } |
---|
1302 | |
---|
1303 | return 0; |
---|
1304 | } |
---|
1305 | |
---|
1306 | void memcpy_word(char* dest, char* src, long anzw) |
---|
1307 | { |
---|
1308 | // Folgende Werte m�ssen volatile definiert sein |
---|
1309 | // char* memcpy_word_src ---> pointer Quelle |
---|
1310 | // char* memcpy_word_dest ---> pointer Ziehl |
---|
1311 | // long memcpy_word_anzw ---> Anzahl der W�rter (4 byte) die kopiert werden sollen. |
---|
1312 | |
---|
1313 | memcpy_word_src = src; |
---|
1314 | memcpy_word_dest = dest; |
---|
1315 | memcpy_word_anzw = anzw; |
---|
1316 | |
---|
1317 | #ifndef ARM |
---|
1318 | asm( |
---|
1319 | " lw $8, memcpy_word_src \n" |
---|
1320 | " lw $9, memcpy_word_dest \n" |
---|
1321 | " lw $10, memcpy_word_anzw \n" |
---|
1322 | " addi $10, $10, -1 \n" |
---|
1323 | "loop1: \n" |
---|
1324 | " lw $11, ($8) \n" |
---|
1325 | " sw $11, ($9) \n" |
---|
1326 | " addi $8, $8, 4 \n" |
---|
1327 | " addi $9, $9, 4 \n" |
---|
1328 | " addi $10, $10, -1 \n" |
---|
1329 | " bgez $10, loop1 \n" |
---|
1330 | ); |
---|
1331 | #endif |
---|
1332 | |
---|
1333 | } |
---|
1334 | |
---|
1335 | void memcpy_byte(char* dest, char* src, long anzb) |
---|
1336 | { |
---|
1337 | // Folgende Werte m�ssen volatile definiert sein |
---|
1338 | // char* memcpy_byte_src ---> pointer Quelle |
---|
1339 | // char* memcpy_byte_dest ---> pointer Ziehl |
---|
1340 | // long memcpy_byte_anzb ---> Anzahl bytes die kopiert werden sollen. |
---|
1341 | |
---|
1342 | memcpy_byte_src = src; |
---|
1343 | memcpy_byte_dest = dest; |
---|
1344 | memcpy_byte_anzb = anzb; |
---|
1345 | |
---|
1346 | #ifndef ARM |
---|
1347 | asm ( |
---|
1348 | " li $12, 4 \n" |
---|
1349 | " lw $8, memcpy_byte_src \n" |
---|
1350 | " lw $9, memcpy_byte_dest \n" |
---|
1351 | " lw $10, memcpy_byte_anzb \n" |
---|
1352 | "word: \n" |
---|
1353 | " bltu $10, $12, byte \n" |
---|
1354 | " lw $11, ($8) \n" |
---|
1355 | " sw $11, ($9) \n" |
---|
1356 | " addi $8, $8, 4 \n" |
---|
1357 | " addi $9, $9, 4 \n" |
---|
1358 | " addi $10, $10, -4 \n" |
---|
1359 | " b word \n" |
---|
1360 | "byte: \n" |
---|
1361 | " beqz $10, end \n" |
---|
1362 | " lb $11, ($8) \n" |
---|
1363 | " sb $11, ($9) \n" |
---|
1364 | " addi $8, $8, 1 \n" |
---|
1365 | " addi $9, $9, 1 \n" |
---|
1366 | " addi $10, $10, -1 \n" |
---|
1367 | " b byte \n" |
---|
1368 | "end: \n" |
---|
1369 | " nop \n" |
---|
1370 | ); |
---|
1371 | #endif |
---|
1372 | } |
---|
1373 | |
---|
1374 | |
---|
1375 | void memcpy_area(unsigned char* targetADDR, unsigned char* startADDR, long pxAbs, long hight, long widthAbs, long FBwidthAbs) |
---|
1376 | { |
---|
1377 | |
---|
1378 | #ifndef ARM |
---|
1379 | asm( |
---|
1380 | |
---|
1381 | " lw $t3, %[targetADDR] \n" |
---|
1382 | " lw $t4, %[startADDR] \n" |
---|
1383 | " lw $t5, %[pxAbs] \n" |
---|
1384 | " lw $t6, %[widthAbs] \n" |
---|
1385 | " lw $t7, %[FBwidthAbs] \n" |
---|
1386 | " lw $t8, %[hight] \n" |
---|
1387 | |
---|
1388 | " move $t0, $t4 # Temp-startADDR \n" |
---|
1389 | " move $t1, $t6 # Temp-widthAbs \n" |
---|
1390 | " add $t2, $t5, $t6 \n" |
---|
1391 | " sub $t7, $t7, $t2 # Diff withAbs und FBwidthAbs \n" |
---|
1392 | |
---|
1393 | "p3NewLine2: \n" |
---|
1394 | " beqz $t8, p3End \n" |
---|
1395 | "p3NextWord: \n" |
---|
1396 | " beqz $t1, p3NewLine1 \n" |
---|
1397 | " lw $t9, ($t0) \n" |
---|
1398 | " sw $t9, ($t3) \n" |
---|
1399 | " addi $t0, 4 \n" |
---|
1400 | " addi $t3, 4 \n" |
---|
1401 | " addi $t1, -4 \n" |
---|
1402 | " b p3NextWord \n" |
---|
1403 | |
---|
1404 | |
---|
1405 | "p3NewLine1: \n" |
---|
1406 | " move $t0, $t4 \n" |
---|
1407 | " move $t1, $t6 \n" |
---|
1408 | " add $t3, $t3, $t7 \n" |
---|
1409 | " add $t3, $t3, $t5 \n" |
---|
1410 | " addi $t8, -1 \n" |
---|
1411 | " b p3NewLine2 \n" |
---|
1412 | |
---|
1413 | "p3End: \n" |
---|
1414 | " nop \n" |
---|
1415 | ::[targetADDR] "m" (targetADDR), [startADDR] "m" (startADDR), [pxAbs] "m" (pxAbs), [widthAbs] "m" (widthAbs), [FBwidthAbs] "m" (FBwidthAbs), [hight] "m" (hight) |
---|
1416 | ); |
---|
1417 | #endif |
---|
1418 | |
---|
1419 | return; |
---|
1420 | } |
---|
1421 | |
---|
1422 | int setfbosddev(char* dev, int value) |
---|
1423 | { |
---|
1424 | char* tmpstr = NULL; |
---|
1425 | int ret = 0; |
---|
1426 | |
---|
1427 | tmpstr = malloc(10); |
---|
1428 | if(tmpstr == NULL) |
---|
1429 | { |
---|
1430 | err("no mem"); |
---|
1431 | return 1; |
---|
1432 | } |
---|
1433 | |
---|
1434 | sprintf(tmpstr, "%x", value); |
---|
1435 | debug(101, "set %s to %s", dev, tmpstr); |
---|
1436 | |
---|
1437 | if(dev != NULL) |
---|
1438 | { |
---|
1439 | ret = writesys(dev, tmpstr, 1); |
---|
1440 | return ret; |
---|
1441 | } |
---|
1442 | |
---|
1443 | return 0; |
---|
1444 | } |
---|
1445 | |
---|
1446 | char* getfbosddev(char* dev) |
---|
1447 | { |
---|
1448 | char *value = NULL; |
---|
1449 | |
---|
1450 | if(dev == NULL) |
---|
1451 | { |
---|
1452 | err("NULL detect"); |
---|
1453 | return NULL; |
---|
1454 | } |
---|
1455 | |
---|
1456 | value = readsys(dev, 1); |
---|
1457 | if(value == NULL) |
---|
1458 | { |
---|
1459 | err("NULL detect"); |
---|
1460 | return NULL; |
---|
1461 | } |
---|
1462 | |
---|
1463 | debug(101, "get %s to %s", dev, value); |
---|
1464 | |
---|
1465 | return value; |
---|
1466 | } |
---|
1467 | |
---|
1468 | |
---|
1469 | void setfbosd() |
---|
1470 | { |
---|
1471 | debug(101, "################## set osd offset ####################"); |
---|
1472 | debug(101, "status.leftoffset: %d", status.leftoffset); |
---|
1473 | debug(101, "status.rightoffset: %d", status.rightoffset); |
---|
1474 | debug(101, "status.topoffset: %d", status.topoffset); |
---|
1475 | debug(101, "status.bottomoffset: %d", status.bottomoffset); |
---|
1476 | |
---|
1477 | char* fbleftdev = "/proc/stb/fb/dst_left"; |
---|
1478 | char* fbwidthdev = "/proc/stb/fb/dst_width"; |
---|
1479 | char* fbtopdev = "/proc/stb/fb/dst_top"; |
---|
1480 | char* fbheightdev = "/proc/stb/fb/dst_height"; |
---|
1481 | |
---|
1482 | int fbleft = strtol(getfbosddev(fbleftdev) , NULL, 16); |
---|
1483 | int fbwidth = strtol(getfbosddev(fbwidthdev) , NULL, 16); |
---|
1484 | int fbtop = strtol(getfbosddev(fbtopdev) , NULL, 16); |
---|
1485 | int fbheight = strtol(getfbosddev(fbheightdev) , NULL, 16); |
---|
1486 | debug(101, "Setting OSD position: %d %d %d %d", fbleft ,fbwidth ,fbtop ,fbheight); |
---|
1487 | |
---|
1488 | fbleft = status.leftoffset; |
---|
1489 | fbwidth = 720 - status.leftoffset - status.rightoffset; |
---|
1490 | fbtop = status.topoffset; |
---|
1491 | fbheight = 576 - status.topoffset - status.bottomoffset; |
---|
1492 | debug(101, "Setting OSD position changed: %d %d %d %d", fbleft ,fbwidth ,fbtop ,fbheight); |
---|
1493 | debug(10, "Setting OSD position changed: %d %d %d %d", fbleft ,fbwidth ,fbtop ,fbheight); |
---|
1494 | |
---|
1495 | setfbosddev(fbleftdev, fbleft); |
---|
1496 | setfbosddev(fbwidthdev, fbwidth); |
---|
1497 | setfbosddev(fbtopdev, fbtop); |
---|
1498 | setfbosddev(fbheightdev, fbheight); |
---|
1499 | debug(101, "######################################################"); |
---|
1500 | } |
---|
1501 | |
---|
1502 | int setrtctimemips() |
---|
1503 | { |
---|
1504 | char *rtctimedev = NULL, *tmpstr = NULL; |
---|
1505 | int ret = 0; |
---|
1506 | // int value = 0; |
---|
1507 | |
---|
1508 | time_t t = time(NULL); |
---|
1509 | struct tm *local = localtime(&t); |
---|
1510 | time_t rawlocal = mktime(local); |
---|
1511 | |
---|
1512 | t = time(NULL); |
---|
1513 | struct tm *gmt = gmtime(&t); |
---|
1514 | time_t rawgmt = mktime(gmt); |
---|
1515 | |
---|
1516 | int offset = difftime(rawlocal, rawgmt); |
---|
1517 | |
---|
1518 | tmpstr = oitoa(offset); |
---|
1519 | rtctimedev = getconfig("rtctime_offsetdev", NULL); |
---|
1520 | if(rtctimedev != NULL) |
---|
1521 | ret = writesys(rtctimedev, tmpstr, 0); |
---|
1522 | else |
---|
1523 | ret = writesys("/proc/stb/fp/rtc_offset", tmpstr, 0); |
---|
1524 | free(tmpstr); tmpstr = NULL; |
---|
1525 | rtctimedev = NULL; |
---|
1526 | |
---|
1527 | if(ret == 0) |
---|
1528 | { |
---|
1529 | tmpstr = oitoa(rawlocal); |
---|
1530 | rtctimedev = getconfig("rtctimedev", NULL); |
---|
1531 | if(rtctimedev != NULL) |
---|
1532 | ret = writesys(rtctimedev, tmpstr, 0); |
---|
1533 | else |
---|
1534 | ret = writesys("/proc/stb/fp/rtc", tmpstr, 0); |
---|
1535 | free(tmpstr); tmpstr = NULL; |
---|
1536 | rtctimedev = NULL; |
---|
1537 | } |
---|
1538 | return ret; |
---|
1539 | } |
---|
1540 | |
---|
1541 | #endif |
---|