aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/menu.c9
-rw-r--r--frontend/omap.h6
-rw-r--r--frontend/plat.h6
-rw-r--r--frontend/plat_dummy.c26
-rw-r--r--frontend/plat_omap.c51
-rw-r--r--frontend/plat_pollux.c38
-rw-r--r--frontend/plugin_lib.c50
-rw-r--r--frontend/plugin_lib.h5
8 files changed, 109 insertions, 82 deletions
diff --git a/frontend/menu.c b/frontend/menu.c
index 27ba825..989c6ec 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -22,7 +22,6 @@
#include "config.h"
#include "plugin.h"
#include "plugin_lib.h"
-#include "omap.h"
#include "plat.h"
#include "pcnt.h"
#include "common/plat.h"
@@ -1147,7 +1146,7 @@ static int menu_loop_cscaler(int id, int keys)
scaling = SCALE_CUSTOM;
- omap_enable_layer(1);
+ plat_gvideo_open();
for (;;)
{
@@ -1182,11 +1181,12 @@ static int menu_loop_cscaler(int id, int keys)
g_layer_w = 800 - g_layer_x;
if (g_layer_y + g_layer_h > 480)
g_layer_h = 480 - g_layer_y;
- omap_enable_layer(1);
+ // resize the layer
+ plat_gvideo_open();
}
}
- omap_enable_layer(0);
+ plat_gvideo_close();
return 0;
}
@@ -2258,6 +2258,7 @@ void menu_init(void)
#endif
}
+// XXX: should really menu code cotrol the layer size?
void menu_notify_mode_change(int w, int h, int bpp)
{
float mult;
diff --git a/frontend/omap.h b/frontend/omap.h
deleted file mode 100644
index 5cd78ed..0000000
--- a/frontend/omap.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-extern struct vout_fbdev *layer_fb;
-extern int g_layer_x, g_layer_y;
-extern int g_layer_w, g_layer_h;
-
-int omap_enable_layer(int enabled);
diff --git a/frontend/plat.h b/frontend/plat.h
index 6a22035..9076cd5 100644
--- a/frontend/plat.h
+++ b/frontend/plat.h
@@ -5,5 +5,11 @@ int plat_cpu_clock_get(void);
int plat_cpu_clock_apply(int cpu_clock);
int plat_get_bat_capacity(void);
+// indirectly called from GPU plugin
+void plat_gvideo_open(void);
+void *plat_gvideo_set_mode(int *w, int *h, int *bpp);
+void *plat_gvideo_flip(void);
+void plat_gvideo_close(void);
+
// XXX
int plat_pandora_init(void);
diff --git a/frontend/plat_dummy.c b/frontend/plat_dummy.c
index 6249df5..9a32549 100644
--- a/frontend/plat_dummy.c
+++ b/frontend/plat_dummy.c
@@ -6,20 +6,12 @@
*/
#include "common/input.h"
-#include "linux/fbdev.h"
#include "plat.h"
-struct vout_fbdev *layer_fb;
-int g_layer_x, g_layer_y, g_layer_w, g_layer_h;
struct in_default_bind in_evdev_defbinds[] = {
{ 0, 0, 0 },
};
-int omap_enable_layer(int enabled)
-{
- return 0;
-}
-
void plat_video_menu_enter(int is_rom_loaded)
{
}
@@ -36,6 +28,24 @@ void plat_video_menu_leave(void)
{
}
+void plat_gvideo_open(void)
+{
+}
+
+void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
+{
+ return 0;
+}
+
+void *plat_gvideo_flip(void)
+{
+ return 0;
+}
+
+void plat_gvideo_close(void)
+{
+}
+
void plat_init(void)
{
}
diff --git a/frontend/plat_omap.c b/frontend/plat_omap.c
index 4ab7cf0..96f75ce 100644
--- a/frontend/plat_omap.c
+++ b/frontend/plat_omap.c
@@ -1,5 +1,5 @@
/*
- * (C) notaz, 2010
+ * (C) GraÅžvydas "notaz" Ignotas, 2010-2012
*
* This work is licensed under the terms of the GNU GPLv2 or later.
* See the COPYING file in the top-level directory.
@@ -19,15 +19,10 @@
#include "linux/xenv.h"
#include "plugin_lib.h"
#include "pl_gun_ts.h"
-#include "omap.h"
#include "plat.h"
+#include "menu.h"
-
-static struct vout_fbdev *main_fb;
-int g_layer_x = 80, g_layer_y = 0;
-int g_layer_w = 640, g_layer_h = 480;
-
-struct vout_fbdev *layer_fb;
+static struct vout_fbdev *main_fb, *layer_fb;
static int omap_setup_layer_(int fd, int enabled, int x, int y, int w, int h)
{
@@ -79,7 +74,7 @@ static int omap_setup_layer_(int fd, int enabled, int x, int y, int w, int h)
return 0;
}
-int omap_enable_layer(int enabled)
+static int omap_enable_layer(int enabled)
{
if (enabled)
pl_set_gun_rect(g_layer_x, g_layer_y, g_layer_w, g_layer_h);
@@ -88,6 +83,36 @@ int omap_enable_layer(int enabled)
g_layer_x, g_layer_y, g_layer_w, g_layer_h);
}
+void plat_gvideo_open(void)
+{
+ omap_enable_layer(1);
+
+ // try to align redraws to vsync
+ vout_fbdev_wait_vsync(layer_fb);
+}
+
+void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
+{
+ void *buf;
+
+ vout_fbdev_clear(layer_fb);
+ buf = vout_fbdev_resize(layer_fb, *w, *h, *bpp, 0, 0, 0, 0, 3);
+
+ omap_enable_layer(1);
+
+ return buf;
+}
+
+void *plat_gvideo_flip(void)
+{
+ return vout_fbdev_flip(layer_fb);
+}
+
+void plat_gvideo_close(void)
+{
+ omap_enable_layer(0);
+}
+
void plat_video_menu_enter(int is_rom_loaded)
{
g_menuscreen_ptr = vout_fbdev_resize(main_fb,
@@ -133,6 +158,11 @@ void plat_trigger_vibrate(int is_strong)
{
}
+void *plat_prepare_screenshot(int *w, int *h, int *bpp)
+{
+ return NULL;
+}
+
void plat_init(void)
{
const char *main_fb_name, *layer_fb_name;
@@ -155,6 +185,9 @@ void plat_init(void)
exit(1);
}
+ g_layer_x = 80, g_layer_y = 0;
+ g_layer_w = 640, g_layer_h = 480;
+
ret = omap_setup_layer_(fd, 0, g_layer_x, g_layer_y, g_layer_w, g_layer_h);
close(fd);
if (ret != 0) {
diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c
index c03173e..012d9eb 100644
--- a/frontend/plat_pollux.c
+++ b/frontend/plat_pollux.c
@@ -49,18 +49,7 @@ static int psx_step, psx_width, psx_height, psx_bpp;
static int psx_offset_x, psx_offset_y, psx_src_width, psx_src_height;
static int fb_offset_x, fb_offset_y;
-// TODO: get rid of this
-struct vout_fbdev;
-struct vout_fbdev *layer_fb;
-int g_layer_x, g_layer_y, g_layer_w, g_layer_h;
-
-int omap_enable_layer(int enabled)
-{
- return 0;
-}
-
static void caanoo_init(void);
-static void *pl_vout_set_mode(int w, int h, int bpp);
static void *fb_flip(void)
@@ -249,7 +238,6 @@ void plat_video_menu_leave(void)
memset(g_menuscreen_ptr, 0, 320*240 * psx_bpp/8);
g_menuscreen_ptr = fb_flip();
- pl_vout_set_mode(psx_width, psx_height, psx_bpp);
}
void *plat_prepare_screenshot(int *w, int *h, int *bpp)
@@ -335,7 +323,7 @@ static void raw_flip_dma(int x, int y)
if (psx_bpp == 16) {
pl_vout_buf = g_menuscreen_ptr;
- pl_print_hud(320, fb_offset_y + psx_src_height, fb_offset_x);
+ pl_print_hud(fb_offset_x);
}
g_menuscreen_ptr = fb_flip();
@@ -364,7 +352,7 @@ static void name(int x, int y)
\
if (psx_bpp == 16) { \
pl_vout_buf = g_menuscreen_ptr; \
- pl_print_hud(320, fb_offset_y + psx_src_height, fb_offset_x); \
+ pl_print_hud(fb_offset_x); \
} \
\
g_menuscreen_ptr = fb_flip(); \
@@ -378,9 +366,10 @@ make_flip_func(raw_flip_soft_368, blit320_368)
make_flip_func(raw_flip_soft_512, blit320_512)
make_flip_func(raw_flip_soft_640, blit320_640)
-static void *pl_vout_set_mode(int w, int h, int bpp)
+void *plat_gvideo_set_mode(int *w_, int *h_, int *bpp_)
{
int poff_w, poff_h, w_max;
+ int w = *w_, h = *h_, bpp = *bpp_;
if (!w || !h || !bpp)
return NULL;
@@ -446,14 +435,27 @@ static void *pl_vout_set_mode(int w, int h, int bpp)
pl_set_gun_rect(fb_offset_x, fb_offset_y, w > 320 ? 320 : w, h);
+ // adjust for hud
+ *w_ = 320;
+ *h_ = fb_offset_y + psx_src_height;
+
return NULL;
}
-static void *pl_vout_flip(void)
+/* not really used, we do raw_flip */
+void plat_gvideo_open(void)
+{
+}
+
+void *plat_gvideo_flip(void)
{
return NULL;
}
+void plat_gvideo_close(void)
+{
+}
+
static void save_multiple_regs(unsigned int *dest, int base, int count)
{
const volatile unsigned int *regs = memregl + base / 4;
@@ -603,9 +605,7 @@ void plat_init(void)
if (mixerdev == -1)
perror("open(/dev/mixer)");
- pl_rearmed_cbs.pl_vout_flip = pl_vout_flip;
pl_rearmed_cbs.pl_vout_raw_flip = have_warm ? raw_flip_dma : raw_flip_soft;
- pl_rearmed_cbs.pl_vout_set_mode = pl_vout_set_mode;
pl_rearmed_cbs.pl_vout_set_raw_vram = pl_vout_set_raw_vram;
psx_src_width = 320;
@@ -699,7 +699,7 @@ static int haptic_read(const char *fname, struct haptic_data *data)
f = fopen(fname, "r");
if (f == NULL) {
- fprintf("fopen(%s)", fname);
+ fprintf(stderr, "fopen(%s)", fname);
perror("");
return -1;
}
diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c
index e79e523..dbfdb36 100644
--- a/frontend/plugin_lib.c
+++ b/frontend/plugin_lib.c
@@ -21,7 +21,6 @@
#include "linux/fbdev.h"
#include "common/fonts.h"
#include "common/input.h"
-#include "omap.h"
#include "menu.h"
#include "main.h"
#include "plat.h"
@@ -37,6 +36,7 @@ int in_keystate, in_state_gun;
int in_enable_vibration;
void *tsdev;
void *pl_vout_buf;
+int g_layer_x, g_layer_y, g_layer_w, g_layer_h;
static int pl_vout_w, pl_vout_h, pl_vout_bpp;
static int vsync_cnt;
static int frame_interval, frame_interval1024, vsync_usec_time;
@@ -111,10 +111,9 @@ static __attribute__((noinline)) void draw_active_chans(int vout_w, int vout_h)
}
}
-void pl_print_hud(int w, int h, int xborder)
+void pl_print_hud(int xborder)
{
- pl_vout_w = w; // used by pollux
- pl_vout_h = h;
+ int w = pl_vout_w, h = pl_vout_h;
if (g_opts & OPT_SHOWSPU)
draw_active_chans(w, h);
@@ -143,58 +142,39 @@ static void *pl_vout_set_mode(int w, int h, int bpp)
pl_vout_h = h;
pl_vout_bpp = bpp;
-#if defined(VOUT_FBDEV)
- vout_fbdev_clear(layer_fb);
- pl_vout_buf = vout_fbdev_resize(layer_fb, w, h, bpp, 0, 0, 0, 0, 3);
-#elif defined(MAEMO)
- extern void *hildon_set_mode(int w, int h);
- pl_vout_buf = hildon_set_mode(w, h);
-#endif
-
+ pl_vout_buf = plat_gvideo_set_mode(&pl_vout_w, &pl_vout_h, &pl_vout_bpp);
if (pl_vout_buf == NULL)
fprintf(stderr, "failed to set mode\n");
- // menu decides on layer size, we commit it
menu_notify_mode_change(w, h, bpp);
- omap_enable_layer(1);
return pl_vout_buf;
}
+// only used if raw flip is not defined
static void *pl_vout_flip(void)
{
pl_rearmed_cbs.flip_cnt++;
if (pl_vout_buf != NULL)
- pl_print_hud(pl_vout_w, pl_vout_h, 0);
+ pl_print_hud(0);
// let's flip now
-#if defined(VOUT_FBDEV)
- pl_vout_buf = vout_fbdev_flip(layer_fb);
-#elif defined(MAEMO)
- extern void *hildon_flip(void);
- pl_vout_buf = hildon_flip();
-#endif
+ pl_vout_buf = plat_gvideo_flip();
return pl_vout_buf;
}
static int pl_vout_open(void)
{
struct timeval now;
+ int h;
- omap_enable_layer(1);
-#if defined(VOUT_FBDEV)
// force mode update
- int h = pl_vout_h;
+ h = pl_vout_h;
pl_vout_h--;
pl_vout_buf = pl_vout_set_mode(pl_vout_w, h, pl_vout_bpp);
- // try to align redraws to vsync
- vout_fbdev_wait_vsync(layer_fb);
-#elif defined(MAEMO)
- extern void *hildon_flip(void);
- pl_vout_buf = hildon_flip();
-#endif
+ plat_gvideo_open();
gettimeofday(&now, 0);
vsync_usec_time = now.tv_usec;
@@ -206,20 +186,20 @@ static int pl_vout_open(void)
static void pl_vout_close(void)
{
- omap_enable_layer(0);
+ plat_gvideo_close();
}
void *pl_prepare_screenshot(int *w, int *h, int *bpp)
{
-#if defined(VOUT_FBDEV)
+ void *ret = plat_prepare_screenshot(w, h, bpp);
+ if (ret != NULL)
+ return ret;
+
*w = pl_vout_w;
*h = pl_vout_h;
*bpp = pl_vout_bpp;
return pl_vout_buf;
-#else
- return plat_prepare_screenshot(w, h, bpp);
-#endif
}
#ifndef MAEMO
diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h
index e2f1d55..8645385 100644
--- a/frontend/plugin_lib.h
+++ b/frontend/plugin_lib.h
@@ -24,11 +24,14 @@ extern int in_enable_vibration;
extern void *pl_vout_buf;
+extern int g_layer_x, g_layer_y;
+extern int g_layer_w, g_layer_h;
+
void pl_text_out16(int x, int y, const char *texto, ...);
void pl_start_watchdog(void);
void *pl_prepare_screenshot(int *w, int *h, int *bpp);
void pl_init(void);
-void pl_print_hud(int w, int h, int xborder);
+void pl_print_hud(int xborder);
void pl_timing_prepare(int is_pal);
void pl_frame_limit(void);