From: notaz Date: Mon, 23 Sep 2013 21:47:33 +0000 (+0300) Subject: pandora: use automatic tv layer switch X-Git-Tag: v1.90~4 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55d7dcb20976811ae79f5fa2106e647c8879bfc6;p=picodrive.git pandora: use automatic tv layer switch --- diff --git a/platform/libpicofe b/platform/libpicofe index 18306c32..1bc471eb 160000 --- a/platform/libpicofe +++ b/platform/libpicofe @@ -1 +1 @@ -Subproject commit 18306c325f0d24fc7232dff055e814432e06d5d1 +Subproject commit 1bc471ebf1c85cf78f1862f5596a76f051e7112d diff --git a/platform/pandora/plat.c b/platform/pandora/plat.c index 2171c036..f7d68792 100644 --- a/platform/pandora/plat.c +++ b/platform/pandora/plat.c @@ -33,6 +33,8 @@ #include +#define LAYER_MEM_SIZE (320*240*2 * 4) + static struct vout_fbdev *main_fb, *layer_fb; // g_layer_* - in use, g_layer_c* - configured custom int g_layer_cx, g_layer_cy, g_layer_cw, g_layer_ch; @@ -239,6 +241,8 @@ static int pnd_setup_layer_(int fd, int enabled, int x, int y, int w, int h) { struct omapfb_plane_info pi; struct omapfb_mem_info mi; + int is_enabled; + int retval = 0; int ret; ret = ioctl(fd, OMAPFB_QUERY_PLANE, &pi); @@ -254,18 +258,27 @@ static int pnd_setup_layer_(int fd, int enabled, int x, int y, int w, int h) } /* must disable when changing stuff */ - if (pi.enabled) { + is_enabled = pi.enabled; + if (is_enabled) { pi.enabled = 0; ret = ioctl(fd, OMAPFB_SETUP_PLANE, &pi); if (ret != 0) perror("SETUP_PLANE"); + else + is_enabled = 0; } - mi.size = 320*240*2*4; - ret = ioctl(fd, OMAPFB_SETUP_MEM, &mi); - if (ret != 0) { - perror("SETUP_MEM"); - return -1; + if (mi.size < LAYER_MEM_SIZE) { + unsigned int size_old = mi.size; + + mi.size = LAYER_MEM_SIZE; + ret = ioctl(fd, OMAPFB_SETUP_MEM, &mi); + if (ret != 0) { + perror("SETUP_MEM"); + fprintf(stderr, "(requested %u, had %u)\n", + mi.size, size_old); + return -1; + } } pi.pos_x = x; @@ -275,12 +288,17 @@ static int pnd_setup_layer_(int fd, int enabled, int x, int y, int w, int h) pi.enabled = enabled; ret = ioctl(fd, OMAPFB_SETUP_PLANE, &pi); - if (ret != 0) { + if (ret == 0) { + is_enabled = pi.enabled; + } + else { perror("SETUP_PLANE"); - return -1; + retval = -1; } - return 0; + plat_target_switch_layer(1, is_enabled); + + return retval; } int pnd_setup_layer(int enabled, int x, int y, int w, int h) @@ -479,6 +497,9 @@ void plat_init(void) pnd_menu_init(); + // default ROM path + strcpy(rom_fname_loaded, "/media"); + in_evdev_init(in_evdev_defbinds); in_probe(); plat_target_setup_input();