SDL_OMAP_LAYER_SIZE:
Output layer size. Regardless what you set with SDL_SetVideoMode(), output
- will be scaled to this size using hardware. Valid values:
+ will be scaled to this size using hardware with zero processing cost.
+ Note: scaling amount range is limited to roughly 1/4x-8x. The exact range
+ depends on various factors like version of the driver or OMAP hardware itself.
+ Valid values:
"WxH", for example "640x480"
"fullscreen" to cover whole screen.
+SDL_OMAP_BORDER_CUT:
+ This can be used to move parts of SDL surface out of screen, in other
+ words cut borders and zoom in. Format: <left>,<right>,<top>,<bottom>
+ For example, "0,0,16,0" would hide top 16 lines offscreen, making 17th
+ (16th if you count from 0) line the first visible.
+ Note: like for layer size ranges are limited.
+
SDL_OMAP_VSYNC:
Enables waiting for vertical sync on SDL_Flip() calls.
Set to "1" to enable, "0" to disable.
tmp = getenv("SDL_OMAP_NO_TS_TRANSLATE");
if (tmp != NULL)
pdata->cfg_no_ts_translate = !!strtol(tmp, NULL, 0);
+ tmp = getenv("SDL_OMAP_BORDER_CUT");
+ if (tmp != NULL) {
+ int l, r, t, b;
+ if (sscanf(tmp, "%d,%d,%d,%d", &l, &r, &t, &b) == 4
+ && l >= 0 && r >= 0 && t >= 0 && b >= 0) {
+ pdata->border_l = l, pdata->border_r = r;
+ pdata->border_t = t, pdata->border_b = b;
+ }
+ else
+ err("border incorrectly specified, ignored");
+ }
}
fbdev->fbvar_new.bits_per_pixel = bpp;
fbdev->fbvar_new.nonstd = 0; // can set YUV here on omapfb
fbdev->buffer_count = buffer_cnt;
- fbdev->buffer_write = 1;
+ fbdev->buffer_write = buffer_cnt > 1 ? 1 : 0;
// seems to help a bit to avoid glitches
vout_fbdev_wait_vsync(fbdev);
int phys_w, phys_h;
/* layer */
int layer_x, layer_y, layer_w, layer_h;
+ /* SDL surface borders to hide */
+ int border_l, border_r, border_t, border_b;
/* phys -> layer coord multipliers (16.16) */
int ts_xmul, ts_ymul;
/* misc/config */
unsigned int cfg_no_ts_translate:1;
};
-int osdl_video_set_mode(struct SDL_PrivateVideoData *pdata,
+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);
void *osdl_video_flip(struct SDL_PrivateVideoData *pdata);
int osdl_video_detect_screen(struct SDL_PrivateVideoData *pdata);
return ret;
}
-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();
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();
pdata->xenv_up = 1;
}
- return 0;
+ return result;
}
void *osdl_video_flip(struct SDL_PrivateVideoData *pdata)
struct SDL_PrivateVideoData *pdata = this->hidden;
SDL_PixelFormat *format;
Uint32 unhandled_flags;
- int ret;
+ void *fbmem;
trace("%d, %d, %d, %08x", width, height, bpp, flags);
flags |= SDL_DOUBLEBUF;
}
- ret = osdl_video_set_mode(pdata, width, height, bpp,
- (flags & SDL_DOUBLEBUF) ? 1 : 0);
- if (ret < 0)
+ if (pdata->border_l | pdata->border_r | pdata->border_t | pdata->border_b) {
+ if (pdata->border_l + pdata->border_r >= width
+ || pdata->border_t + pdata->border_b >= height)
+ {
+ err("specified border too large, ignoring");
+ pdata->border_l = pdata->border_r = pdata->border_t = pdata->border_b = 0;
+ }
+ }
+
+ fbmem = osdl_video_set_mode(pdata,
+ pdata->border_l, pdata->border_r, pdata->border_t, pdata->border_b,
+ width, height, bpp, (flags & SDL_DOUBLEBUF) ? 1 : 0);
+ if (fbmem == NULL) {
+ log("failing on mode %dx%d@%d, doublebuf %s",
+ width, height, bpp, (flags & SDL_DOUBLEBUF) ? "on" : "off");
return NULL;
+ }
flags |= SDL_FULLSCREEN | SDL_HWSURFACE;
unhandled_flags = flags & ~(SDL_FULLSCREEN | SDL_HWSURFACE | SDL_DOUBLEBUF);
current->w = width;
current->h = height;
current->pitch = SDL_CalculatePitch(current);
+ current->pixels = fbmem;
if (pdata->layer_w != 0 && pdata->layer_h != 0) {
- pdata->ts_xmul = (width << 16) / pdata->layer_w;
- pdata->ts_ymul = (height << 16) / pdata->layer_h;
+ int v_width = width - (pdata->border_l + pdata->border_r);
+ int v_height = height - (pdata->border_t + pdata->border_b);
+ pdata->ts_xmul = (v_width << 16) / pdata->layer_w;
+ pdata->ts_ymul = (v_height << 16) / pdata->layer_h;
}
- current->pixels = osdl_video_flip(pdata);
-
return current;
}
int xoffs;
if (!pdata->cfg_no_ts_translate && pdata->layer_w != 0 && pdata->layer_h != 0) {
- x = (x - pdata->layer_x) * pdata->ts_xmul >> 16;
- y = (y - pdata->layer_y) * pdata->ts_ymul >> 16;
+ x = pdata->border_l + ((x - pdata->layer_x) * pdata->ts_xmul >> 16);
+ y = pdata->border_t + ((y - pdata->layer_y) * pdata->ts_ymul >> 16);
clamp(x, 0, this->screen->w);
clamp(y, 0, this->screen->h);
}