pandora: use automatic tv layer switch
authornotaz <notasas@gmail.com>
Mon, 23 Sep 2013 21:47:33 +0000 (00:47 +0300)
committernotaz <notasas@gmail.com>
Tue, 24 Sep 2013 00:57:43 +0000 (03:57 +0300)
platform/libpicofe
platform/pandora/plat.c

index 18306c3..1bc471e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 18306c325f0d24fc7232dff055e814432e06d5d1
+Subproject commit 1bc471ebf1c85cf78f1862f5596a76f051e7112d
index 2171c03..f7d6879 100644 (file)
@@ -33,6 +33,8 @@
 \r
 #include <pico/pico_int.h>\r
 \r
+#define LAYER_MEM_SIZE (320*240*2 * 4)\r
+\r
 static struct vout_fbdev *main_fb, *layer_fb;\r
 // g_layer_* - in use, g_layer_c* - configured custom\r
 int g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch;\r
@@ -239,6 +241,8 @@ static int pnd_setup_layer_(int fd, int enabled, int x, int y, int w, int h)
 {\r
        struct omapfb_plane_info pi;\r
        struct omapfb_mem_info mi;\r
+       int is_enabled;\r
+       int retval = 0;\r
        int ret;\r
 \r
        ret = ioctl(fd, OMAPFB_QUERY_PLANE, &pi);\r
@@ -254,18 +258,27 @@ static int pnd_setup_layer_(int fd, int enabled, int x, int y, int w, int h)
        }\r
 \r
        /* must disable when changing stuff */\r
-       if (pi.enabled) {\r
+       is_enabled = pi.enabled;\r
+       if (is_enabled) {\r
                pi.enabled = 0;\r
                ret = ioctl(fd, OMAPFB_SETUP_PLANE, &pi);\r
                if (ret != 0)\r
                        perror("SETUP_PLANE");\r
+               else\r
+                       is_enabled = 0;\r
        }\r
 \r
-       mi.size = 320*240*2*4;\r
-       ret = ioctl(fd, OMAPFB_SETUP_MEM, &mi);\r
-       if (ret != 0) {\r
-               perror("SETUP_MEM");\r
-               return -1;\r
+       if (mi.size < LAYER_MEM_SIZE) {\r
+               unsigned int size_old = mi.size;\r
+\r
+               mi.size = LAYER_MEM_SIZE;\r
+               ret = ioctl(fd, OMAPFB_SETUP_MEM, &mi);\r
+               if (ret != 0) {\r
+                       perror("SETUP_MEM");\r
+                       fprintf(stderr, "(requested %u, had %u)\n",\r
+                               mi.size, size_old);\r
+                       return -1;\r
+               }\r
        }\r
 \r
        pi.pos_x = x;\r
@@ -275,12 +288,17 @@ static int pnd_setup_layer_(int fd, int enabled, int x, int y, int w, int h)
        pi.enabled = enabled;\r
 \r
        ret = ioctl(fd, OMAPFB_SETUP_PLANE, &pi);\r
-       if (ret != 0) {\r
+       if (ret == 0) {\r
+               is_enabled = pi.enabled;\r
+       }\r
+       else {\r
                perror("SETUP_PLANE");\r
-               return -1;\r
+               retval = -1;\r
        }\r
 \r
-       return 0;\r
+       plat_target_switch_layer(1, is_enabled);\r
+\r
+       return retval;\r
 }\r
 \r
 int pnd_setup_layer(int enabled, int x, int y, int w, int h)\r
@@ -479,6 +497,9 @@ void plat_init(void)
 \r
        pnd_menu_init();\r
 \r
+       // default ROM path\r
+       strcpy(rom_fname_loaded, "/media");\r
+\r
        in_evdev_init(in_evdev_defbinds);\r
        in_probe();\r
        plat_target_setup_input();\r