From 5017babb307122d8567ca78a5721e96c4d7ff8f2 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sun, 6 Nov 2016 00:12:04 +0100 Subject: nwztools/plattools: fix black screen issue in dualboot, rework dualboot Sony added extensions to the frambuffer interface. It is important to take them into account since the OF uses them and might leave the framebuffer in an unusual state which would make the dualboot not display anything. Also rework the dualboot code so that it can boot rockbox (not doing anything at the moment), display all tools or boot the OF. Change-Id: Ia0f589c9ec8558f375270841503c0964aff07f0b --- utils/nwztools/plattools/nwz_fb.h | 87 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 2 deletions(-) (limited to 'utils/nwztools/plattools/nwz_fb.h') diff --git a/utils/nwztools/plattools/nwz_fb.h b/utils/nwztools/plattools/nwz_fb.h index c857c5eb8a..9334b625c9 100644 --- a/utils/nwztools/plattools/nwz_fb.h +++ b/utils/nwztools/plattools/nwz_fb.h @@ -50,7 +50,90 @@ struct nwz_fb_brightness int period; /* period in ms between steps when changing: >=10 */ }; -#define NWZ_FB_SET_BRIGHTNESS _IOW(NWZ_FB_TYPE, 0x07, struct nwz_fb_brightness) -#define NWZ_FB_GET_BRIGHTNESS _IOR(NWZ_FB_TYPE, 0x08, struct nwz_fb_brightness) +/* FB extensions: + * + * Sony added relatively complicated extensions to the framebuffer. They allow + * better control of framebuffer refresh, double-buffering and mixing with DSP + * (v4l2). Each outout (LCD and TV) has two buffers, called page 0 and 1 (or A + * and B). Each page has its own attributes (image info) that control + * transparency, rotation and updates. At any point in time, the LCD is drawing + * a page and one can select the next page to draw. Unless an UPDATE ioctl() + * is made to change it, the next page will be the same as the one being drawn. + * + * FIXME I don't know what the timer is, it seems irrelevant for the LCD but + * the OF uses it for TV, maybe this controls the refresh rate of the TV output? + * + * On a side note, this information only applies to a subset of LCD types (the + * LCD type can be gathered from icx_sysinfo): + * - BB(0): AQUILA BB LCD + * - SW(1): SWAN or FIJI LCD + * - FC(2): FALCON OLED + * - GM(3): GUAM and ROTA LCD + * - FR(5): FURANO LCD ---> /!\ DOES NOT APPLY /!\ + * - SD(6): SPICA_D LCD + * - AQ(7): AQUILA LCD + */ + +/* Image infomation: + * SET_MODE will change the attributes of the requested page (ie .page) + * GET_MODE will return the attributes of the currently being displayed page + * UPDATE will do the same thing as SET_MODE but immediately refreshes the screen */ +struct nwz_fb_image_info +{ + int tc_enable; /* enable(1)/disable(0) transparent color */ + int t_color; /* transparent color (16bpp RGB565) */ + int alpha; /* alpha ratio (0 - 255) */ + int page; /* 2D framebuffer page(0/1) */ + int rot; /* LCD image rotation(0/1=180deg.) */ + int update; /* only use with NWZ_FB_UPDATE, ignored for others */ +}; + +/* update type */ +#define NWZ_FB_ONLY_2D_MODE 0 +#define NWZ_FB_DSP_AND_2D_MODE 1 + +/* frame buffer page infomation: when NWZ_FB_WAIT_REFREHS is called, the driver + * will wait until the next refresh or the timeout, whichever comes first. It + * will then fill this structure with the page status. */ +struct nwz_fb_status +{ + int timeout; /* waiting time for any frame ready (in units of 10 ms) */ + int page0; /* page 0 is out of display or waiting to be displayed */ + int page1; /* page 0 is out of display or waiting to be displayed */ +}; + +/* frame buffer page status */ +#define NWZ_FB_OUT_OF_DISPLAY 0 +#define NWZ_FB_WAITING_FOR_ON_DISPLAY 1 + +/* frame buffer update timer infomation (use I/F fb <-> 2D API) */ +struct nwz_fb_update_timer +{ + int timerflag; /* auto update off(0) / auto update on(1) */ + int timeout; /* timeout timer value (ms) */ +}; + +/* timer flags */ +#define NWZ_FB_TIMER_ON 1 +#define NWZ_FB_TIMER_OFF 0 + +/* default and minimum timeout value */ +#define NWZ_FB_DEFAULT_TIMEOUT 60 +#define NWZ_FB_MIN_TIMEOUT 33 + +/* mmap offsets for page 1 (page 0 is always at address 0) */ +#define NWZ_FB_LCD_PAGE_OFFSET 0x2f000 + +/* NOTE: I renamed those from Sony's header, because their original names were + * pure crap */ +/* FIXME: Sony uses _IOR for NWZ_FB_WAIT_REFRESH but it should be _IORW */ +#define NWZ_FB_WAIT_REFRESH _IORW(NWZ_FB_TYPE, 0x00, struct nwz_fb_status) +#define NWZ_FB_UPDATE _IOW(NWZ_FB_TYPE, 0x01, struct nwz_fb_image_info) +#define NWZ_FB_SET_MODE _IOW(NWZ_FB_TYPE, 0x02, struct nwz_fb_image_info) +#define NWZ_FB_GET_MODE _IOR(NWZ_FB_TYPE, 0x03, struct nwz_fb_image_info) +#define NWZ_FB_UPDATE_TIMER _IOR(NWZ_FB_TYPE, 0x04, struct nwz_fb_update_timer) +#define NWZ_FB_SET_BRIGHTNESS _IOW(NWZ_FB_TYPE, 0x07, struct nwz_fb_brightness) +#define NWZ_FB_GET_BRIGHTNESS _IOR(NWZ_FB_TYPE, 0x08, struct nwz_fb_brightness) + #endif /* __NWZ_FB_H__ */ -- cgit v1.2.3