use offscreen blitting when SDL_DOUBLEBUF is not set
[sdl_omap.git] / src / video / omapdss / config.c
index a70cd3c..10a9036 100644 (file)
@@ -11,9 +11,7 @@
 #include <strings.h>
 #include <ctype.h>
 
-#include "omapsdl.h"
-
-int gcfg_force_vsync;
+#include "osdl.h"
 
 static char *sskip(char *p)
 {
@@ -51,7 +49,7 @@ static int check_token_eq(char **p_, const char *token)
        return ret;
 }
 
-void omapsdl_config(void)
+void omapsdl_config(struct SDL_PrivateVideoData *pdata)
 {
        char buff[256];
        FILE *f;
@@ -86,7 +84,23 @@ void omapsdl_config(void)
                        continue;
                }
                else if (check_token_eq(&p, "force_vsync")) {
-                       gcfg_force_vsync = strtol(p, NULL, 0);
+                       pdata->cfg_force_vsync = !!strtol(p, NULL, 0);
+                       continue;
+               }
+               else if (check_token_eq(&p, "force_doublebuf")) {
+                       pdata->cfg_force_doublebuf = !!strtol(p, NULL, 0);
+                       continue;
+               }
+               else if (check_token_eq(&p, "force_directbuf")) {
+                       pdata->cfg_force_directbuf = !!strtol(p, NULL, 0);
+                       continue;
+               }
+               else if (check_token_eq(&p, "no_ts_translate")) {
+                       pdata->cfg_no_ts_translate = !!strtol(p, NULL, 0);
+                       continue;
+               }
+               else if (check_token_eq(&p, "ts_force_tslib")) {
+                       pdata->cfg_ts_force_tslib = !!strtol(p, NULL, 0);
                        continue;
                }
 
@@ -96,12 +110,35 @@ bad:
        fclose(f);
 }
 
-void omapsdl_config_from_env(void)
+void omapsdl_config_from_env(struct SDL_PrivateVideoData *pdata)
 {
        const char *tmp;
 
        tmp = getenv("SDL_OMAP_VSYNC");
        if (tmp != NULL)
-               gcfg_force_vsync = atoi(tmp);
+               pdata->cfg_force_vsync = !!strtol(tmp, NULL, 0);
+       tmp = getenv("SDL_OMAP_FORCE_DOUBLEBUF");
+       if (tmp != NULL)
+               pdata->cfg_force_doublebuf = !!strtol(tmp, NULL, 0);
+       tmp = getenv("SDL_OMAP_FORCE_DIRECTBUF");
+       if (tmp != NULL)
+               pdata->cfg_force_directbuf = !!strtol(tmp, NULL, 0);
+       tmp = getenv("SDL_OMAP_NO_TS_TRANSLATE");
+       if (tmp != NULL)
+               pdata->cfg_no_ts_translate = !!strtol(tmp, NULL, 0);
+       tmp = getenv("SDL_OMAP_TS_FORCE_TSLIB");
+       if (tmp != NULL)
+               pdata->cfg_ts_force_tslib = !!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");
+       }
 }