+static void *pl_vout_flip(void)
+{
+ pl_flip_cnt++;
+
+ if (pl_vout_buf != NULL)
+ pl_print_hud(pl_vout_w, pl_vout_h, 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
+ return pl_vout_buf;
+}
+
+static int pl_vout_open(void)
+{
+ struct timeval now;
+
+ omap_enable_layer(1);
+#if defined(VOUT_FBDEV)
+ // force mode update
+ int 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
+
+ gettimeofday(&now, 0);
+ vsync_usec_time = now.tv_usec;
+ while (vsync_usec_time >= frame_interval)
+ vsync_usec_time -= frame_interval;
+
+ return 0;
+}
+
+static void pl_vout_close(void)
+{
+ omap_enable_layer(0);
+}
+
+void *pl_prepare_screenshot(int *w, int *h, int *bpp)
+{
+#if defined(VOUT_FBDEV)
+ *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
+static void update_analogs(void)
+{
+ int *nubp[2] = { in_a1, in_a2 };
+ int i, a, v, ret;
+
+ for (i = 0; i < 2; i++)
+ {
+ if (in_adev[i] < 0)
+ continue;
+
+ for (a = 0; a < 2; a++) {
+ nubp[i][a] = 127;
+
+ ret = in_update_analog(in_adev[i], in_adev_axis[i][a], &v);
+ if (ret == 0) {
+ v = v / (IN_ABS_RANGE / 128) + 127;
+ nubp[i][a] = v < 0 ? 0 : v;
+ }
+ }
+ }
+ //printf("%4d %4d %4d %4d\n", in_a1[0], in_a1[1], in_a2[0], in_a2[1]);
+}
+
+static void update_input(void)