From 55d7dcb20976811ae79f5fa2106e647c8879bfc6 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 24 Sep 2013 00:47:33 +0300 Subject: [PATCH] pandora: use automatic tv layer switch --- platform/libpicofe | 2 +- platform/pandora/plat.c | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 10 deletions(-) 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(); -- 2.39.5