rk27xx lcd code rework

Use DMA engine for fullscreen updates and bypass mode for partial
updates. This gives major boost on rk27generic:
default ARM:AHB:APB 200💯50
HEAD    1/1:  26.3fps 1/4: 105.0fps
patched 1/1: 116.5fps 1/4: 249.5fps

with freq scalling NORMAL mode ARM:AHB:APB 50:50:50
HEAD    1/1:  13.1fps 1/4: 52.5fps
patched 1/1:  54.5fps 1/4: 119.0fps

Tested on rk27generic noname DAP and on Hifimans.

Change-Id: Id9dd4d2d61542c7ea6b5c6336b170d6357cefde9
This commit is contained in:
Andrew Ryabinin 2012-09-25 11:41:12 +04:00 committed by Marcin Bukat
parent f636aa07df
commit 84134f737f
8 changed files with 352 additions and 137 deletions

View file

@ -5,7 +5,6 @@
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2011 Marcin Bukat
*
@ -37,17 +36,6 @@ static inline void delay_nop(int cycles)
}
/* converts RGB565 pixel into internal lcd bus format */
static unsigned int lcd_pixel_transform(unsigned short rgb565)
{
unsigned int r, g, b;
b = rgb565 & 0x1f;
g = (rgb565 >> 5) & 0x3f;
r = (rgb565 >> 11) & 0x1f;
return r<<19 | g<<10 | b<<3;
}
/* not tested */
static void lcd_sleep(bool sleep)
{
@ -71,7 +59,7 @@ static void lcd_sleep(bool sleep)
lcd_cmd(GRAM_WRITE);
}
static void lcd_display_init(void)
void lcd_display_init(void)
{
unsigned int x, y;
@ -173,10 +161,21 @@ static void lcd_display_init(void)
lcd_sleep(false);
}
void lcd_init_device(void)
void lcd_set_gram_area(int x, int y, int width, int height)
{
lcdif_init(LCDIF_18BIT);
lcd_display_init();
lcdctrl_bypass(1);
LCDC_CTRL |= RGB24B;
/* addresses setup */
lcd_write_reg(WINDOW_H_START, y);
lcd_write_reg(WINDOW_H_END, height-1);
lcd_write_reg(WINDOW_V_START, x);
lcd_write_reg(WINDOW_V_END, width-1);
lcd_write_reg(GRAM_H_ADDR, y);
lcd_write_reg(GRAM_V_ADDR, x);
lcd_cmd(GRAM_WRITE);
LCDC_CTRL &= ~RGB24B;
}
void lcd_update_rect(int x, int y, int width, int height)
@ -184,20 +183,12 @@ void lcd_update_rect(int x, int y, int width, int height)
int px = x, py = y;
int pxmax = x + width, pymax = y + height;
/* addresses setup */
lcd_write_reg(WINDOW_H_START, y);
lcd_write_reg(WINDOW_H_END, pymax-1);
lcd_write_reg(WINDOW_V_START, x);
lcd_write_reg(WINDOW_V_END, pxmax-1);
lcd_write_reg(GRAM_H_ADDR, y);
lcd_write_reg(GRAM_V_ADDR, x);
lcd_cmd(GRAM_WRITE);
lcd_set_gram_area(x, y, pxmax, pymax);
for (py=y; py<pymax; py++)
{
for (px=x; px<pxmax; px++)
LCD_DATA = lcd_pixel_transform(*FBADDR(px,py));
LCD_DATA = *FBADDR(px,py);
}
}

View file

@ -0,0 +1,26 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2012 Andrew Ryabinin
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef LCD_TARGET_H
#define LCD_TARGET_H
#define LCD_DATABUS_WIDTH LCDIF_18BIT
#endif