Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
#include <unistd.h>
#include <syscall.h>
#include <assert.h>
#include <unistd.h>
#include <syscall.h>
#include <assert.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
static twin_screen_t *pboot_screen;
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
#define PBOOT_LEFT_PANE_SIZE 160
#define PBOOT_LEFT_PANE_COLOR 0x80000000
static pboot_rpane_t *pboot_rpane;
static pboot_spane_t *pboot_spane;
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)
/* XXX move to twin */
static inline twin_bool_t twin_rect_intersect(twin_rect_t r1,
twin_rect_t r2)
+static void pboot_quit(void)
+{
+ kill(0, SIGINT);
+}
+
twin_bool_t pboot_event_filter(twin_screen_t *screen,
twin_event_t *event)
{
twin_bool_t pboot_event_filter(twin_screen_t *screen,
twin_event_t *event)
{
pboot_cursor_hy);
break;
case TwinEventKeyDown:
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;
case TwinEventKeyUp:
twin_screen_set_cursor(pboot_screen, NULL, 0, 0);
break;
twin_screen_set_background(pboot_screen, scaledpic);
}
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;
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);
+ }