X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=ginge.git;a=blobdiff_plain;f=common%2Fhost_fb.c;h=6be95262837ccdafb89b73b1bdddb9f3b434b21a;hp=4583a4cb376900d3fe84660480931d837b37adc2;hb=f2a1fca9e81b773927c0b28dffaa6e2ee8a5956a;hpb=15a2d3ea45a26875a4c1199660c88a5cb6aed070 diff --git a/common/host_fb.c b/common/host_fb.c index 4583a4c..6be9526 100644 --- a/common/host_fb.c +++ b/common/host_fb.c @@ -17,10 +17,31 @@ static int host_stride; #if defined(PND) #include "libpicofe/linux/fbdev.c" +#include "omapfb.h" static struct vout_fbdev *fbdev; static unsigned short host_pal[256]; +static int get_layer_size(int *x, int *y, int *w, int *h) +{ + struct omapfb_plane_info pi; + int ret; + + ret = ioctl(vout_fbdev_get_fd(fbdev), OMAPFB_QUERY_PLANE, &pi); + if (ret != 0) { + perror("OMAPFB_QUERY_PLANE"); + return -1; + } + + *x = pi.pos_x; + *y = pi.pos_y; + *w = pi.out_width; + *h = pi.out_height; + printf("layer: %d,%d %dx%d\n", *x, *y, *w, *h); + + return 0; +} + void *host_video_flip(void) { host_screen = vout_fbdev_flip(fbdev); @@ -37,7 +58,7 @@ int host_video_init(int *stride, int no_dblbuf) fbdev_name = "/dev/fb1"; w = h = 0; - fbdev = vout_fbdev_init(fbdev_name, &w, &h, 16, no_dblbuf); + fbdev = vout_fbdev_init(fbdev_name, &w, &h, 16, no_dblbuf ? 1 : 3); if (fbdev == NULL) return -1; @@ -120,6 +141,18 @@ void host_video_blit16(const unsigned short *src, int w, int h, int stride) host_video_flip(); } +void host_video_normalize_ts(int *x1024, int *y1024) +{ + static int lx, ly, lw = 800, lh = 480, checked; + + if (!checked) { + get_layer_size(&lx, &ly, &lw, &lh); + checked = 1; // XXX: might change, so may need to recheck + } + *x1024 = (*x1024 - lx) * 1024 / lw; + *y1024 = (*y1024 - ly) * 1024 / lh; +} + #elif defined(WIZ) #include "warm/warm.c" @@ -209,6 +242,12 @@ void host_video_blit16(const unsigned short *src, int w, int h, int stride) } #endif // LOADER +void host_video_normalize_ts(int *x1024, int *y1024) +{ + *x1024 = *x1024 * 1024 / 320; + *y1024 = *y1024 * 1024 / 240; +} + #endif // WIZ // vim:shiftwidth=2:expandtab