X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvideo%2Fomapdss%2Fosdl_video.c;h=d00b6b97209eb0370b21f866fa0f186c3a0d3c82;hb=f151701dfcb28c9ce6adb5f5c8c89a97d74a5076;hp=fc780010332d5cdf95e1618b4a4882f4e123b354;hpb=6f13ad979616aae6272b6cc2f46566ed9823a7a6;p=sdl_omap.git diff --git a/src/video/omapdss/osdl_video.c b/src/video/omapdss/osdl_video.c index fc78001..d00b6b9 100644 --- a/src/video/omapdss/osdl_video.c +++ b/src/video/omapdss/osdl_video.c @@ -1,5 +1,5 @@ /* - * (C) Gražvydas "notaz" Ignotas, 2010 + * (C) Gražvydas "notaz" Ignotas, 2010-2011 * * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING file in the top-level directory. @@ -20,7 +20,7 @@ #include "omapsdl.h" #include "omapfb.h" #include "linux/fbdev.h" -#include "linux/oshide.h" +#include "linux/xenv.h" struct omapfb_saved_layer { struct omapfb_plane_info pi; @@ -62,11 +62,13 @@ static int osdl_setup_omapfb(int fd, int enabled, int x, int y, int w, int h, in err_perror("SETUP_PLANE"); } - mi.size = mem; - ret = ioctl(fd, OMAPFB_SETUP_MEM, &mi); - if (ret != 0) { - err_perror("SETUP_MEM"); - return -1; + if (mi.size < mem) { + mi.size = mem; + ret = ioctl(fd, OMAPFB_SETUP_MEM, &mi); + if (ret != 0) { + err_perror("SETUP_MEM"); + return -1; + } } pi.pos_x = x; @@ -222,6 +224,7 @@ 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; @@ -260,31 +263,39 @@ 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) * 3); + ret = osdl_setup_omapfb(fd, 1, x, y, w, h, width * height * ((bpp + 7) / 8) * 2); close(fd); return ret; } -int osdl_video_set_mode(struct SDL_PrivateVideoData *pdata, int width, int height, int bpp) +int osdl_video_set_mode(struct SDL_PrivateVideoData *pdata, + int width, int height, int bpp, int doublebuf) { const char *fbname; int ret; - bpp = 16; // FIXME - fbname = get_fb_device(); if (pdata->fbdev != NULL) { @@ -292,19 +303,18 @@ int osdl_video_set_mode(struct SDL_PrivateVideoData *pdata, int width, int heigh pdata->fbdev = NULL; } - omapsdl_config_from_env(); - ret = osdl_setup_omap_layer(pdata, fbname, width, height, bpp); if (ret < 0) return -1; - pdata->fbdev = vout_fbdev_init(fbname, &width, &height, 0); + pdata->fbdev = vout_fbdev_init(fbname, &width, &height, bpp, doublebuf ? 2 : 1); if (pdata->fbdev == NULL) return -1; - if (!pdata->oshide_done) { - oshide_init(); - pdata->oshide_done = 1; + if (!pdata->xenv_up) { + ret = xenv_init(); + if (ret == 0) + pdata->xenv_up = 1; } return 0; @@ -354,9 +364,9 @@ void osdl_video_finish(struct SDL_PrivateVideoData *pdata) pdata->saved_layer = NULL; } - if (pdata->oshide_done) { - oshide_finish(); - pdata->oshide_done = 0; + if (pdata->xenv_up) { + xenv_finish(); + pdata->xenv_up = 0; } }