X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvideo%2Fomapdss%2Fosdl_video.c;h=764b857bd932cd265228ca49b52659869fc1fa1b;hb=f11c56a62f5d270a7aea3e7d63c00bda01191a78;hp=fce7eeacc8e03945637b0d66fc167ac19f631bc6;hpb=5f4b1fd346a57d90ffda9eaba68c7b0b0aa8acab;p=sdl_omap.git diff --git a/src/video/omapdss/osdl_video.c b/src/video/omapdss/osdl_video.c index fce7eea..764b857 100644 --- a/src/video/omapdss/osdl_video.c +++ b/src/video/omapdss/osdl_video.c @@ -231,6 +231,7 @@ static int osdl_setup_omap_layer(struct SDL_PrivateVideoData *pdata, int screen_w = w, screen_h = h; int tmp_w, tmp_h; const char *tmp; + int retval = -1; int ret, fd; pdata->layer_x = pdata->layer_y = pdata->layer_w = pdata->layer_h = 0; @@ -251,18 +252,18 @@ static int osdl_setup_omap_layer(struct SDL_PrivateVideoData *pdata, struct omapfb_saved_layer *slayer; slayer = calloc(1, sizeof(*slayer)); if (slayer == NULL) - return -1; + goto out; ret = ioctl(fd, OMAPFB_QUERY_PLANE, &slayer->pi); if (ret != 0) { err_perror("QUERY_PLANE"); - return -1; + goto out; } ret = ioctl(fd, OMAPFB_QUERY_MEM, &slayer->mi); if (ret != 0) { err_perror("QUERY_MEM"); - return -1; + goto out; } pdata->saved_layer = slayer; @@ -278,16 +279,15 @@ static int osdl_setup_omap_layer(struct SDL_PrivateVideoData *pdata, 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); - } + + /* 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; @@ -298,15 +298,19 @@ static int osdl_setup_omap_layer(struct SDL_PrivateVideoData *pdata, pdata->layer_w = w; pdata->layer_h = h; } - close(fd); - return ret; + retval = ret; +out: + close(fd); + return retval; } -int osdl_video_set_mode(struct SDL_PrivateVideoData *pdata, - int width, int height, int bpp, int doublebuf) +void *osdl_video_set_mode(struct SDL_PrivateVideoData *pdata, + int border_l, int border_r, int border_t, int border_b, + int width, int height, int bpp, int doublebuf) { const char *fbname; + void *result; int ret; fbname = get_fb_device(); @@ -318,11 +322,25 @@ int osdl_video_set_mode(struct SDL_PrivateVideoData *pdata, ret = osdl_setup_omap_layer(pdata, fbname, width, height, bpp); if (ret < 0) - return -1; + return NULL; pdata->fbdev = vout_fbdev_init(fbname, &width, &height, bpp, doublebuf ? 2 : 1); if (pdata->fbdev == NULL) - return -1; + return NULL; + + if (border_l | border_r | border_t | border_b) { + width -= border_l + border_r; + height -= border_t + border_b; + result = vout_fbdev_resize(pdata->fbdev, width, height, bpp, + border_l, border_r, border_t, border_b, doublebuf ? 2 : 1); + } + else { + result = osdl_video_flip(pdata); + } + if (result == NULL) { + osdl_video_finish(pdata); + return NULL; + } if (!pdata->xenv_up) { ret = xenv_init(); @@ -330,7 +348,7 @@ int osdl_video_set_mode(struct SDL_PrivateVideoData *pdata, pdata->xenv_up = 1; } - return 0; + return result; } void *osdl_video_flip(struct SDL_PrivateVideoData *pdata)