转自:http://www.myexception.cn/operating-system/1452058.html
1. ProjectConifg.mk中定义宏MTK_LCM_PHYSICAL_ROTATION=180,定义此宏后,Surface Flinger会读取rotate属性对画面进行反转刷新,因此正常开机后的所有画面都可以实现翻转180度刷新
2. LK Logo修改,包括开机第一张Logo,以及充电Logo,由于LK阶段Surface Flinger没有启动,MTK_LCM_PHYSICAL_ROTAION不会作用,实现反转显示方法有二,一,替换Logo资源,使用原有资源翻转180度的资源替换之;二,调整Frame Buffer中的刷新顺序,需要修改Path: alps/mediatek/platform/mt6589/lk; Function:show_logo
3. Kernel Logo修改,类似于LK Logo,方法有二,一,使用反转180度的Logo资源替换原有资源;二,调整Frame Buffer中的刷新顺序,请修改Path:alps/mediate/external/boot_logo_updater/boot_logo_updater; Function: main()
4. 开关机动画,请修改Path: alps/frameworks/base/cmds/bootanimation/bootanimation.cpp
Function: BootAnimation::readyToRun()
5. IPO,请修改Path: alps/mediatek/external/ipod/Bootlogo.cpp,Function: mt65xx_surface_init
6. Factory Mode,请修改Path: alps/mediatek/factory/src/miniui/Graphics.c,Function: gr_flip()
7. Recovery Mode,请修改Path: alps/bootable/recovery/miniui/Graphics.c. Function: gr_flip()
8. 如果只有屏幕发生反转,TP不需要反转,请在tp driver中,tpd_up 与tpd_down函数报x, y坐标时 更改为 (x = LCM_WIDTH-x) , (y= LCM_HEIGHT-y)
9. 如果关机动画依然没有旋转,请修改Alps\frameworks\native\libs\gui\SurfaceComposerClient.cpp
10. volume up+power key进入boot mode菜单, engineer build下开机模式字符串,以及recovery mode进入选择菜单需要翻转180度,请参考下面的方案:
①. 在\alps\bootable\bootloader\lk\dev\video\cfb_console.c文件中增加以下函数:
#define SWAP32_16(x) ((((x) & 0x0000ffff) << 16) | (((x) & 0xffff0000) >> 16)) //mtk add
video_drawchars()
{
......
......
case GDF_16BIT_565RGB:
//mtk add begin
if (0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3))
{
while (count--) {
c = *s;
cdat = video_fontdata + (c + 1) * VIDEO_FONT_HEIGHT - 1;
for (rows = VIDEO_FONT_HEIGHT, dest = dest0;
rows--;
dest += VIDEO_LINE_LEN) {
u8 bits = *cdat--;
((u32 *) dest)[0] = SWAP32_16(SHORTSWAP32 ((video_font_draw_table16 [bits & 3] & eorx) ^ bgx));
((u32 *) dest)[1] = SWAP32_16(SHORTSWAP32 ((video_font_draw_table16 [bits >> 2 & 3] & eorx) ^ bgx));
((u32 *) dest)[2] = SWAP32_16(SHORTSWAP32 ((video_font_draw_table16 [bits >> 4 & 3] & eorx) ^ bgx));
((u32 *) dest)[3] = SWAP32_16(SHORTSWAP32 ((video_font_draw_table16 [bits >> 6] & eorx) ^ bgx));
}
dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
s++;
}
}
else
{
//mtk add end
while (count--) {
c = *s;
cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
for (rows = VIDEO_FONT_HEIGHT, dest = dest0;
rows--;
dest += VIDEO_LINE_LEN) {
u8 bits = *cdat++;
((u32 *) dest)[0] = SHORTSWAP32 ((video_font_draw_table16 [bits >> 6] & eorx) ^ bgx);
((u32 *) dest)[1] = SHORTSWAP32 ((video_font_draw_table16 [bits >> 4 & 3] & eorx) ^ bgx);
((u32 *) dest)[2] = SHORTSWAP32 ((video_font_draw_table16 [bits >> 2 & 3] & eorx) ^ bgx);
((u32 *) dest)[3] = SHORTSWAP32 ((video_font_draw_table16 [bits & 3] & eorx) ^ bgx);
}
dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
s++;
}
}//mtk add
break;
......
......
}
void video_puts (const char *s)
{
int count = strlen (s);
//mtk add begin
if (0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3))
{
while (count--)
{
video_putc_ext (*s++);
}
}
else
{
//mtk add end
while (count--)
video_putc (*s++);
}
mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
}
//mtk add begin
void video_putc_ext (const char c)
{
static int nl = 1;
// Jett: check newline here in order to
// scroll the screen immediately for the first time video_printf()
//
if (console_col >= CONSOLE_COLS)
console_newline ();
switch (c) {
case 13: /* back to first column */
console_cr ();
break;
case '\n': /* next line */
if (console_col || (!console_col && nl))
console_newline ();
nl = 1;
break;
case 9: /* tab 8 */
CURSOR_OFF console_col |= 0x0008;
console_col &= ~0x0007;
if (console_col >= CONSOLE_COLS)
console_newline ();
break;
case 8: /* backspace */
console_back ();
break;
default: /* draw the char */
video_putchar ((CONSOLE_COLS - console_col - 1) * VIDEO_FONT_WIDTH,
(CONSOLE_ROWS - console_row) * VIDEO_FONT_HEIGHT,
c);
console_col++;
/* check for newline */
if (console_col >= CONSOLE_COLS) {
console_newline ();
nl = 0;
}
}
CURSOR_SET}
//mtk add end
②. 在\alps\mediatek\platform\mt6572\lk\boot_mode_menu.c里面修改boot_mode_menu_select()这个函数,
void boot_mode_menu_select()
{
......
......
else if(mtk_detect_key(MT65XX_MENU_OK_KEY))//VOL_DOWN,
{
//use for OK
video_clean_screen(); //mtk add
break;
}
else
{
//pass
}
}
......
......
}