X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvideo%2Fomapdss%2Fosdl_video.c;h=fce7eeacc8e03945637b0d66fc167ac19f631bc6;hb=5f4b1fd346a57d90ffda9eaba68c7b0b0aa8acab;hp=ee4c95a1deed64e78ebe32585a32c7aedad05a2a;hpb=0bb19c41766026c798f9c2aa9dc433a9403c8e39;p=sdl_omap.git diff --git a/src/video/omapdss/osdl_video.c b/src/video/omapdss/osdl_video.c index ee4c95a..fce7eea 100644 --- a/src/video/omapdss/osdl_video.c +++ b/src/video/omapdss/osdl_video.c @@ -42,6 +42,9 @@ static int osdl_setup_omapfb(int fd, int enabled, int x, int y, int w, int h, in struct omapfb_mem_info mi; int ret; + memset(&pi, 0, sizeof(pi)); + memset(&mi, 0, sizeof(mi)); + ret = ioctl(fd, OMAPFB_QUERY_PLANE, &pi); if (ret != 0) { err_perror("QUERY_PLANE"); @@ -123,6 +126,8 @@ int osdl_video_detect_screen(struct SDL_PrivateVideoData *pdata) int w, h; FILE *f; + pdata->phys_w = pdata->phys_h = 0; + fbname = get_fb_device(); /* Figure out screen resolution, we need to know default resolution @@ -190,8 +195,8 @@ int osdl_video_detect_screen(struct SDL_PrivateVideoData *pdata) log("detected %dx%d '%s' (%d) screen attached to fb %d and overlay %d", w, h, screen_name, screen_id, fb_id, overlay_id); - pdata->screen_w = w; - pdata->screen_h = h; + pdata->phys_w = w; + pdata->phys_h = h; return 0; skip_screen: @@ -214,8 +219,8 @@ skip_screen: return -1; } - pdata->screen_w = fbvar.xres; - pdata->screen_h = fbvar.yres; + pdata->phys_w = fbvar.xres; + pdata->phys_h = fbvar.yres; return 0; } @@ -224,13 +229,16 @@ static int osdl_setup_omap_layer(struct SDL_PrivateVideoData *pdata, { int x = 0, y = 0, w = width, h = height; /* layer size and pos */ int screen_w = w, screen_h = h; + int tmp_w, tmp_h; const char *tmp; int ret, fd; - if (pdata->screen_w != 0) - screen_w = pdata->screen_w; - if (pdata->screen_h != 0) - screen_h = pdata->screen_h; + pdata->layer_x = pdata->layer_y = pdata->layer_w = pdata->layer_h = 0; + + if (pdata->phys_w != 0) + screen_w = pdata->phys_w; + if (pdata->phys_h != 0) + screen_h = pdata->phys_h; fd = open(fbname, O_RDWR); if (fd == -1) { @@ -262,19 +270,34 @@ static int osdl_setup_omap_layer(struct SDL_PrivateVideoData *pdata, tmp = getenv("SDL_OMAP_LAYER_SIZE"); if (tmp != NULL) { - int w_, h_; if (strcasecmp(tmp, "fullscreen") == 0) w = screen_w, h = screen_h; - else if (sscanf(tmp, "%dx%d", &w_, &h_) == 2) - w = w_, h = h_; + else if (sscanf(tmp, "%dx%d", &tmp_w, &tmp_h) == 2) + w = tmp_w, h = tmp_h; else err("layer size specified incorrectly, " "should be like 800x480"); } + else { + /* the layer can't be set larger than screen */ + tmp_w = w, tmp_h = h; + if (w > screen_w) + w = screen_w; + if (h > screen_h) + h = screen_h; + if (w != tmp_w || h != tmp_h) + log("layer resized %dx%d -> %dx%d to fit screen", tmp_w, tmp_h, w, h); + } x = screen_w / 2 - w / 2; y = screen_h / 2 - h / 2; ret = osdl_setup_omapfb(fd, 1, x, y, w, h, width * height * ((bpp + 7) / 8) * 2); + if (ret == 0) { + pdata->layer_x = x; + pdata->layer_y = y; + pdata->layer_w = w; + pdata->layer_h = h; + } close(fd); return ret; @@ -315,7 +338,7 @@ void *osdl_video_flip(struct SDL_PrivateVideoData *pdata) if (pdata->fbdev == NULL) return NULL; - if (gcfg_force_vsync) + if (pdata->cfg_force_vsync) vout_fbdev_wait_vsync(pdata->fbdev); return vout_fbdev_flip(pdata->fbdev);