mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
lcd drivers: Convert lcd_[remote_]framebuffer to a pointer
Change all lcd drivers to using a pointer to the static framebuffer instead of directly accessing the static array. This will let us later do fun things like dynamic framebuffer sizes (RaaA) or ability to use different buffers for different layers (dynamic skin backdrops!) Change-Id: I0a4d58a9d7b55e6c932131b929e5d4c9f9414b06
This commit is contained in:
parent
15c69b8baf
commit
b37e6bc8c1
65 changed files with 193 additions and 181 deletions
|
|
@ -332,7 +332,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
|
||||
lcd_write_cmd(R_WRITE_DATA_2_GRAM);
|
||||
|
||||
ptr = &lcd_framebuffer[y][x];
|
||||
ptr = FBADDR(x,y);
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ void lcd_update(void)
|
|||
lcd_write_command (LCD_CNTL_HIGHCOL | ((offset >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | (offset & 0xf));
|
||||
|
||||
lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
|
||||
lcd_write_data (FBADDR(0, y), LCD_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -304,6 +304,6 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+offset) >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+offset) & 0xf));
|
||||
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
lcd_write_data (FBADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
|
||||
/* write to GRAM */
|
||||
for (row = y; row < y_end; row++) {
|
||||
lcd_write_data(&lcd_framebuffer[row][x], width);
|
||||
lcd_write_data(FBADDR(x,row), width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_window(x, y, x+width-1, y+height-1);
|
||||
lcd_write_cmd(R_WRITE_DATA_2_GRAM);
|
||||
|
||||
ptr = &lcd_framebuffer[y][x];
|
||||
ptr = FBADDR(x,y);
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
|||
|
|
@ -533,12 +533,12 @@ void lcd_update_rect(int x, int y, int w, int h)
|
|||
*/
|
||||
if(w == LCD_WIDTH)
|
||||
{
|
||||
memcpy((void *)FRAME, &lcd_framebuffer[y][x], w * h * sizeof(fb_data));
|
||||
memcpy((void *)FRAME, FBADDR(x,y), w * h * sizeof(fb_data));
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 0; i < h; i++)
|
||||
memcpy((fb_data *)FRAME + i * w, &lcd_framebuffer[y + i][x], w * sizeof(fb_data));
|
||||
memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data));
|
||||
}
|
||||
/* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode
|
||||
* (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count
|
||||
|
|
@ -599,10 +599,10 @@ void lcd_blit_yuv(unsigned char * const src[3],
|
|||
linecounter = height >> 1;
|
||||
|
||||
#if LCD_WIDTH >= LCD_HEIGHT
|
||||
dst = &lcd_framebuffer[y][x];
|
||||
dst = FBADDR(x,y);
|
||||
row_end = dst + width;
|
||||
#else
|
||||
dst = &lcd_framebuffer[x][LCD_WIDTH - y - 1];
|
||||
dst = FBADDR(LCD_WIDTH - y - 1,x);
|
||||
row_end = dst + LCD_WIDTH * width;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
|
||||
lcd_setup_drawing_region(x, y, width, height);
|
||||
|
||||
addr = (unsigned long*)&lcd_framebuffer[y][x];
|
||||
addr = (unsigned long*)FBADDR(x, y);
|
||||
|
||||
while (height > 0) {
|
||||
int r, h, pixels_to_write;
|
||||
|
|
|
|||
|
|
@ -340,10 +340,10 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
|
||||
#if defined(IPOD_MINI) || defined(IPOD_MINI2G)
|
||||
if (pix_offset == -2)
|
||||
lcd_write_data_shifted(&lcd_framebuffer[y][2*x], width);
|
||||
lcd_write_data_shifted(FBADDR(2*x, y), width);
|
||||
else
|
||||
#endif
|
||||
lcd_write_data(&lcd_framebuffer[y][2*x], width);
|
||||
lcd_write_data(FBADDR(2*x, y), width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
/* Prevent the tick from triggering BCM updates while we're writing. */
|
||||
lcd_block_tick();
|
||||
|
||||
addr = &lcd_framebuffer[y][x];
|
||||
addr = FBADDR(x, y);
|
||||
bcmaddr = BCMA_CMDPARAM + (LCD_WIDTH*2) * y + (x << 1);
|
||||
|
||||
if (width == LCD_WIDTH)
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ void lcd_update_rect(int x0, int y0, int width, int height)
|
|||
/* start drawing */
|
||||
lcd_send_cmd(R_WRITE_DATA_2_GRAM);
|
||||
|
||||
addr = (unsigned short*)&lcd_framebuffer[y0][x0];
|
||||
addr = (unsigned short*)FBADDR(x0,y0);
|
||||
|
||||
int c, r;
|
||||
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ void lcd_update_rect(int x0, int y0, int width, int height)
|
|||
/* start drawing */
|
||||
lcd_send_cmd(R_WRITE_DATA_2_GRAM);
|
||||
|
||||
addr = (unsigned long*)&lcd_framebuffer[y0][x0];
|
||||
addr = (unsigned long*)FBADDR(x0,y0);
|
||||
|
||||
while (height > 0) {
|
||||
int c, r;
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
if ((width <= 0) || (height <= 0))
|
||||
return; /* Nothing left to do. */
|
||||
|
||||
addr = &lcd_framebuffer[y][x];
|
||||
addr = FBADDR(x,y);
|
||||
|
||||
if (width <= 1) {
|
||||
/* The X end address must be larger than the X start address, so we
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ void lcd_update(void)
|
|||
lcd_write_command (LCD_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | (xoffset & 0xf));
|
||||
|
||||
lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
|
||||
lcd_write_data (FBADDR(0, y), LCD_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -331,6 +331,6 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset) >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf));
|
||||
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
lcd_write_data (FBADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ void lcd_update(void)
|
|||
lcd_write_command(cmd1);
|
||||
lcd_write_command(cmd2);
|
||||
|
||||
lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
|
||||
lcd_write_data (FBADDR(0, y), LCD_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -271,6 +271,6 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_command(cmd1);
|
||||
lcd_write_command(cmd2);
|
||||
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
lcd_write_data (FBADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ static void remote_update_lcd(void)
|
|||
data[6] = (y + 1) << 3; /* y2 */
|
||||
|
||||
for (x = 0; x < RC_WIDTH; x++)
|
||||
data[x + 7] = lcd_remote_framebuffer[y][x];
|
||||
data[x + 7] = FBREMOTEADDR(x,y);
|
||||
|
||||
remote_tx(data, RC_WIDTH + 7);
|
||||
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ void lcd_update_rect(int x0, int y0, int width, int height)
|
|||
/* start drawing */
|
||||
lcd_send_cmd(R_WRITE_DATA_2_GRAM);
|
||||
|
||||
addr = &lcd_framebuffer[y0][x0];
|
||||
addr = FBADDR(x0, y0)
|
||||
|
||||
int c, r;
|
||||
for (r = 0; r < height; r++)
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
if ((width <= 0) || (height <= 0))
|
||||
return; /* Nothing left to do. */
|
||||
|
||||
addr = &lcd_framebuffer[y][x];
|
||||
addr = FBADDR(x,y);
|
||||
|
||||
lcd_send_cmd(CASET);
|
||||
lcd_send_data(x);
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
|
||||
lcd_send_reg(LCD_REG_WRITE_DATA_2_GRAM);
|
||||
|
||||
addr = (unsigned long*)&lcd_framebuffer[y][x];
|
||||
addr = (unsigned long*)FBADDR(x,y);
|
||||
|
||||
while (height > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -495,8 +495,8 @@ void lcd_update(void)
|
|||
if (!display_on)
|
||||
return;
|
||||
|
||||
addr = &lcd_framebuffer[0][0];
|
||||
end = &lcd_framebuffer[LCD_HEIGHT - 1][LCD_WIDTH];
|
||||
addr = FBADDR(0,0);
|
||||
end = FBADDR(LCD_WIDTH,LCD_HEIGHT - 1);
|
||||
|
||||
lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (LCD_WIDTH - 1) << 8);
|
||||
lcd_write_reg(R_VERT_RAM_ADDR_POS, (LCD_HEIGHT - 1) << 8);
|
||||
|
|
@ -533,7 +533,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
if (height <= 0)
|
||||
return; /* Nothing left to do. */
|
||||
|
||||
addr = &lcd_framebuffer[y][x];
|
||||
addr = FBADDR(x,y);
|
||||
|
||||
lcd_write_reg(R_HORIZ_RAM_ADDR_POS, ((x + width - 1) << 8) | x);
|
||||
lcd_write_reg(R_VERT_RAM_ADDR_POS, ((y + height - 1) << 8) | y);
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ void lcd_update(void)
|
|||
lcd_write_command (LCD_CNTL_HIGHCOL);
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | 4);
|
||||
|
||||
lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
|
||||
lcd_write_data (FBADDR(0, y), LCD_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -219,6 +219,6 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+4) >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+4) & 0xf));
|
||||
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
lcd_write_data (FBADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
|
||||
for (px=x; px<pxmax; px++)
|
||||
for (py=y; py<pymax; py++)
|
||||
lcd_data(lcd_framebuffer[py][px]);
|
||||
lcd_data(FBADDR(px, py));
|
||||
}
|
||||
|
||||
/* Blit a YUV bitmap directly to the LCD */
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
for (py=y; py<pymax; py++)
|
||||
{
|
||||
for (px=x; px<pxmax; px++)
|
||||
LCD_DATA = lcd_pixel_transform(lcd_framebuffer[py][px]);
|
||||
LCD_DATA = lcd_pixel_transform(FBADDR(px,py));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_setup_drawing_region(x, y, width, height);
|
||||
|
||||
/* Copy display bitmap to hardware */
|
||||
p = &lcd_framebuffer[y][x];
|
||||
p = FBADDR(x,y);
|
||||
if (LCD_WIDTH == width) {
|
||||
/* Write all lines at once */
|
||||
lcd_write_line(p, height*LCD_WIDTH, LCD_BASE);
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ void lcd_update(void)
|
|||
LCD_WCMD = 0;
|
||||
LCD_WCMD = 0x22;
|
||||
}
|
||||
for(p=&lcd_framebuffer[0][0], i=0;i<LCD_WIDTH*LCD_FBHEIGHT;++i, ++p) {
|
||||
for(p=FBADDR(0,0), i=0;i<LCD_WIDTH*LCD_FBHEIGHT;++i, ++p) {
|
||||
while (LCD_STATUS & STAT_FULL);
|
||||
LCD_WDATA = RGB_UNPACK_RED(*p);
|
||||
while (LCD_STATUS & STAT_FULL);
|
||||
|
|
|
|||
|
|
@ -438,8 +438,8 @@ void lcd_init_device(void)
|
|||
lcd_controller_init();
|
||||
|
||||
/* set framebuffer addresses */
|
||||
fb = (uint32_t) &lcd_framebuffer[0][0];
|
||||
fb_end = (uint32_t) &lcd_framebuffer[LCD_HEIGHT][0];
|
||||
fb = (uint32_t) FBADDR(0,0);
|
||||
fb_end = (uint32_t) FBADDR(0,LCD_HEIGHT);
|
||||
window = 2 * LCD_WIDTH;
|
||||
|
||||
LCDB1SADDR1 = fb;
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_set_position1(x, y);
|
||||
|
||||
for (h = 0; h < height; h++) {
|
||||
p = &lcd_framebuffer[y][0];
|
||||
p = FBADDR(0,y);
|
||||
for (w = 0; w < LCD_WIDTH; w++) {
|
||||
while (LCD_STATUS & 0x10);
|
||||
LCD_WDATA = *p++;
|
||||
|
|
@ -319,7 +319,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_set_position2(x, y);
|
||||
|
||||
for (h = 0; h < height; h++) {
|
||||
p = &lcd_framebuffer[y][x];
|
||||
p = FBADDR(x,y);
|
||||
for (w = 0; w < width; w++) {
|
||||
while (LCD_STATUS & 0x10);
|
||||
LCD_WDATA = *p++;
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ void lcd_update_rect(int, int, int, int) ICODE_ATTR;
|
|||
void lcd_update_rect(int x, int y, int width, int height)
|
||||
{
|
||||
int pixels = width * height;
|
||||
fb_data* p = &lcd_framebuffer[y][x];
|
||||
fb_data* p = FBADDR(x,y);
|
||||
uint16_t* out = lcd_dblbuf[0];
|
||||
|
||||
#ifdef HAVE_LCD_SLEEP
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
if ((width <= 0) || (height <= 0))
|
||||
return; /* Nothing left to do. */
|
||||
|
||||
addr = &lcd_framebuffer[y][x];
|
||||
addr = FBADDR(x,y);
|
||||
|
||||
if (width <= 1) {
|
||||
lcd_send_command(R_ENTRY_MODE); /* The X end address must be larger */
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_reg(LCD_CNTL_PAGE, y);
|
||||
lcd_write_reg(LCD_CNTL_COLUMN, x);
|
||||
|
||||
addr = &lcd_framebuffer[y][x];
|
||||
addr = FBADDR(x,y);
|
||||
|
||||
lcd_send_cmd(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data(addr, width);
|
||||
|
|
|
|||
|
|
@ -639,7 +639,7 @@ void lcd_update_rect(int x0, int y0, int width, int height)
|
|||
/* start drawing */
|
||||
lcd_send_cmd(R_WRITE_DATA_2_GRAM);
|
||||
|
||||
addr = (unsigned short*)&lcd_framebuffer[y0][x0];
|
||||
addr = (unsigned short*)FBADDR(x0,y0);
|
||||
|
||||
int c, r;
|
||||
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ void lcd_update(void)
|
|||
{
|
||||
const fb_data *addr;
|
||||
|
||||
addr = &lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH];
|
||||
addr = FBADDR(LCD_WIDTH,LCD_HEIGHT);
|
||||
|
||||
lcd_write_reg(0x20, 0x0);
|
||||
lcd_write_reg(0x21, 0x0);
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
if ((width <= 0) || (height <= 0))
|
||||
return; /* Nothing left to do. */
|
||||
|
||||
addr = &lcd_framebuffer[y][x];
|
||||
addr = FBADDR(x,y);
|
||||
|
||||
if (width <= 1) {
|
||||
lcd_send_command(R_ENTRY_MODE); /* The X end address must be larger */
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ void lcd_update_rect(int sx, int sy, int width, int height)
|
|||
fb_data c;
|
||||
unsigned long color;
|
||||
|
||||
c = lcd_framebuffer[y][x];
|
||||
c = FBADDR(x,y);
|
||||
color =
|
||||
((c & 0x1f) << 1) | ((c & 0x7e0) << 1) | ((c & 0xf800) <<
|
||||
2);
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
|
||||
#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
|
||||
dst = (fb_data *)FRAME + LCD_WIDTH*y + x;
|
||||
src = &lcd_framebuffer[y][x];
|
||||
src = FBADDR(x,y);
|
||||
|
||||
/* Copy part of the Rockbox framebuffer to the second framebuffer */
|
||||
if (width < LCD_WIDTH)
|
||||
|
|
@ -394,7 +394,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_copy_buffer_rect(dst, src, LCD_WIDTH*height, 1);
|
||||
}
|
||||
#else
|
||||
src = &lcd_framebuffer[y][x];
|
||||
src = FBADDR(x,y);
|
||||
|
||||
register int xc, yc;
|
||||
register fb_data *start=FRAME + LCD_HEIGHT*(LCD_WIDTH-x-1) + y + 1;
|
||||
|
|
@ -419,7 +419,7 @@ void lcd_update(void)
|
|||
if (!lcd_on || direct_fb_access)
|
||||
return;
|
||||
#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
|
||||
lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0],
|
||||
lcd_copy_buffer_rect((fb_data *)FRAME, FBADDR(0,0),
|
||||
LCD_WIDTH*LCD_HEIGHT, 1);
|
||||
#else
|
||||
lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
|
||||
|
|
|
|||
|
|
@ -500,12 +500,12 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
if (width < LCD_WIDTH)
|
||||
{
|
||||
/* Not full width - do line-by-line */
|
||||
lcd_copy_buffer_rect(dst, &lcd_framebuffer[y][x], width, height);
|
||||
lcd_copy_buffer_rect(dst, FBADDR(x,y), width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Full width - copy as one line */
|
||||
lcd_copy_buffer_rect(dst, &lcd_framebuffer[y][x], LCD_WIDTH*height, 1);
|
||||
lcd_copy_buffer_rect(dst, FBADDR(x,y), LCD_WIDTH*height, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -519,7 +519,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
#else
|
||||
fb_data *src;
|
||||
fb_data *dst;
|
||||
src = &lcd_framebuffer[0][0] + (x*LCD_HEIGHT + y);
|
||||
src = FBADDR(0,0) + (x*LCD_HEIGHT + y);
|
||||
dst = FRAME + (LCD_HEIGHT*(LCD_WIDTH-1) - x * LCD_HEIGHT + y);
|
||||
|
||||
while(width > 0) {
|
||||
|
|
@ -532,7 +532,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
|
||||
#else
|
||||
register fb_data *dst, *src;
|
||||
src = &lcd_framebuffer[y][x];
|
||||
src = FBADDR(x,y);
|
||||
|
||||
dst=FRAME + (LCD_NATIVE_WIDTH*(LCD_NATIVE_HEIGHT-1))
|
||||
- LCD_NATIVE_WIDTH*x + y ;
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ static void remote_tick(void)
|
|||
for(i=7; i<remote_payload_size; i++)
|
||||
{
|
||||
remote_payload[i]=
|
||||
lcd_remote_framebuffer[remote_payload[4]>>3][i+remote_draw_x-7];
|
||||
FBREMOTEADDR(i+remote_draw_x-7, remote_payload[4]>>3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ static void dma_lcd_copy_buffer_rect(int x, int y, int width, int height)
|
|||
|
||||
/* Set source and destination addresses */
|
||||
dst = (char*)(FRAME + LCD_WIDTH*y + x);
|
||||
src = (char*)(&lcd_framebuffer[y][x]);
|
||||
src = (char*)(FBADDR(x,y));
|
||||
|
||||
/* Flush cache to memory */
|
||||
commit_dcache();
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ void lcd_remote_update(void)
|
|||
have to update one page at a time. */
|
||||
lcd_remote_write_command(LCD_SET_PAGE | (y > 5 ? y + 2 : y));
|
||||
lcd_remote_write_command_ex(LCD_SET_COLUMN | 0, 0);
|
||||
lcd_remote_write_data(lcd_remote_framebuffer[y], LCD_REMOTE_WIDTH);
|
||||
lcd_remote_write_data(FBREMOTEADDR(0, y), LCD_REMOTE_WIDTH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ void lcd_remote_update_rect(int x, int y, int width, int height)
|
|||
lcd_remote_write_command_ex(LCD_SET_COLUMN | ((x >> 4) & 0xf),
|
||||
x & 0xf);
|
||||
|
||||
lcd_remote_write_data(&lcd_remote_framebuffer[y][x], width);
|
||||
lcd_remote_write_data(FBREMOTEADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ void lcd_update(void)
|
|||
have to update one page at a time. */
|
||||
lcd_write_command(LCD_SET_PAGE | (y > 5 ? y + 2 : y));
|
||||
lcd_write_command_e(LCD_SET_COLUMN | 0, 0);
|
||||
lcd_write_data(lcd_framebuffer[y], LCD_WIDTH);
|
||||
lcd_write_data(FBADDR(0, y), LCD_WIDTH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -295,7 +295,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_command(LCD_SET_PAGE | ((y > 5 ? y + 2 : y) & 0xf));
|
||||
lcd_write_command_e(LCD_SET_COLUMN | ((x >> 4) & 0xf), x & 0xf);
|
||||
|
||||
lcd_write_data(&lcd_framebuffer[y][x], width);
|
||||
lcd_write_data(FBADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ void lcd_update(void)
|
|||
lcd_write_command_ex(LCD_CNTL_COLUMN, 0, -1);
|
||||
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
|
||||
lcd_write_data (FBADDR(0, y), LCD_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,6 +235,6 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
|
||||
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
lcd_write_data (FBADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
|
||||
lcd_begin_write_gram();
|
||||
|
||||
ptr = (unsigned short *)&lcd_framebuffer[y][x];
|
||||
ptr = (unsigned short *)FBADDR(x,y);
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ void lcd_update(void)
|
|||
lcd_write_command_ex(LCD_CNTL_COLUMN, 0, -1);
|
||||
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
|
||||
lcd_write_data (FBADDR(0, y), LCD_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -244,6 +244,6 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
|
||||
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
lcd_write_data (FBADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -447,13 +447,13 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
if (width == LCD_WIDTH)
|
||||
{
|
||||
dma_count = 1;
|
||||
SAR3 = (unsigned long)lcd_framebuffer[y];
|
||||
SAR3 = (unsigned long)FBADDR(0, y);
|
||||
BCR3 = (LCD_WIDTH*sizeof(fb_data)) * height;
|
||||
}
|
||||
else
|
||||
{
|
||||
dma_count = height;
|
||||
SAR3 = dma_addr = (unsigned long)&lcd_framebuffer[y][x];
|
||||
SAR3 = dma_addr = (unsigned long)FBADDR(x,y);
|
||||
BCR3 = dma_len = width * sizeof(fb_data);
|
||||
}
|
||||
DCR3 = DMA_INT | DMA_AA | DMA_BWC(1)
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ void lcd_remote_update(void)
|
|||
lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | y);
|
||||
lcd_remote_write_command(LCD_REMOTE_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf));
|
||||
lcd_remote_write_command(LCD_REMOTE_CNTL_LOWCOL | (xoffset & 0xf));
|
||||
lcd_remote_write_data(lcd_remote_framebuffer[y], LCD_REMOTE_WIDTH);
|
||||
lcd_remote_write_data(FBREMOTEADDR(0, y), LCD_REMOTE_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -346,6 +346,6 @@ void lcd_remote_update_rect(int x, int y, int width, int height)
|
|||
lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | y);
|
||||
lcd_remote_write_command(LCD_REMOTE_CNTL_HIGHCOL | (((x+xoffset) >> 4) & 0xf));
|
||||
lcd_remote_write_command(LCD_REMOTE_CNTL_LOWCOL | ((x+xoffset) & 0xf));
|
||||
lcd_remote_write_data(&lcd_remote_framebuffer[y][x], width);
|
||||
lcd_remote_write_data(FBREMOTEADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ void DMA3(void)
|
|||
lcd_write_command_e(LCD_SET_COLUMN | ((column >> 4) & 0xf),
|
||||
column & 0x0f);
|
||||
|
||||
SAR3 = (unsigned long)&lcd_framebuffer[page][column];
|
||||
SAR3 = (unsigned long)FBADDR(column,page);
|
||||
BCR3 = dma_len;
|
||||
DCR3 = DMA_INT | DMA_AA | DMA_BWC(1)
|
||||
| DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE)
|
||||
|
|
@ -261,7 +261,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
dma_count = ymax - y + 1;
|
||||
|
||||
/* Initialize DMA transfer */
|
||||
SAR3 = (unsigned long)&lcd_framebuffer[page][column];
|
||||
SAR3 = (unsigned long)FBADDR(column,page);
|
||||
BCR3 = dma_len;
|
||||
DCR3 = DMA_INT | DMA_AA | DMA_BWC(1)
|
||||
| DMA_SINC | DMA_SSIZE(DMA_SIZE_LINE)
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ void lcd_update(void)
|
|||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
|
||||
/* Copy display bitmap to hardware */
|
||||
lcd_write_data (&lcd_framebuffer[0][0], LCD_WIDTH*LCD_FBHEIGHT);
|
||||
lcd_write_data (FBADDR(0,0), LCD_WIDTH*LCD_FBHEIGHT);
|
||||
}
|
||||
|
||||
/* Update a fraction of the display. */
|
||||
|
|
@ -238,6 +238,6 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
|
||||
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
lcd_write_data (FBADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ void connect_with_java(JNIEnv* env, jobject fb_instance)
|
|||
|
||||
/* Create native_buffer */
|
||||
jobject buffer = (*env)->NewDirectByteBuffer(env, lcd_framebuffer,
|
||||
(jlong) sizeof(lcd_framebuffer));
|
||||
(jlong) FRAMEBUFFER_SIZE);
|
||||
|
||||
/* we need to setup parts for the java object every time */
|
||||
(*env)->CallVoidMethod(env, fb_instance, java_lcd_init,
|
||||
|
|
@ -206,10 +206,10 @@ void lcd_blit_yuv(unsigned char * const src[3],
|
|||
linecounter = height >> 1;
|
||||
|
||||
#if LCD_WIDTH >= LCD_HEIGHT
|
||||
dst = &lcd_framebuffer[y][x];
|
||||
dst = FBADDR(x,y);
|
||||
row_end = dst + width;
|
||||
#else
|
||||
dst = &lcd_framebuffer[x][LCD_WIDTH - y - 1];
|
||||
dst = FBADDR(LCD_WIDTH - y - 1,x);
|
||||
row_end = dst + LCD_WIDTH * width;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -92,29 +92,25 @@ static unsigned long get_lcd_pixel(int x, int y)
|
|||
{
|
||||
#if LCD_DEPTH == 1
|
||||
#ifdef HAVE_NEGATIVE_LCD
|
||||
return (lcd_framebuffer[y/8][x] & (1 << (y & 7))) ? (NUM_SHADES-1) : 0;
|
||||
return (*FBADDR(x, y/8) & (1 << (y & 7))) ? (NUM_SHADES-1) : 0;
|
||||
#else
|
||||
return (lcd_framebuffer[y/8][x] & (1 << (y & 7))) ? 0 : (NUM_SHADES-1);
|
||||
return (*FBADDR(x, y/8) & (1 << (y & 7))) ? 0 : (NUM_SHADES-1);
|
||||
#endif
|
||||
#elif LCD_DEPTH == 2
|
||||
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
|
||||
return colorindex[(lcd_framebuffer[y][x/4] >> (2 * (~x & 3))) & 3];
|
||||
return colorindex[(*FBADDR(x/4, y) >> (2 * (~x & 3))) & 3];
|
||||
#elif LCD_PIXELFORMAT == VERTICAL_PACKING
|
||||
return colorindex[(lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3];
|
||||
return colorindex[(*FBADDR(x, y/4) >> (2 * (y & 3))) & 3];
|
||||
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
|
||||
unsigned bits = (lcd_framebuffer[y/8][x] >> (y & 7)) & 0x0101;
|
||||
unsigned bits = (*FBADDR(x, y/8) >> (y & 7)) & 0x0101;
|
||||
return colorindex[(bits | (bits >> 7)) & 3];
|
||||
#endif
|
||||
#elif LCD_DEPTH == 16
|
||||
#if LCD_PIXELFORMAT == RGB565SWAPPED
|
||||
unsigned bits = lcd_framebuffer[y][x];
|
||||
unsigned bits = *FBADDR(x, y);
|
||||
return (bits >> 8) | (bits << 8);
|
||||
#else
|
||||
#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
||||
return *(&lcd_framebuffer[0][0]+LCD_HEIGHT*x+y);
|
||||
#else
|
||||
return lcd_framebuffer[y][x];
|
||||
#endif
|
||||
return *FBADDR(x, y);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ static const unsigned char colorindex[4] = {128, 85, 43, 0};
|
|||
static unsigned long get_lcd_remote_pixel(int x, int y)
|
||||
{
|
||||
#if LCD_REMOTE_DEPTH == 1
|
||||
return lcd_remote_framebuffer[y/8][x] & (1 << (y & 7)) ? 0 : (NUM_SHADES-1);
|
||||
return *FBREMOTEADDR(x, y/8) & (1 << (y & 7)) ? 0 : (NUM_SHADES-1);
|
||||
#elif LCD_REMOTE_DEPTH == 2
|
||||
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
|
||||
unsigned bits = (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 0x0101;
|
||||
unsigned bits = (*FBREMOTEADDR(x, y/8) >> (y & 7)) & 0x0101;
|
||||
return colorindex[(bits | (bits >> 7)) & 3];
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ fb_data *dev_fb = 0;
|
|||
void lcd_shutdown(void)
|
||||
{
|
||||
printf("FB closed.");
|
||||
munmap(dev_fb, sizeof(lcd_framebuffer));
|
||||
munmap(dev_fb, FRAMEBUFFER_SIZE);
|
||||
close(dev_fd);
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ void lcd_init_device(void)
|
|||
|
||||
/* Figure out the size of the screen in bytes */
|
||||
screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
|
||||
if (screensize != sizeof(lcd_framebuffer))
|
||||
if (screensize != FRAMEBUFFER_SIZE)
|
||||
{
|
||||
exit(4);
|
||||
perror("Display and framebuffer mismatch!\n");
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
dma_enable();
|
||||
|
||||
REG_DMAC_DCCSR(DMA_LCD_CHANNEL) = DMAC_DCCSR_NDES;
|
||||
REG_DMAC_DSAR(DMA_LCD_CHANNEL) = PHYSADDR((unsigned long)&lcd_framebuffer[y][x]);
|
||||
REG_DMAC_DSAR(DMA_LCD_CHANNEL) = PHYSADDR((unsigned long)FBADDR(x,y));
|
||||
REG_DMAC_DRSR(DMA_LCD_CHANNEL) = DMAC_DRSR_RS_SLCD;
|
||||
REG_DMAC_DTAR(DMA_LCD_CHANNEL) = PHYSADDR(SLCD_FIFO);
|
||||
REG_DMAC_DTCR(DMA_LCD_CHANNEL) = (width * height) >> 3;
|
||||
|
|
@ -195,7 +195,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
|
|||
IPU_SET_Y_ADDR(PHYSADDR((unsigned long)yuv_src[0]));
|
||||
IPU_SET_U_ADDR(PHYSADDR((unsigned long)yuv_src[1]));
|
||||
IPU_SET_V_ADDR(PHYSADDR((unsigned long)yuv_src[2]));
|
||||
IPU_SET_OUT_ADDR(PHYSADDR((unsigned long)&lcd_framebuffer[x][y]));
|
||||
IPU_SET_OUT_ADDR(PHYSADDR((unsigned long)FBADDR(y,x)));
|
||||
|
||||
IPU_SET_OUT_FM(height, width);
|
||||
IPU_SET_OUT_STRIDE(height);
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ void lcd_update(void)
|
|||
lcd_write_command (LCD_CNTL_HIGHCOL | ((xoffset >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | (xoffset & 0xf));
|
||||
|
||||
lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
|
||||
lcd_write_data (FBADDR(0, y), LCD_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -219,6 +219,6 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset) >> 4) & 0xf));
|
||||
lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf));
|
||||
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
lcd_write_data (FBADDR(x,y), width);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue