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:
Jonathan Gordon 2012-02-22 21:18:05 +11:00
parent 15c69b8baf
commit b37e6bc8c1
65 changed files with 193 additions and 181 deletions

View file

@ -159,7 +159,7 @@ static const struct plugin_api rockbox_api = {
lcd_icon,
lcd_double_height,
#else
&lcd_framebuffer[0][0],
&lcd_static_framebuffer[0][0],
lcd_update_rect,
lcd_set_drawmode,
lcd_get_drawmode,
@ -264,7 +264,7 @@ static const struct plugin_api rockbox_api = {
lcd_remote_putsxy,
lcd_remote_puts_style,
lcd_remote_puts_scroll_style,
&lcd_remote_framebuffer[0][0],
&lcd_remote_static_framebuffer[0][0],
lcd_remote_update,
lcd_remote_update_rect,

View file

@ -35,9 +35,9 @@ enum fill_opt {
};
/*** globals ***/
fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH]
fb_data lcd_static_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH]
IRAM_LCDFRAMEBUFFER CACHEALIGN_AT_LEAST_ATTR(16);
fb_data *lcd_framebuffer = &lcd_static_framebuffer[0][0];
static fb_data* lcd_backdrop = NULL;
static long lcd_backdrop_offset IDATA_ATTR = 0;
@ -234,7 +234,7 @@ void lcd_set_backdrop(fb_data* backdrop)
lcd_backdrop = backdrop;
if (backdrop)
{
lcd_backdrop_offset = (long)backdrop - (long)&lcd_framebuffer[0][0];
lcd_backdrop_offset = (long)backdrop - (long)lcd_framebuffer;
lcd_fastpixelfuncs = lcd_fastpixelfuncs_backdrop;
}
else
@ -271,7 +271,7 @@ void lcd_drawpixel(int x, int y)
&& ((unsigned)y < (unsigned)LCD_HEIGHT)
#endif
)
lcd_fastpixelfuncs[current_vp->drawmode](LCDADDR(current_vp->x+x, current_vp->y+y));
lcd_fastpixelfuncs[current_vp->drawmode](FBADDR(current_vp->x+x, current_vp->y+y));
}
/* Draw a line */
@ -346,7 +346,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
&& ((unsigned)y < (unsigned)LCD_HEIGHT)
#endif
)
pfunc(LCDADDR(x + current_vp->x, y + current_vp->y));
pfunc(FBADDR(x + current_vp->x, y + current_vp->y));
if (d < 0)
{
@ -459,7 +459,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
src_end = src + width;
dst_col = LCDADDR(x, y);
dst_col = FBADDR(x, y);
if (drmode & DRMODE_INVERSEVID)
@ -747,7 +747,7 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image,
dmask = ~dmask;
}
dst_row = LCDADDR(x, y);
dst_row = FBADDR(x, y);
int col, row = height;
unsigned data, pixels;
@ -1020,10 +1020,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

View file

@ -41,10 +41,7 @@
#define ROW_INC 1
#define COL_INC LCD_HEIGHT
#define LCDADDR(x, y) (&lcd_framebuffer[0][0] + LCD_HEIGHT*(x) + (y))
#include "lcd-16bit-common.c"
#include "lcd-bitmap-common.c"
/*** drawing functions ***/
@ -54,7 +51,7 @@ void lcd_clear_viewport(void)
{
fb_data *dst, *dst_end;
dst = LCDADDR(current_vp->x, current_vp->y);
dst = FBADDR(current_vp->x, current_vp->y);
dst_end = dst + current_vp->width * LCD_HEIGHT;
if (current_vp->drawmode & DRMODE_INVERSEVID)
@ -145,7 +142,7 @@ void lcd_hline(int x1, int x2, int y)
x2 = LCD_WIDTH-1;
#endif
dst = LCDADDR(x1 , y );
dst = FBADDR(x1 , y );
dst_end = dst + (x2 - x1) * LCD_HEIGHT;
do
@ -230,7 +227,7 @@ void lcd_vline(int x, int y1, int y2)
if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT)
return;
dst = LCDADDR(x, y1);
dst = FBADDR(x, y1);
switch (fillopt)
{
@ -333,7 +330,7 @@ void lcd_fillrect(int x, int y, int width, int height)
if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT)
return;
dst = LCDADDR(x, y);
dst = FBADDR(x, y);
dst_end = dst + width * LCD_HEIGHT;
do
@ -426,7 +423,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
#endif
src += stride * src_x + src_y; /* move starting point */
dst = LCDADDR(x, y);
dst = FBADDR(x, y);
fb_data *dst_end = dst + width * LCD_HEIGHT;
do
@ -500,7 +497,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
#endif
src += stride * src_x + src_y; /* move starting point */
dst = LCDADDR(x, y);
dst = FBADDR(x, y);
dst_end = dst + width * LCD_HEIGHT;
do

View file

@ -41,10 +41,7 @@
#define ROW_INC LCD_WIDTH
#define COL_INC 1
#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)])
#include "lcd-16bit-common.c"
#include "lcd-bitmap-common.c"
/*** drawing functions ***/
@ -54,7 +51,7 @@ void lcd_clear_viewport(void)
{
fb_data *dst, *dst_end;
dst = LCDADDR(current_vp->x, current_vp->y);
dst = FBADDR(current_vp->x, current_vp->y);
dst_end = dst + current_vp->height * LCD_WIDTH;
if (current_vp->drawmode & DRMODE_INVERSEVID)
@ -173,7 +170,7 @@ void lcd_hline(int x1, int x2, int y)
if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT)
return;
dst = LCDADDR(x1, y);
dst = FBADDR(x1, y);
switch (fillopt)
{
@ -241,7 +238,7 @@ void lcd_vline(int x, int y1, int y2)
y2 = LCD_HEIGHT-1;
#endif
dst = LCDADDR(x , y1);
dst = FBADDR(x , y1);
dst_end = dst + (y2 - y1) * LCD_WIDTH;
do
@ -333,7 +330,7 @@ void lcd_fillrect(int x, int y, int width, int height)
if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT)
return;
dst = LCDADDR(x, y);
dst = FBADDR(x, y);
dst_end = dst + height * LCD_WIDTH;
do
@ -426,7 +423,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
#endif
src += stride * src_y + src_x; /* move starting point */
dst = LCDADDR(x, y);
dst = FBADDR(x, y);
do
{
@ -500,7 +497,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
#endif
src += stride * src_y + src_x; /* move starting point */
dst = LCDADDR(x, y);
dst = FBADDR(x, y);
#ifdef CPU_ARM
{

View file

@ -37,14 +37,16 @@
#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */
#define LCDFN(fn) lcd_ ## fn
#define FBFN(fn) fb_ ## fn
#define FBSIZE FRAMEBUFFER_SIZE
#define LCDM(ma) LCD_ ## ma
#define LCDNAME "lcd_"
#define LCDFB(x,y) FBADDR(x, y)
#define MAIN_LCD
#endif
/*** globals ***/
FBFN(data) LCDFN(framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
FBFN(data) LCDFN(static_framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
FBFN(data) *LCDFN(framebuffer) = &LCDFN(static_framebuffer)[0][0];
static struct viewport default_vp =
{
@ -152,17 +154,17 @@ int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
static void setpixel(int x, int y)
{
LCDFN(framebuffer)[y>>3][x] |= BIT_N(y & 7);
*LCDFB(x,y>>3) |= BIT_N(y & 7);
}
static void clearpixel(int x, int y)
{
LCDFN(framebuffer)[y>>3][x] &= ~BIT_N(y & 7);
*LCDFB(x,y>>3) &= ~BIT_N(y & 7);
}
static void flippixel(int x, int y)
{
LCDFN(framebuffer)[y>>3][x] ^= BIT_N(y & 7);
*LCDFB(x,y>>3) ^= BIT_N(y & 7);
}
static void nopixel(int x, int y)
@ -242,7 +244,7 @@ void LCDFN(clear_display)(void)
{
unsigned bits = (current_vp->drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0;
memset(LCDFN(framebuffer), bits, sizeof LCDFN(framebuffer));
memset(LCDFN(framebuffer), bits, FBSIZE);
LCDFN(scroll_info).lines = 0;
}
@ -422,7 +424,7 @@ void LCDFN(hline)(int x1, int x2, int y)
width = x2 - x1 + 1;
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
dst = &LCDFN(framebuffer)[y>>3][x1];
dst = LCDFB(x1,y>>3);
mask = BIT_N(y & 7);
dst_end = dst + width;
@ -478,7 +480,7 @@ void LCDFN(vline)(int x, int y1, int y2)
#endif
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
dst = &LCDFN(framebuffer)[y1>>3][x];
dst = LCDFB(x,y1>>3);
ny = y2 - (y1 & ~7);
mask = 0xFFu << (y1 & 7);
mask_bottom = 0xFFu >> (~ny & 7);
@ -583,7 +585,7 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
}
}
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
dst = &LCDFN(framebuffer)[y>>3][x];
dst = LCDFB(x,y>>3);
ny = height - 1 + (y & 7);
mask = 0xFFu << (y & 7);
mask_bottom = 0xFFu >> (~ny & 7);
@ -696,7 +698,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
dst = &LCDFN(framebuffer)[y>>3][x];
dst = LCDFB(x,y>>3);
shift = y & 7;
ny = height - 1 + shift + src_y;

View file

@ -39,7 +39,8 @@
/*** globals ***/
unsigned char lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IRAM_LCDFRAMEBUFFER;
unsigned char lcd_static_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IRAM_LCDFRAMEBUFFER;
unsigned char *lcd_framebuffer = &lcd_static_framebuffer[0][0];
static const unsigned char pixmask[4] ICONST_ATTR = {
0xC0, 0x30, 0x0C, 0x03
@ -193,7 +194,7 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
static void setpixel(int x, int y)
{
unsigned mask = pixmask[x & 3];
fb_data *address = &lcd_framebuffer[y][x>>2];
fb_data *address = FBADDR(x>>2,y);
unsigned data = *address;
*address = data ^ ((data ^ fg_pattern) & mask);
@ -202,7 +203,7 @@ static void setpixel(int x, int y)
static void clearpixel(int x, int y)
{
unsigned mask = pixmask[x & 3];
fb_data *address = &lcd_framebuffer[y][x>>2];
fb_data *address = FBADDR(x>>2,y);
unsigned data = *address;
*address = data ^ ((data ^ bg_pattern) & mask);
@ -211,7 +212,7 @@ static void clearpixel(int x, int y)
static void clearimgpixel(int x, int y)
{
unsigned mask = pixmask[x & 3];
fb_data *address = &lcd_framebuffer[y][x>>2];
fb_data *address = FBADDR(x>>2,y);
unsigned data = *address;
*address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask);
@ -220,7 +221,7 @@ static void clearimgpixel(int x, int y)
static void flippixel(int x, int y)
{
unsigned mask = pixmask[x & 3];
fb_data *address = &lcd_framebuffer[y][x>>2];
fb_data *address = FBADDR(x>>2,y);
*address ^= mask;
}
@ -396,14 +397,14 @@ void lcd_clear_display(void)
{
if (current_vp->drawmode & DRMODE_INVERSEVID)
{
memset(lcd_framebuffer, fg_pattern, sizeof lcd_framebuffer);
memset(lcd_framebuffer, fg_pattern, FRAMEBUFFER_SIZE);
}
else
{
if (lcd_backdrop)
memcpy(lcd_framebuffer, lcd_backdrop, sizeof lcd_framebuffer);
memcpy(lcd_framebuffer, lcd_backdrop, FRAMEBUFFER_SIZE);
else
memset(lcd_framebuffer, bg_pattern, sizeof lcd_framebuffer);
memset(lcd_framebuffer, bg_pattern, FRAMEBUFFER_SIZE);
}
lcd_scroll_info.lines = 0;
@ -583,7 +584,7 @@ void lcd_hline(int x1, int x2, int y)
#endif
bfunc = lcd_blockfuncs[current_vp->drawmode];
dst = &lcd_framebuffer[y][x1>>2];
dst = FBADDR(x1>>2,y);
nx = x2 - (x1 & ~3);
mask = 0xFFu >> (2 * (x1 & 3));
mask_right = 0xFFu << (2 * (~nx & 3));
@ -644,7 +645,7 @@ void lcd_vline(int x, int y1, int y2)
#endif
bfunc = lcd_blockfuncs[current_vp->drawmode];
dst = &lcd_framebuffer[y1][x>>2];
dst = FBADDR(x>>2,y1);
mask = pixmask[x & 3];
dst_end = dst + (y2 - y1) * LCD_FBWIDTH;
@ -729,7 +730,7 @@ void lcd_fillrect(int x, int y, int width, int height)
#endif
bfunc = lcd_blockfuncs[current_vp->drawmode];
dst = &lcd_framebuffer[y][x>>2];
dst = FBADDR(x>>2,y);
nx = width - 1 + (x & 3);
mask = 0xFFu >> (2 * (x & 3));
mask_right = 0xFFu << (2 * (~nx & 3));
@ -836,7 +837,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
src_y &= 7;
src_end = src + width;
dst = &lcd_framebuffer[y][x >> 2];
dst = FBADDR(x >> 2,y);
dst_end = dst + height * LCD_FBWIDTH;
dst_mask = pixmask[x & 3];
@ -1050,7 +1051,7 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x,
src += stride * src_y + (src_x >> 2); /* move starting point */
src_x &= 3;
x -= src_x;
dst = &lcd_framebuffer[y][x>>2];
dst = FBADDR(x>>2,y);
shift = x & 3;
nx = width - 1 + shift + src_x;

View file

@ -36,7 +36,8 @@
/*** globals ***/
fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IRAM_LCDFRAMEBUFFER;
fb_data lcd_static_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH] IRAM_LCDFRAMEBUFFER;
fb_data *lcd_framebuffer = &lcd_static_framebuffer[0][0];
const unsigned char lcd_dibits[16] ICONST_ATTR = {
0x00, 0x03, 0x0C, 0x0F, 0x30, 0x33, 0x3C, 0x3F,
@ -196,7 +197,7 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
static void setpixel(int x, int y)
{
unsigned mask = pixmask[y & 3];
fb_data *address = &lcd_framebuffer[y>>2][x];
fb_data *address = FBADDR(x,y>>2);
unsigned data = *address;
*address = data ^ ((data ^ fg_pattern) & mask);
@ -205,7 +206,7 @@ static void setpixel(int x, int y)
static void clearpixel(int x, int y)
{
unsigned mask = pixmask[y & 3];
fb_data *address = &lcd_framebuffer[y>>2][x];
fb_data *address = FBADDR(x,y>>2);
unsigned data = *address;
*address = data ^ ((data ^ bg_pattern) & mask);
@ -214,7 +215,7 @@ static void clearpixel(int x, int y)
static void clearimgpixel(int x, int y)
{
unsigned mask = pixmask[y & 3];
fb_data *address = &lcd_framebuffer[y>>2][x];
fb_data *address = FBADDR(x,y>>2);
unsigned data = *address;
*address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask);
@ -223,7 +224,7 @@ static void clearimgpixel(int x, int y)
static void flippixel(int x, int y)
{
unsigned mask = pixmask[y & 3];
fb_data *address = &lcd_framebuffer[y>>2][x];
fb_data *address = FBADDR(x,y>>2);
*address ^= mask;
}
@ -399,14 +400,14 @@ void lcd_clear_display(void)
{
if (current_vp->drawmode & DRMODE_INVERSEVID)
{
memset(lcd_framebuffer, fg_pattern, sizeof lcd_framebuffer);
memset(lcd_framebuffer, fg_pattern, FRAMEBUFFER_SIZE);
}
else
{
if (lcd_backdrop)
memcpy(lcd_framebuffer, lcd_backdrop, sizeof lcd_framebuffer);
memcpy(lcd_framebuffer, lcd_backdrop, FRAMEBUFFER_SIZE);
else
memset(lcd_framebuffer, bg_pattern, sizeof lcd_framebuffer);
memset(lcd_framebuffer, bg_pattern, FRAMEBUFFER_SIZE);
}
lcd_scroll_info.lines = 0;
@ -589,7 +590,7 @@ void lcd_hline(int x1, int x2, int y)
width = x2 - x1 + 1;
bfunc = lcd_blockfuncs[current_vp->drawmode];
dst = &lcd_framebuffer[y>>2][x1];
dst = FBADDR(x1,y>>2);
mask = pixmask[y & 3];
dst_end = dst + width;
@ -645,7 +646,7 @@ void lcd_vline(int x, int y1, int y2)
#endif
bfunc = lcd_blockfuncs[current_vp->drawmode];
dst = &lcd_framebuffer[y1>>2][x];
dst = FBADDR(x,y1>>2);
ny = y2 - (y1 & ~3);
mask = 0xFFu << (2 * (y1 & 3));
mask_bottom = 0xFFu >> (2 * (~ny & 3));
@ -751,7 +752,7 @@ void lcd_fillrect(int x, int y, int width, int height)
}
}
bfunc = lcd_blockfuncs[current_vp->drawmode];
dst = &lcd_framebuffer[y>>2][x];
dst = FBADDR(x,y>>2);
ny = height - 1 + (y & 3);
mask = 0xFFu << (2 * (y & 3));
mask_bottom = 0xFFu >> (2 * (~ny & 3));
@ -863,7 +864,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
dst = &lcd_framebuffer[y>>2][x];
dst = FBADDR(x,y>>2);
shift = y & 3;
ny = height - 1 + shift + src_y;
mask = 0xFFFFu << (2 * (shift + src_y));
@ -1060,7 +1061,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
src += stride * (src_y >> 2) + src_x; /* move starting point */
src_y &= 3;
y -= src_y;
dst = &lcd_framebuffer[y>>2][x];
dst = FBADDR(x,y>>2);
shift = y & 3;
ny = height - 1 + shift + src_y;

View file

@ -40,13 +40,17 @@
#define LCDFN(fn) lcd_ ## fn
#define FBFN(fn) fb_ ## fn
#define LCDM(ma) LCD_ ## ma
#define FBSIZE FRAMEBUFFER_SIZE
#define LCDNAME "lcd_"
#define LCDFB(x,y) FBADDR(x, y)
#define MAIN_LCD
#endif
/*** globals ***/
FBFN(data) LCDFN(framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
FBFN(data) LCDFN(static_framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
FBFN(data) *LCDFN(framebuffer) = &LCDFN(static_framebuffer)[0][0];
static const FBFN(data) patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};
@ -214,7 +218,7 @@ int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
static void setpixel(int x, int y)
{
unsigned mask = 0x0101 << (y & 7);
FBFN(data) *address = &LCDFN(framebuffer)[y>>3][x];
FBFN(data) *address = LCDFB(x,y>>3);
unsigned data = *address;
*address = data ^ ((data ^ fg_pattern) & mask);
@ -223,7 +227,7 @@ static void setpixel(int x, int y)
static void clearpixel(int x, int y)
{
unsigned mask = 0x0101 << (y & 7);
FBFN(data) *address = &LCDFN(framebuffer)[y>>3][x];
FBFN(data) *address = LCDFB(x,y>>3);
unsigned data = *address;
*address = data ^ ((data ^ bg_pattern) & mask);
@ -232,7 +236,7 @@ static void clearpixel(int x, int y)
static void clearimgpixel(int x, int y)
{
unsigned mask = 0x0101 << (y & 7);
FBFN(data) *address = &LCDFN(framebuffer)[y>>3][x];
FBFN(data) *address = LCDFB(x,y>>3);
unsigned data = *address;
*address = data ^ ((data ^ *(FBFN(data) *)((long)address
@ -242,7 +246,7 @@ static void clearimgpixel(int x, int y)
static void flippixel(int x, int y)
{
unsigned mask = 0x0101 << (y & 7);
FBFN(data) *address = &LCDFN(framebuffer)[y>>3][x];
FBFN(data) *address = LCDFB(x,y>>3);
*address ^= mask;
}
@ -420,15 +424,15 @@ void LCDFN(clear_display)(void)
if (default_vp.drawmode & DRMODE_INVERSEVID)
{
memset(LCDFN(framebuffer), patterns[default_vp.fg_pattern & 3],
sizeof LCDFN(framebuffer));
FBSIZE);
}
else
{
if (backdrop)
memcpy(LCDFN(framebuffer), backdrop, sizeof LCDFN(framebuffer));
memcpy(LCDFN(framebuffer), backdrop, FBSIZE);
else
memset(LCDFN(framebuffer), patterns[default_vp.bg_pattern & 3],
sizeof LCDFN(framebuffer));
FBSIZE);
}
LCDFN(scroll_info).lines = 0;
@ -611,7 +615,7 @@ void LCDFN(hline)(int x1, int x2, int y)
width = x2 - x1 + 1;
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
dst = &LCDFN(framebuffer)[y>>3][x1];
dst = LCDFB(x1,y>>3);
mask = 0x0101 << (y & 7);
dst_end = dst + width;
@ -667,7 +671,7 @@ void LCDFN(vline)(int x, int y1, int y2)
#endif
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
dst = &LCDFN(framebuffer)[y1>>3][x];
dst = LCDFB(x,y1>>3);
ny = y2 - (y1 & ~7);
mask = (0xFFu << (y1 & 7)) & 0xFFu;
mask |= mask << 8;
@ -776,7 +780,7 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
}
}
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
dst = &LCDFN(framebuffer)[y>>3][x];
dst = LCDFB(x,y>>3);
ny = height - 1 + (y & 7);
mask = (0xFFu << (y & 7)) & 0xFFu;
mask |= mask << 8;
@ -890,7 +894,7 @@ void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
dst = &LCDFN(framebuffer)[y>>3][x];
dst = LCDFB(x,y>>3);
shift = y & 7;
ny = height - 1 + shift + src_y;
@ -1058,7 +1062,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const FBFN(data) *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
y -= src_y;
dst = &LCDFN(framebuffer)[y>>3][x];
dst = LCDFB(x,y>>3);
shift = y & 7;
ny = height - 1 + shift + src_y;

View file

@ -66,7 +66,7 @@ void lcd_update(void)
return;
/* Copy the Rockbox framebuffer to the second framebuffer */
lcd_copy_buffer_rect(LCD_FRAMEBUF_ADDR(0, 0), &lcd_framebuffer[0][0],
lcd_copy_buffer_rect(LCD_FRAMEBUF_ADDR(0, 0), FBADDR(0,0),
LCD_WIDTH*LCD_HEIGHT, 1);
}
#endif /* LCD_OPTIMIZED_UPDATE */
@ -95,7 +95,7 @@ void lcd_update_rect(int x, int y, int width, int height)
return; /* nothing left to do */
dst = LCD_FRAMEBUF_ADDR(x, y);
src = &lcd_framebuffer[y][x];
src = FBADDR(x,y);
/* Copy part of the Rockbox framebuffer to the second framebuffer */
if (width < LCD_WIDTH)

View file

@ -24,7 +24,9 @@
/* Compile 1 bit vertical packing LCD driver for remote LCD */
#define LCDFN(fn) lcd_remote_ ## fn
#define FBFN(fn) fb_remote_ ## fn
#define FBSIZE FRAMEBUFFER_REMOTE_SIZE
#define LCDM(ma) LCD_REMOTE_ ## ma
#define LCDFB(x,y) FBREMOTEADDR(x, y)
#define LCDNAME "lcd_remote_"
#include "lcd-1bit-vert.c"

View file

@ -26,7 +26,9 @@
/* Compile 2 bit vertical interleaved LCD driver for remote LCD */
#define LCDFN(fn) lcd_remote_ ## fn
#define FBFN(fn) fb_remote_ ## fn
#define FBSIZE FRAMEBUFFER_REMOTE_SIZE
#define LCDM(ma) LCD_REMOTE_ ## ma
#define LCDFB(x,y) FBREMOTEADDR(x, y)
#define LCDNAME "lcd_remote_"
#include "lcd-2bit-vi.c"

View file

@ -96,7 +96,10 @@ extern unsigned lcd_remote_color_to_native(unsigned color);
#endif
/* The actual framebuffer */
extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
extern fb_remote_data *lcd_remote_framebuffer;
extern fb_remote_data lcd_remote_static_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
#define FBREMOTEADDR(x, y) (lcd_remote_framebuffer + ((y) * LCD_REMOTE_FBWIDTH) + (x))
#define FRAMEBUFFER_REMOTE_SIZE (sizeof(lcd_remote_static_framebuffer))
#if LCD_REMOTE_DEPTH > 1
extern void lcd_remote_set_foreground(unsigned foreground);

View file

@ -413,7 +413,14 @@ static inline unsigned lcd_color_to_native(unsigned color)
#define LCD_FBHEIGHT LCD_HEIGHT
#endif
/* The actual framebuffer */
extern fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH];
extern fb_data *lcd_framebuffer;
extern fb_data lcd_static_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH];
#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
#define FBADDR(x, y) (lcd_framebuffer + ((x) * LCD_FBHEIGHT) + (y))
#else
#define FBADDR(x, y) (lcd_framebuffer + ((y) * LCD_FBWIDTH) + (x))
#endif
#define FRAMEBUFFER_SIZE (sizeof(lcd_static_framebuffer))
/** Port-specific functions. Enable in port config file. **/
#ifdef HAVE_REMOTE_LCD_AS_MAIN

View file

@ -154,7 +154,7 @@ void screen_dump(void)
#if LCD_DEPTH == 1
dst_end = dst + LCD_WIDTH/2;
src = lcd_framebuffer[y >> 3];
src = FBADDR(0, y >> 3);
mask = BIT_N(y & 7);
do
@ -173,7 +173,7 @@ void screen_dump(void)
dst_end = dst + LCD_WIDTH/2;
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
src = lcd_framebuffer[y];
src = FBADDR(0, y);
do
{
@ -185,7 +185,7 @@ void screen_dump(void)
while (dst < dst_end);
#elif LCD_PIXELFORMAT == VERTICAL_PACKING
src = lcd_framebuffer[y >> 2];
src = FBADDR(0, y >> 2);
shift = 2 * (y & 3);
do
@ -197,7 +197,7 @@ void screen_dump(void)
while (dst < dst_end);
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
src = lcd_framebuffer[y >> 3];
src = FBADDR(0, y >> 3);
shift = y & 7;
do
@ -214,7 +214,7 @@ void screen_dump(void)
#endif
#elif LCD_DEPTH == 16
dst_end = dst + LCD_WIDTH;
src = lcd_framebuffer[y];
src = FBADDR(0, y);
do
{
@ -318,7 +318,7 @@ void remote_screen_dump(void)
#if LCD_REMOTE_DEPTH == 1
dst_end = dst + LCD_REMOTE_WIDTH/2;
src = lcd_remote_framebuffer[y >> 3];
src = FBREMOTEADDR(0, y >> 3);
mask = BIT_N(y & 7);
do
@ -333,7 +333,7 @@ void remote_screen_dump(void)
dst_end = dst + LCD_REMOTE_WIDTH/2;
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
src = lcd_remote_framebuffer[y >> 3];
src = FBREMOTEADDR(0, (y >> 3));
shift = y & 7;
do

View file

@ -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
{

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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
{

View file

@ -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

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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)

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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++)

View file

@ -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);

View file

@ -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)
{

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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 */

View file

@ -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));
}
}

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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++;

View file

@ -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

View file

@ -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 */

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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 */

View file

@ -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);

View file

@ -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);

View file

@ -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 ;

View file

@ -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);
}
}

View file

@ -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();

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}

View file

@ -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
{

View file

@ -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);
}
}

View file

@ -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)

View file

@ -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);
}
}

View file

@ -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)

View file

@ -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);
}
}

View file

@ -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

View file

@ -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
}

View file

@ -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

View file

@ -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");

View file

@ -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);

View file

@ -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);
}
}