Output layer size. Regardless what you set with SDL_SetVideoMode(), output
will be scaled to this size using hardware. Valid values:
"WxH", for example "640x480"
- "fullscreen" for to cover whole screen.
+ "fullscreen" to cover whole screen.
SDL_OMAP_VSYNC:
Enables waiting for vertical sync on SDL_Flip() calls.
If the app doesn't specify resolution in SDL_SetVideoMode(), then use this.
Should be specified in "WxH" format, for example "640x480".
+SDL_OMAP_FORCE_DOUBLEBUF:
+ This can force double buffering to on, which can help to eliminate tearing.
+ Note that if app isn't updating whole buffer each frame, it will glitch.
+ This is the same as specifying SDL_DOUBLEBUF to SDL_SetVideoMode.
+
Config file
-----------
# same as SDL_OMAP_VSYNC
force_vsync = 1/0
+# same as SDL_OMAP_FORCE_DOUBLEBUF
+force_doublebuf = 1/0
+
# can be used to bind a key to SDL keysym, good for quick ports.
# Example:
# bind ev_home = sdlk_space
#include "omapsdl.h"
int gcfg_force_vsync;
+int gcfg_force_doublebuf;
static char *sskip(char *p)
{
gcfg_force_vsync = strtol(p, NULL, 0);
continue;
}
+ else if (check_token_eq(&p, "force_doublebuf")) {
+ gcfg_force_doublebuf = strtol(p, NULL, 0);
+ continue;
+ }
bad:
err("config: failed to parse: %s", line);
tmp = getenv("SDL_OMAP_VSYNC");
if (tmp != NULL)
- gcfg_force_vsync = atoi(tmp);
+ gcfg_force_vsync = strtol(tmp, NULL, 0);
+ tmp = getenv("SDL_OMAP_FORCE_DOUBLEBUF");
+ if (tmp != NULL)
+ gcfg_force_doublebuf = strtol(tmp, NULL, 0);
}
/*
- * (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.
unsigned int xenv_up:1;
};
-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);
void *osdl_video_flip(struct SDL_PrivateVideoData *pdata);
int osdl_video_detect_screen(struct SDL_PrivateVideoData *pdata);
void osdl_video_finish(struct SDL_PrivateVideoData *pdata);
/* config */
extern int gcfg_force_vsync;
+extern int gcfg_force_doublebuf;
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;
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, bpp, 2);
+ pdata->fbdev = vout_fbdev_init(fbname, &width, &height, bpp, doublebuf ? 2 : 1);
if (pdata->fbdev == NULL)
return -1;
int height, int bpp, Uint32 flags)
{
SDL_PixelFormat *format;
+ Uint32 unhandled_flags;
+ int ret;
trace("%d, %d, %d, %08x", width, height, bpp, flags);
+ omapsdl_config_from_env();
+
switch (bpp) {
case 16:
format = SDL_ReallocFormat(current, 16, 0xf800, 0x07e0, 0x001f, 0);
format = SDL_ReallocFormat(current, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
break;
default:
- err("SetVideoMode: bpp %d not supported\n", bpp);
+ err("SetVideoMode: bpp %d not supported", bpp);
return NULL;
}
if (format == NULL)
return NULL;
- if (osdl_video_set_mode(this->hidden, width, height, bpp) < 0)
+ if (!(flags & SDL_DOUBLEBUF) && gcfg_force_doublebuf) {
+ log("forcing SDL_DOUBLEBUF");
+ flags |= SDL_DOUBLEBUF;
+ }
+
+ ret = osdl_video_set_mode(this->hidden, width, height, bpp,
+ (flags & SDL_DOUBLEBUF) ? 1 : 0);
+ if (ret < 0)
return NULL;
- current->flags = SDL_FULLSCREEN | SDL_DOUBLEBUF | SDL_HWSURFACE;
+ flags |= SDL_FULLSCREEN | SDL_HWSURFACE;
+ unhandled_flags = flags & ~(SDL_FULLSCREEN | SDL_HWSURFACE | SDL_DOUBLEBUF);
+ if (unhandled_flags != 0) {
+ log("dropping unhandled flags: %08x", unhandled_flags);
+ flags &= ~unhandled_flags;
+ }
+
+ current->flags = flags;
current->w = width;
current->h = height;
current->pitch = SDL_CalculatePitch(current);
{
trace("%d, %p", nrects, rects);
- if (nrects != 1 || rects->x != 0 || rects->y != 0 ||
- rects->w != this->screen->w || rects->h != this->screen->h) {
- static int warned = 0;
- if (!warned) {
- not_supported();
- warned = 1;
- }
+ /* hmh.. */
+ if (nrects == 1 && rects->x == 0 && rects->y == 0 &&
+ (this->screen->flags & SDL_DOUBLEBUF) &&
+ rects->w == this->screen->w && rects->h == this->screen->h)
+ {
+ this->screen->pixels = osdl_video_flip(this->hidden);
}
-
- this->screen->pixels = osdl_video_flip(this->hidden);
}
static void omap_InitOSKeymap(SDL_VideoDevice *this)