summaryrefslogtreecommitdiffstats
path: root/petitboot.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-04-04 17:53:50 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-04-04 17:53:50 +1000
commit44722ec66794900881347462b6b6f32e430159af (patch)
tree3d66a4d6fcb8da1b58f0b1e60f81ceeb15745970 /petitboot.c
parentd24e0892cd09e9d41793a59e66b7f86a99b40343 (diff)
downloadtalos-petitboot-44722ec66794900881347462b6b6f32e430159af.tar.gz
talos-petitboot-44722ec66794900881347462b6b6f32e430159af.zip
Add a totally hackish video mode change mecanism
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'petitboot.c')
-rw-r--r--petitboot.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/petitboot.c b/petitboot.c
index 416434a..b76a718 100644
--- a/petitboot.c
+++ b/petitboot.c
@@ -5,6 +5,8 @@
#include <unistd.h>
#include <syscall.h>
#include <assert.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
#include <linux/input.h>
@@ -28,7 +30,8 @@ static twin_fbdev_t *pboot_fbdev;
static twin_screen_t *pboot_screen;
-#define PBOOT_INITIAL_MESSAGE "Petitboot v0.0.1"
+#define PBOOT_INITIAL_MESSAGE \
+ "video hack: 0=default 1=720p 2=1080i 3=1080p"
#define PBOOT_LEFT_PANE_SIZE 160
#define PBOOT_LEFT_PANE_COLOR 0x80000000
@@ -138,6 +141,8 @@ static pboot_lpane_t *pboot_lpane;
static pboot_rpane_t *pboot_rpane;
static pboot_spane_t *pboot_spane;
+static int pboot_vmode_change = -1;
+
/* XXX move to twin */
static inline twin_bool_t twin_rect_intersect(twin_rect_t r1,
twin_rect_t r2)
@@ -686,6 +691,11 @@ static twin_bool_t pboot_lpane_event (twin_window_t *window,
return TWIN_FALSE;
}
+static void pboot_quit(void)
+{
+ kill(0, SIGINT);
+}
+
twin_bool_t pboot_event_filter(twin_screen_t *screen,
twin_event_t *event)
{
@@ -701,6 +711,25 @@ twin_bool_t pboot_event_filter(twin_screen_t *screen,
pboot_cursor_hy);
break;
case TwinEventKeyDown:
+ /* Gross hack for video modes, need something better ! */
+ switch(event->u.key.key) {
+ case KEY_0:
+ pboot_vmode_change = 0; /* auto */
+ pboot_quit();
+ return TWIN_TRUE;
+ case KEY_1:
+ pboot_vmode_change = 3; /* 720p */
+ pboot_quit();
+ return TWIN_TRUE;
+ case KEY_2:
+ pboot_vmode_change = 4; /* 1080i */
+ pboot_quit();
+ return TWIN_TRUE;
+ case KEY_3:
+ pboot_vmode_change = 5; /* 1080p */
+ pboot_quit();
+ return TWIN_TRUE;
+ }
case TwinEventKeyUp:
twin_screen_set_cursor(pboot_screen, NULL, 0, 0);
break;
@@ -978,12 +1007,22 @@ static void pboot_make_background(void)
twin_screen_set_background(pboot_screen, scaledpic);
}
+#define PS3FB_IOCTL_SETMODE _IOW('r', 1, int)
+#define PS3FB_IOCTL_GETMODE _IOR('r', 2, int)
+
static void exitfunc(void)
{
#ifndef _USE_X11
if (pboot_fbdev)
twin_fbdev_destroy(pboot_fbdev);
pboot_fbdev = NULL;
+ if (pboot_vmode_change != -1) {
+ int fd = open("/dev/fb0", O_RDWR);
+ if (fd >= 0)
+ ioctl(fd, PS3FB_IOCTL_SETMODE,
+ (unsigned long)&pboot_vmode_change);
+ close(fd);
+ }
#endif
}
OpenPOWER on IntegriCloud