X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvideo%2Fomapdss%2Fosdl_video.c;h=d1deaa984c2f8f8beb3ac75a783b98101f358c45;hb=52a1749b2a20c9b4edffb45fc78977f9980e55b6;hp=764b857bd932cd265228ca49b52659869fc1fa1b;hpb=f11c56a62f5d270a7aea3e7d63c00bda01191a78;p=sdl_omap.git diff --git a/src/video/omapdss/osdl_video.c b/src/video/omapdss/osdl_video.c index 764b857..d1deaa9 100644 --- a/src/video/omapdss/osdl_video.c +++ b/src/video/omapdss/osdl_video.c @@ -115,10 +115,36 @@ static int read_sysfs(const char *fname, char *buff, size_t size) return 0; } +int read_vscreeninfo(const char *fbname, int *w, int *h) +{ + struct fb_var_screeninfo fbvar; + int ret, fd; + + fd = open(fbname, O_RDWR); + if (fd == -1) { + err_perror("open %s", fbname); + return -1; + } + + ret = ioctl(fd, FBIOGET_VSCREENINFO, &fbvar); + close(fd); + + if (ret == -1) { + err_perror("ioctl %s", fbname); + return -1; + } + + if (fbvar.xres == 0 || fbvar.yres == 0) + return -1; + + *w = fbvar.xres; + *h = fbvar.yres; + return 0; +} + int osdl_video_detect_screen(struct SDL_PrivateVideoData *pdata) { int fb_id, overlay_id = -1, screen_id = -1; - struct fb_var_screeninfo fbvar; char buff[64], screen_name[64]; const char *fbname; struct stat status; @@ -201,26 +227,17 @@ int osdl_video_detect_screen(struct SDL_PrivateVideoData *pdata) skip_screen: /* attempt to extract this from FB then */ - fd = open(fbname, O_RDWR); - if (fd == -1) { - err_perror("open %s", fbname); - return -1; + ret = read_vscreeninfo(fbname, &pdata->phys_w, &pdata->phys_h); + if (ret != 0 && strcmp(fbname, "/dev/fb0") != 0) { + /* last resort */ + ret = read_vscreeninfo("/dev/fb0", &pdata->phys_w, &pdata->phys_h); } - ret = ioctl(fd, FBIOGET_VSCREENINFO, &fbvar); - close(fd); - if (ret == -1) { - err_perror("ioctl %s", fbname); - return -1; - } - - if (fbvar.xres == 0 || fbvar.yres == 0) { + if (ret != 0) { err("VSCREENINFO has nothing meaningful"); return -1; } - pdata->phys_w = fbvar.xres; - pdata->phys_h = fbvar.yres; return 0; } @@ -353,13 +370,17 @@ void *osdl_video_set_mode(struct SDL_PrivateVideoData *pdata, void *osdl_video_flip(struct SDL_PrivateVideoData *pdata) { + void *ret; + if (pdata->fbdev == NULL) return NULL; + ret = vout_fbdev_flip(pdata->fbdev); + if (pdata->cfg_force_vsync) vout_fbdev_wait_vsync(pdata->fbdev); - return vout_fbdev_flip(pdata->fbdev); + return ret; } void osdl_video_finish(struct SDL_PrivateVideoData *pdata)