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=d0cc7543476b497d8f9cecc7095f36028ae417bc;hb=88d814e3677c8b71a62382bf839f452960472cac;hpb=2798b18cd4b43be61c95ed1af12b02237424c06f diff --git a/common/host_fb.c b/common/host_fb.c index d0cc754..6be9526 100644 --- a/common/host_fb.c +++ b/common/host_fb.c @@ -1,4 +1,9 @@ -// vim:shiftwidth=2:expandtab +/* + * GINGE - GINGE Is Not Gp2x Emulator + * (C) notaz, 2010-2011 + * + * This work is licensed under the MAME license, see COPYING file for details. + */ #include #ifdef LOADER #include "../loader/realfuncs.h" @@ -11,11 +16,32 @@ static int host_stride; #if defined(PND) -#include "linux/fbdev.c" +#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); @@ -32,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; @@ -115,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" @@ -204,5 +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