summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoshe Piekarski <dev.rockbox@melachim.net>2020-10-06 13:34:04 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2020-10-26 12:28:48 -0400
commit12f3ed1699d6bef25bed90ba95cbcc1a6bb4934a (patch)
treecb9850c2c4ea68b7acc816828c4d53dd7c8391f9
parent5d5f8169b53fc989b456b0f0d7940bcf9415cbeb (diff)
downloadrockbox-12f3ed1699d6bef25bed90ba95cbcc1a6bb4934a.tar.gz
rockbox-12f3ed1699d6bef25bed90ba95cbcc1a6bb4934a.zip
make the plugin API frambuffer agnostic
Change-Id: I5abdc231093054c517ff53b9a456997e440e3f6e
-rw-r--r--apps/plugin.c6
-rw-r--r--apps/plugin.h10
-rw-r--r--apps/plugins/doom/i_video.c4
-rw-r--r--apps/plugins/fire.c2
-rw-r--r--apps/plugins/imageviewer/imageviewer.c4
-rw-r--r--apps/plugins/imageviewer/jpeg/yuv2rgb.c4
-rw-r--r--apps/plugins/invadrox.c8
-rw-r--r--apps/plugins/lib/grey_core.c8
-rw-r--r--apps/plugins/lib/osd.c2
-rw-r--r--apps/plugins/lib/xlcd_draw.c4
-rw-r--r--apps/plugins/lib/xlcd_scroll.c50
-rw-r--r--apps/plugins/lua/rocklib_img.c2
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c4
-rwxr-xr-xapps/plugins/pacbox/pacbox.c2
-rw-r--r--apps/plugins/pictureflow/pictureflow.c2
-rw-r--r--apps/plugins/plasma.c6
-rw-r--r--apps/plugins/puzzles/rockbox.c14
-rw-r--r--apps/plugins/rockboy/lcd.c8
-rw-r--r--apps/plugins/rockboy/sys_rockbox.c4
-rw-r--r--apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c8
-rw-r--r--apps/plugins/test_resize.c2
-rw-r--r--apps/plugins/xworld/sys.c18
-rw-r--r--apps/plugins/zxbox/zxvid_16bpp.c4
-rw-r--r--apps/plugins/zxbox/zxvid_2bpp.c6
-rw-r--r--firmware/export/lcd.h3
25 files changed, 92 insertions, 93 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index bdb2d64239..48f9dac487 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 Bjรถrn Stenberg 10 * Copyright (C) 2002 Bjrn Stenberg
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -194,7 +194,7 @@ static const struct plugin_api rockbox_api = {
194 lcd_putsf, 194 lcd_putsf,
195 lcd_puts_scroll, 195 lcd_puts_scroll,
196 lcd_scroll_stop, 196 lcd_scroll_stop,
197 &lcd_static_framebuffer[0][0], 197 &lcd_framebuffer,
198 lcd_set_viewport, 198 lcd_set_viewport,
199 lcd_set_framebuffer, 199 lcd_set_framebuffer,
200 lcd_bmp_part, 200 lcd_bmp_part,
@@ -281,7 +281,7 @@ static const struct plugin_api rockbox_api = {
281 lcd_remote_mono_bitmap_part, 281 lcd_remote_mono_bitmap_part,
282 lcd_remote_mono_bitmap, 282 lcd_remote_mono_bitmap,
283 lcd_remote_putsxy, 283 lcd_remote_putsxy,
284 &lcd_remote_static_framebuffer[0][0], 284 &lcd_remote_framebuffer;
285 lcd_remote_update, 285 lcd_remote_update,
286 lcd_remote_update_rect, 286 lcd_remote_update_rect,
287#if (LCD_REMOTE_DEPTH > 1) 287#if (LCD_REMOTE_DEPTH > 1)
diff --git a/apps/plugin.h b/apps/plugin.h
index 12b7e68447..12fc5424f1 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 Bjรถrn Stenberg 10 * Copyright (C) 2002 Bjrn Stenberg
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -155,12 +155,12 @@ int plugin_open(char *plugin, char *parameter);
155#define PLUGIN_MAGIC 0x526F634B /* RocK */ 155#define PLUGIN_MAGIC 0x526F634B /* RocK */
156 156
157/* increase this every time the api struct changes */ 157/* increase this every time the api struct changes */
158#define PLUGIN_API_VERSION 241 158#define PLUGIN_API_VERSION 242
159 159
160/* update this to latest version if a change to the api struct breaks 160/* update this to latest version if a change to the api struct breaks
161 backwards compatibility (and please take the opportunity to sort in any 161 backwards compatibility (and please take the opportunity to sort in any
162 new function which are "waiting" at the end of the function table) */ 162 new function which are "waiting" at the end of the function table) */
163#define PLUGIN_MIN_API_VERSION 241 163#define PLUGIN_MIN_API_VERSION 242
164 164
165/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ 165/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
166 166
@@ -204,7 +204,7 @@ struct plugin_api {
204 void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...); 204 void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...);
205 bool (*lcd_puts_scroll)(int x, int y, const unsigned char* string); 205 bool (*lcd_puts_scroll)(int x, int y, const unsigned char* string);
206 void (*lcd_scroll_stop)(void); 206 void (*lcd_scroll_stop)(void);
207 fb_data* lcd_framebuffer; 207 fb_data** lcd_framebuffer;
208 void (*lcd_set_viewport)(struct viewport* vp); 208 void (*lcd_set_viewport)(struct viewport* vp);
209 void (*lcd_set_framebuffer)(fb_data *fb); 209 void (*lcd_set_framebuffer)(fb_data *fb);
210 void (*lcd_bmp_part)(const struct bitmap *bm, int src_x, int src_y, 210 void (*lcd_bmp_part)(const struct bitmap *bm, int src_x, int src_y,
@@ -314,7 +314,7 @@ struct plugin_api {
314 void (*lcd_remote_mono_bitmap)(const unsigned char *src, int x, int y, 314 void (*lcd_remote_mono_bitmap)(const unsigned char *src, int x, int y,
315 int width, int height); 315 int width, int height);
316 void (*lcd_remote_putsxy)(int x, int y, const unsigned char *string); 316 void (*lcd_remote_putsxy)(int x, int y, const unsigned char *string);
317 fb_remote_data* lcd_remote_framebuffer; 317 fb_remote_data** lcd_remote_framebuffer;
318 void (*lcd_remote_update)(void); 318 void (*lcd_remote_update)(void);
319 void (*lcd_remote_update_rect)(int x, int y, int width, int height); 319 void (*lcd_remote_update_rect)(int x, int y, int width, int height);
320#if (LCD_REMOTE_DEPTH > 1) 320#if (LCD_REMOTE_DEPTH > 1)
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index 1fb913fbed..3186fac16d 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -1059,7 +1059,7 @@ void I_FinishUpdate (void)
1059 1059
1060 for (y = 1; y <= SCREENHEIGHT; y++) 1060 for (y = 1; y <= SCREENHEIGHT; y++)
1061 { 1061 {
1062 fb_data *dst = rb->lcd_framebuffer + LCD_WIDTH - y; 1062 fb_data *dst = *rb->lcd_framebuffer + LCD_WIDTH - y;
1063 count = SCREENWIDTH; 1063 count = SCREENWIDTH;
1064 1064
1065 do 1065 do
@@ -1073,7 +1073,7 @@ void I_FinishUpdate (void)
1073 else 1073 else
1074#endif 1074#endif
1075 { 1075 {
1076 fb_data *dst = rb->lcd_framebuffer; 1076 fb_data *dst = *rb->lcd_framebuffer;
1077 count = SCREENWIDTH*SCREENHEIGHT; 1077 count = SCREENWIDTH*SCREENHEIGHT;
1078 1078
1079 do 1079 do
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c
index fe76cac822..95edbf37c4 100644
--- a/apps/plugins/fire.c
+++ b/apps/plugins/fire.c
@@ -251,7 +251,7 @@ static inline void fire_draw(struct fire* fire)
251#ifndef HAVE_LCD_COLOR 251#ifndef HAVE_LCD_COLOR
252 dest = draw_buffer; 252 dest = draw_buffer;
253#else 253#else
254 dest = rb->lcd_framebuffer + LCD_WIDTH * y + FIRE_XPOS; 254 dest = *rb->lcd_framebuffer + LCD_WIDTH * y + FIRE_XPOS;
255#endif 255#endif
256 end = dest + FIRE_WIDTH; 256 end = dest + FIRE_WIDTH;
257 257
diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c
index 8e23787704..37c5838d73 100644
--- a/apps/plugins/imageviewer/imageviewer.c
+++ b/apps/plugins/imageviewer/imageviewer.c
@@ -526,7 +526,7 @@ static void pan_view_down(struct image_info *info)
526 */ 526 */
527 move++, info->y--; 527 move++, info->y--;
528 rb->memcpy(rgb_linebuf, 528 rb->memcpy(rgb_linebuf,
529 rb->lcd_framebuffer + (LCD_HEIGHT - move)*LCD_WIDTH, 529 *rb->lcd_framebuffer + (LCD_HEIGHT - move)*LCD_WIDTH,
530 LCD_WIDTH*sizeof (fb_data)); 530 LCD_WIDTH*sizeof (fb_data));
531 } 531 }
532#endif 532#endif
@@ -539,7 +539,7 @@ static void pan_view_down(struct image_info *info)
539 && settings.jpeg_dither_mode == DITHER_DIFFUSION) 539 && settings.jpeg_dither_mode == DITHER_DIFFUSION)
540 { 540 {
541 /* Cover the first row drawn with previous image data. */ 541 /* Cover the first row drawn with previous image data. */
542 rb->memcpy(rb->lcd_framebuffer + (LCD_HEIGHT - move)*LCD_WIDTH, 542 rb->memcpy(*rb->lcd_framebuffer + (LCD_HEIGHT - move)*LCD_WIDTH,
543 rgb_linebuf, LCD_WIDTH*sizeof (fb_data)); 543 rgb_linebuf, LCD_WIDTH*sizeof (fb_data));
544 info->y++; 544 info->y++;
545 } 545 }
diff --git a/apps/plugins/imageviewer/jpeg/yuv2rgb.c b/apps/plugins/imageviewer/jpeg/yuv2rgb.c
index 764dc71a47..5504e425e6 100644
--- a/apps/plugins/imageviewer/jpeg/yuv2rgb.c
+++ b/apps/plugins/imageviewer/jpeg/yuv2rgb.c
@@ -239,12 +239,12 @@ static fb_data (* const pixel_funcs[COLOUR_NUM_MODES][DITHER_NUM_MODES])(void) =
239 239
240/* These defines are used fornormal horizontal strides and vertical strides. */ 240/* These defines are used fornormal horizontal strides and vertical strides. */
241#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE 241#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
242#define LCDADDR(x, y) (rb->lcd_framebuffer + LCD_HEIGHT*(x) + (y)) 242#define LCDADDR(x, y) (*rb->lcd_framebuffer + LCD_HEIGHT*(x) + (y))
243#define ROWENDOFFSET (width*LCD_HEIGHT) 243#define ROWENDOFFSET (width*LCD_HEIGHT)
244#define ROWOFFSET (1) 244#define ROWOFFSET (1)
245#define COLOFFSET (LCD_HEIGHT) 245#define COLOFFSET (LCD_HEIGHT)
246#else 246#else
247#define LCDADDR(x, y) (rb->lcd_framebuffer + LCD_WIDTH*(y) + (x)) 247#define LCDADDR(x, y) (*rb->lcd_framebuffer + LCD_WIDTH*(y) + (x))
248#define ROWENDOFFSET (width) 248#define ROWENDOFFSET (width)
249#define ROWOFFSET (LCD_WIDTH) 249#define ROWOFFSET (LCD_WIDTH)
250#define COLOFFSET (1) 250#define COLOFFSET (1)
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c
index 57d6fabe8d..0b26581b30 100644
--- a/apps/plugins/invadrox.c
+++ b/apps/plugins/invadrox.c
@@ -776,12 +776,12 @@ bool aliens_down, aliens_right, hit_left_border, hit_right_border;
776#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE 776#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
777static inline fb_data get_pixel(int x, int y) 777static inline fb_data get_pixel(int x, int y)
778{ 778{
779 return rb->lcd_framebuffer[x*LCD_HEIGHT+y]; 779 return *rb->lcd_framebuffer[x*LCD_HEIGHT+y];
780} 780}
781#else 781#else
782static inline fb_data get_pixel(int x, int y) 782static inline fb_data get_pixel(int x, int y)
783{ 783{
784 return rb->lcd_framebuffer[ytab[y] + x]; 784 return *rb->lcd_framebuffer[ytab[y] + x];
785} 785}
786#endif 786#endif
787 787
@@ -794,7 +794,7 @@ static const unsigned char shifts[4] = {
794/* Horizontal packing */ 794/* Horizontal packing */
795static inline fb_data get_pixel(int x, int y) 795static inline fb_data get_pixel(int x, int y)
796{ 796{
797 return (rb->lcd_framebuffer[ytab[y] + (x >> 2)] >> shifts[x & 3]) & 3; 797 return (*rb->lcd_framebuffer[ytab[y] + (x >> 2)] >> shifts[x & 3]) & 3;
798} 798}
799#else 799#else
800/* Vertical packing */ 800/* Vertical packing */
@@ -803,7 +803,7 @@ static const unsigned char shifts[4] = {
803}; 803};
804static inline fb_data get_pixel(int x, int y) 804static inline fb_data get_pixel(int x, int y)
805{ 805{
806 return (rb->lcd_framebuffer[ytab[y] + x] >> shifts[y & 3]) & 3; 806 return (*rb->lcd_framebuffer[ytab[y] + x] >> shifts[y & 3]) & 3;
807} 807}
808#endif /* Horizontal/Vertical packing */ 808#endif /* Horizontal/Vertical packing */
809 809
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index 55d0684103..9686f1d021 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -845,7 +845,7 @@ static void grey_screendump_hook(int fd)
845 gsrc = _grey_info.values + _GREY_MULUQ(_grey_info.width, gy); 845 gsrc = _grey_info.values + _GREY_MULUQ(_grey_info.width, gy);
846 846
847#if LCD_DEPTH == 2 847#if LCD_DEPTH == 2
848 src = rb->lcd_framebuffer + _GREY_MULUQ(LCD_FBWIDTH, y); 848 src = *rb->lcd_framebuffer + _GREY_MULUQ(LCD_FBWIDTH, y);
849 849
850 do 850 do
851 { 851 {
@@ -876,7 +876,7 @@ static void grey_screendump_hook(int fd)
876 876
877#if LCD_DEPTH == 1 877#if LCD_DEPTH == 1
878 mask = BIT_N(y & 7); 878 mask = BIT_N(y & 7);
879 src = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); 879 src = *rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
880 880
881 do 881 do
882 { 882 {
@@ -908,7 +908,7 @@ static void grey_screendump_hook(int fd)
908 908
909#elif LCD_DEPTH == 2 909#elif LCD_DEPTH == 2
910 shift = 2 * (y & 3); 910 shift = 2 * (y & 3);
911 src = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 2); 911 src = *rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 2);
912 912
913 do 913 do
914 { 914 {
@@ -933,7 +933,7 @@ static void grey_screendump_hook(int fd)
933 933
934#if LCD_DEPTH == 2 934#if LCD_DEPTH == 2
935 shift = y & 7; 935 shift = y & 7;
936 src = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); 936 src = *rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
937 937
938 do 938 do
939 { 939 {
diff --git a/apps/plugins/lib/osd.c b/apps/plugins/lib/osd.c
index d2e0fe3e50..97db09cc1e 100644
--- a/apps/plugins/lib/osd.c
+++ b/apps/plugins/lib/osd.c
@@ -227,7 +227,7 @@ static void * _osd_lcd_init_buffers(struct osd *osd, unsigned flags,
227 osd->back_bitmap_stride = w; 227 osd->back_bitmap_stride = w;
228#endif /* end stride type selection */ 228#endif /* end stride type selection */
229 229
230 osd->lcd_bitmap_data = (void *)rb->lcd_framebuffer; 230 osd->lcd_bitmap_data = (void *)*rb->lcd_framebuffer;
231 osd->back_bitmap_data = buf; 231 osd->back_bitmap_data = buf;
232 232
233 osd->maxwidth = w; 233 osd->maxwidth = w;
diff --git a/apps/plugins/lib/xlcd_draw.c b/apps/plugins/lib/xlcd_draw.c
index 25ef7518a1..b6ed403353 100644
--- a/apps/plugins/lib/xlcd_draw.c
+++ b/apps/plugins/lib/xlcd_draw.c
@@ -377,7 +377,7 @@ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
377 377
378 src += stride * src_y + src_x; /* move starting point */ 378 src += stride * src_y + src_x; /* move starting point */
379 src_end = src + stride * height; 379 src_end = src + stride * height;
380 dst = rb->lcd_framebuffer + LCD_WIDTH * y + x; 380 dst = *rb->lcd_framebuffer + LCD_WIDTH * y + x;
381 381
382 do 382 do
383 { 383 {
@@ -444,7 +444,7 @@ void xlcd_color_bitmap_part(const unsigned char *src, int src_x, int src_y,
444 444
445 src += 3 * (stride * src_y + src_x); /* move starting point */ 445 src += 3 * (stride * src_y + src_x); /* move starting point */
446 src_end = src + 3 * stride * height; 446 src_end = src + 3 * stride * height;
447 dst = rb->lcd_framebuffer + LCD_WIDTH * y + x; 447 dst = *rb->lcd_framebuffer + LCD_WIDTH * y + x;
448 448
449 do 449 do
450 { 450 {
diff --git a/apps/plugins/lib/xlcd_scroll.c b/apps/plugins/lib/xlcd_scroll.c
index e0fead71be..ab9ee1c4cb 100644
--- a/apps/plugins/lib/xlcd_scroll.c
+++ b/apps/plugins/lib/xlcd_scroll.c
@@ -43,7 +43,7 @@ void xlcd_scroll_left(int count)
43 43
44 length = (LCD_WIDTH-count)*LCD_FBHEIGHT; 44 length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
45 45
46 rb->memmove(rb->lcd_framebuffer, rb->lcd_framebuffer + LCD_HEIGHT*count, 46 rb->memmove(*rb->lcd_framebuffer, *rb->lcd_framebuffer + LCD_HEIGHT*count,
47 length * sizeof(fb_data)); 47 length * sizeof(fb_data));
48 48
49 oldmode = rb->lcd_get_drawmode(); 49 oldmode = rb->lcd_get_drawmode();
@@ -65,8 +65,8 @@ void xlcd_scroll_right(int count)
65 65
66 length = (LCD_WIDTH-count)*LCD_FBHEIGHT; 66 length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
67 67
68 rb->memmove(rb->lcd_framebuffer + LCD_HEIGHT*count, 68 rb->memmove(*rb->lcd_framebuffer + LCD_HEIGHT*count,
69 rb->lcd_framebuffer, length * sizeof(fb_data)); 69 *rb->lcd_framebuffer, length * sizeof(fb_data));
70 70
71 oldmode = rb->lcd_get_drawmode(); 71 oldmode = rb->lcd_get_drawmode();
72 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 72 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
@@ -90,7 +90,7 @@ void xlcd_scroll_up(int count)
90 length = LCD_HEIGHT - count; 90 length = LCD_HEIGHT - count;
91 91
92 width = LCD_WIDTH-1; 92 width = LCD_WIDTH-1;
93 data = rb->lcd_framebuffer; 93 data = *rb->lcd_framebuffer;
94 94
95 do { 95 do {
96 rb->memmove(data,data + count,length * sizeof(fb_data)); 96 rb->memmove(data,data + count,length * sizeof(fb_data));
@@ -119,7 +119,7 @@ void xlcd_scroll_down(int count)
119 length = LCD_HEIGHT - count; 119 length = LCD_HEIGHT - count;
120 120
121 width = LCD_WIDTH-1; 121 width = LCD_WIDTH-1;
122 data = rb->lcd_framebuffer; 122 data = *rb->lcd_framebuffer;
123 123
124 do { 124 do {
125 rb->memmove(data + count, data, length * sizeof(fb_data)); 125 rb->memmove(data + count, data, length * sizeof(fb_data));
@@ -155,7 +155,7 @@ void xlcd_scroll_left(int count)
155 155
156 if (blockcount) 156 if (blockcount)
157 { 157 {
158 unsigned char *data = rb->lcd_framebuffer; 158 unsigned char *data = *rb->lcd_framebuffer;
159 unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT; 159 unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
160 160
161 do 161 do
@@ -168,7 +168,7 @@ void xlcd_scroll_left(int count)
168 if (bitcount) 168 if (bitcount)
169 { 169 {
170 int bx, y; 170 int bx, y;
171 unsigned char *addr = rb->lcd_framebuffer + blocklen; 171 unsigned char *addr = *rb->lcd_framebuffer + blocklen;
172#if LCD_DEPTH == 2 172#if LCD_DEPTH == 2
173 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount; 173 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount;
174#endif 174#endif
@@ -213,7 +213,7 @@ void xlcd_scroll_right(int count)
213 213
214 if (blockcount) 214 if (blockcount)
215 { 215 {
216 unsigned char *data = rb->lcd_framebuffer; 216 unsigned char *data = *rb->lcd_framebuffer;
217 unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT; 217 unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
218 218
219 do 219 do
@@ -226,7 +226,7 @@ void xlcd_scroll_right(int count)
226 if (bitcount) 226 if (bitcount)
227 { 227 {
228 int bx, y; 228 int bx, y;
229 unsigned char *addr = rb->lcd_framebuffer + blockcount; 229 unsigned char *addr = *rb->lcd_framebuffer + blockcount;
230#if LCD_DEPTH == 2 230#if LCD_DEPTH == 2
231 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3); 231 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
232#endif 232#endif
@@ -265,7 +265,7 @@ void xlcd_scroll_left(int count)
265 return; 265 return;
266 } 266 }
267 267
268 data = rb->lcd_framebuffer; 268 data = *rb->lcd_framebuffer;
269 data_end = data + LCD_WIDTH*LCD_FBHEIGHT; 269 data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
270 length = LCD_WIDTH - count; 270 length = LCD_WIDTH - count;
271 271
@@ -294,7 +294,7 @@ void xlcd_scroll_right(int count)
294 return; 294 return;
295 } 295 }
296 296
297 data = rb->lcd_framebuffer; 297 data = *rb->lcd_framebuffer;
298 data_end = data + LCD_WIDTH*LCD_FBHEIGHT; 298 data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
299 length = LCD_WIDTH - count; 299 length = LCD_WIDTH - count;
300 300
@@ -328,8 +328,8 @@ void xlcd_scroll_up(int count)
328 328
329 length = LCD_HEIGHT - count; 329 length = LCD_HEIGHT - count;
330 330
331 rb->memmove(rb->lcd_framebuffer, 331 rb->memmove(*rb->lcd_framebuffer,
332 rb->lcd_framebuffer + count * LCD_FBWIDTH, 332 *rb->lcd_framebuffer + count * LCD_FBWIDTH,
333 length * LCD_FBWIDTH * sizeof(fb_data)); 333 length * LCD_FBWIDTH * sizeof(fb_data));
334 334
335 oldmode = rb->lcd_get_drawmode(); 335 oldmode = rb->lcd_get_drawmode();
@@ -351,8 +351,8 @@ void xlcd_scroll_down(int count)
351 351
352 length = LCD_HEIGHT - count; 352 length = LCD_HEIGHT - count;
353 353
354 rb->memmove(rb->lcd_framebuffer + count * LCD_FBWIDTH, 354 rb->memmove(*rb->lcd_framebuffer + count * LCD_FBWIDTH,
355 rb->lcd_framebuffer, 355 *rb->lcd_framebuffer,
356 length * LCD_FBWIDTH * sizeof(fb_data)); 356 length * LCD_FBWIDTH * sizeof(fb_data));
357 357
358 oldmode = rb->lcd_get_drawmode(); 358 oldmode = rb->lcd_get_drawmode();
@@ -388,8 +388,8 @@ void xlcd_scroll_up(int count)
388 388
389 if (blockcount) 389 if (blockcount)
390 { 390 {
391 rb->memmove(rb->lcd_framebuffer, 391 rb->memmove(*rb->lcd_framebuffer,
392 rb->lcd_framebuffer + blockcount * LCD_FBWIDTH, 392 *rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
393 blocklen * LCD_FBWIDTH * sizeof(fb_data)); 393 blocklen * LCD_FBWIDTH * sizeof(fb_data));
394 } 394 }
395 if (bitcount) 395 if (bitcount)
@@ -424,7 +424,7 @@ void xlcd_scroll_up(int count)
424 : /* inputs */ 424 : /* inputs */
425 [wide]"r"(LCD_FBWIDTH), 425 [wide]"r"(LCD_FBWIDTH),
426 [rows]"r"(blocklen), 426 [rows]"r"(blocklen),
427 [addr]"a"(rb->lcd_framebuffer + blocklen * LCD_FBWIDTH), 427 [addr]"a"(*rb->lcd_framebuffer + blocklen * LCD_FBWIDTH),
428 [cnt] "d"(bitcount), 428 [cnt] "d"(bitcount),
429 [bkg] "d"(0x55 * (~rb->lcd_get_background() & 3)) 429 [bkg] "d"(0x55 * (~rb->lcd_get_background() & 3))
430 : /* clobbers */ 430 : /* clobbers */
@@ -432,7 +432,7 @@ void xlcd_scroll_up(int count)
432 ); 432 );
433#else /* C version */ 433#else /* C version */
434 int x, by; 434 int x, by;
435 unsigned char *addr = rb->lcd_framebuffer + blocklen * LCD_FBWIDTH; 435 unsigned char *addr = *rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
436#if LCD_DEPTH == 2 436#if LCD_DEPTH == 2
437 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3); 437 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
438#else 438#else
@@ -457,7 +457,7 @@ void xlcd_scroll_up(int count)
457 457
458#if LCD_DEPTH == 2 458#if LCD_DEPTH == 2
459 int x, by; 459 int x, by;
460 fb_data *addr = rb->lcd_framebuffer + blocklen * LCD_FBWIDTH; 460 fb_data *addr = *rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
461 unsigned fill, mask; 461 unsigned fill, mask;
462 462
463 fill = patterns[rb->lcd_get_background() & 3] << 8; 463 fill = patterns[rb->lcd_get_background() & 3] << 8;
@@ -512,8 +512,8 @@ void xlcd_scroll_down(int count)
512 512
513 if (blockcount) 513 if (blockcount)
514 { 514 {
515 rb->memmove(rb->lcd_framebuffer + blockcount * LCD_FBWIDTH, 515 rb->memmove(*rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
516 rb->lcd_framebuffer, 516 *rb->lcd_framebuffer,
517 blocklen * LCD_FBWIDTH * sizeof(fb_data)); 517 blocklen * LCD_FBWIDTH * sizeof(fb_data));
518 } 518 }
519 if (bitcount) 519 if (bitcount)
@@ -548,7 +548,7 @@ void xlcd_scroll_down(int count)
548 : /* inputs */ 548 : /* inputs */
549 [wide]"r"(LCD_WIDTH), 549 [wide]"r"(LCD_WIDTH),
550 [rows]"r"(blocklen), 550 [rows]"r"(blocklen),
551 [addr]"a"(rb->lcd_framebuffer + blockcount * LCD_FBWIDTH), 551 [addr]"a"(*rb->lcd_framebuffer + blockcount * LCD_FBWIDTH),
552 [cnt] "d"(bitcount), 552 [cnt] "d"(bitcount),
553 [bkg] "d"((0x55 * (~rb->lcd_get_background() & 3)) << bitcount) 553 [bkg] "d"((0x55 * (~rb->lcd_get_background() & 3)) << bitcount)
554 : /* clobbers */ 554 : /* clobbers */
@@ -556,7 +556,7 @@ void xlcd_scroll_down(int count)
556 ); 556 );
557#else /* C version */ 557#else /* C version */
558 int x, by; 558 int x, by;
559 unsigned char *addr = rb->lcd_framebuffer + blockcount * LCD_FBWIDTH; 559 unsigned char *addr = *rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
560#if LCD_DEPTH == 2 560#if LCD_DEPTH == 2
561 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount; 561 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount;
562#else 562#else
@@ -581,7 +581,7 @@ void xlcd_scroll_down(int count)
581 581
582#if LCD_DEPTH == 2 582#if LCD_DEPTH == 2
583 int x, by; 583 int x, by;
584 fb_data *addr = rb->lcd_framebuffer + blockcount * LCD_FBWIDTH; 584 fb_data *addr = *rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
585 unsigned fill, mask; 585 unsigned fill, mask;
586 586
587 fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount); 587 fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount);
diff --git a/apps/plugins/lua/rocklib_img.c b/apps/plugins/lua/rocklib_img.c
index 1266d60310..da3ef4b52c 100644
--- a/apps/plugins/lua/rocklib_img.c
+++ b/apps/plugins/lua/rocklib_img.c
@@ -1379,7 +1379,7 @@ RB_WRAP(font_getstringsize)
1379 1379
1380RB_WRAP(lcd_framebuffer) 1380RB_WRAP(lcd_framebuffer)
1381{ 1381{
1382 rli_wrap(L, rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT); 1382 rli_wrap(L, *rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT);
1383 return 1; 1383 return 1;
1384} 1384}
1385 1385
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index f86a6e55fd..e72d2828e3 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -821,7 +821,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
821 src_y &= 7; 821 src_y &= 7;
822 src_end = src + width; 822 src_end = src + width;
823 823
824 dst = rb->lcd_framebuffer + (LCD_WIDTH - y) + x*LCD_WIDTH; 824 dst = *rb->lcd_framebuffer + (LCD_WIDTH - y) + x*LCD_WIDTH;
825 do 825 do
826 { 826 {
827 const unsigned char *src_col = src++; 827 const unsigned char *src_col = src++;
@@ -953,7 +953,7 @@ static void draw_oriented_alpha_bitmap_part(const unsigned char *src,
953 fg_pattern = rb->lcd_get_foreground(); 953 fg_pattern = rb->lcd_get_foreground();
954 /*bg_pattern=*/ rb->lcd_get_background(); 954 /*bg_pattern=*/ rb->lcd_get_background();
955 955
956 dst_start = rb->lcd_framebuffer + (LCD_WIDTH - y - 1) + x*LCD_WIDTH; 956 dst_start = *rb->lcd_framebuffer + (LCD_WIDTH - y - 1) + x*LCD_WIDTH;
957 int col, row = height; 957 int col, row = height;
958 unsigned data, pixels; 958 unsigned data, pixels;
959 unsigned skip_end = (stride - width); 959 unsigned skip_end = (stride - width);
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c
index 182e4a473a..262ab3e836 100755
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -704,7 +704,7 @@ static int gameProc( void )
704 rb->lcd_blit_pal256( video_buffer, 0, 0, XOFS, YOFS, 704 rb->lcd_blit_pal256( video_buffer, 0, 0, XOFS, YOFS,
705 ScreenWidth, ScreenHeight); 705 ScreenWidth, ScreenHeight);
706#else 706#else
707 blit_display(rb->lcd_framebuffer,video_buffer); 707 blit_display(*rb->lcd_framebuffer,video_buffer);
708#endif 708#endif
709 709
710 if (settings.showfps) { 710 if (settings.showfps) {
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 843df5746e..eadf9c3d0a 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -190,7 +190,7 @@ GREY_INFO_STRUCT
190#define BUFFER_HEIGHT _grey_info.height 190#define BUFFER_HEIGHT _grey_info.height
191typedef unsigned char pix_t; 191typedef unsigned char pix_t;
192#else /* LCD_DEPTH >= 8 */ 192#else /* LCD_DEPTH >= 8 */
193#define LCD_BUF rb->lcd_framebuffer 193#define LCD_BUF *rb->lcd_framebuffer
194#define G_PIX LCD_RGBPACK 194#define G_PIX LCD_RGBPACK
195#define N_PIX LCD_RGBPACK 195#define N_PIX LCD_RGBPACK
196#define G_BRIGHT(y) LCD_RGBPACK(y,y,y) 196#define G_BRIGHT(y) LCD_RGBPACK(y,y,y)
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c
index 3a2238bb60..9e2e3832a3 100644
--- a/apps/plugins/plasma.c
+++ b/apps/plugins/plasma.c
@@ -201,9 +201,9 @@ int main(void)
201#ifdef HAVE_LCD_COLOR 201#ifdef HAVE_LCD_COLOR
202 shades_generate(time++); /* dynamically */ 202 shades_generate(time++); /* dynamically */
203#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 203#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
204 ptr = (unsigned char*)rb->lcd_framebuffer; 204 ptr = (unsigned char*)*rb->lcd_framebuffer;
205#else 205#else
206 ptr = rb->lcd_framebuffer; 206 ptr = *rb->lcd_framebuffer;
207#endif 207#endif
208 208
209#else 209#else
@@ -237,7 +237,7 @@ int main(void)
237 p4-=sp4; 237 p4-=sp4;
238#ifdef HAVE_LCD_COLOR 238#ifdef HAVE_LCD_COLOR
239#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 239#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
240 rb->lcd_blit_pal256( (unsigned char*)rb->lcd_framebuffer, 240 rb->lcd_blit_pal256( (unsigned char*)*rb->lcd_framebuffer,
241 0,0,0,0,LCD_WIDTH,LCD_HEIGHT); 241 0,0,0,0,LCD_WIDTH,LCD_HEIGHT);
242#else 242#else
243 rb->lcd_update(); 243 rb->lcd_update();
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 9fabbf25d2..ed58bd900a 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -1016,7 +1016,7 @@ static void rb_draw_line(void *handle, int x1, int y1, int x2, int y2,
1016 } 1016 }
1017 else 1017 else
1018#endif 1018#endif
1019 draw_antialiased_line(rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT, x1, y1, x2, y2); 1019 draw_antialiased_line(*rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT, x1, y1, x2, y2);
1020 } 1020 }
1021 else 1021 else
1022 { 1022 {
@@ -1294,7 +1294,7 @@ static void rb_draw_poly(void *handle, int *coords, int npoints,
1294 x2, y2); 1294 x2, y2);
1295 } 1295 }
1296 else 1296 else
1297 draw_antialiased_line(rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT, x1, y1, x2, y2); 1297 draw_antialiased_line(*rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT, x1, y1, x2, y2);
1298 1298
1299#ifdef DEBUG_MENU 1299#ifdef DEBUG_MENU
1300 if(debug_settings.polyanim) 1300 if(debug_settings.polyanim)
@@ -1319,7 +1319,7 @@ static void rb_draw_poly(void *handle, int *coords, int npoints,
1319 x2, y2); 1319 x2, y2);
1320 } 1320 }
1321 else 1321 else
1322 draw_antialiased_line(rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT, x1, y1, x2, y2); 1322 draw_antialiased_line(*rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT, x1, y1, x2, y2);
1323 } 1323 }
1324 else 1324 else
1325 { 1325 {
@@ -1474,7 +1474,7 @@ static void rb_blitter_save(void *handle, blitter *bl, int x, int y)
1474 1474
1475 trim_rect(&x, &y, &w, &h); 1475 trim_rect(&x, &y, &w, &h);
1476 1476
1477 fb_data *fb = zoom_enabled ? zoom_fb : rb->lcd_framebuffer; 1477 fb_data *fb = zoom_enabled ? zoom_fb : *rb->lcd_framebuffer;
1478 LOGF("rb_blitter_save(%d, %d, %d, %d)", x, y, w, h); 1478 LOGF("rb_blitter_save(%d, %d, %d, %d)", x, y, w, h);
1479 for(int i = 0; i < h; ++i) 1479 for(int i = 0; i < h; ++i)
1480 { 1480 {
@@ -1778,9 +1778,9 @@ static void timer_cb(void)
1778 static bool what = false; 1778 static bool what = false;
1779 what = !what; 1779 what = !what;
1780 if(what) 1780 if(what)
1781 rb->lcd_framebuffer[0] = LCD_BLACK; 1781 *rb->lcd_framebuffer[0] = LCD_BLACK;
1782 else 1782 else
1783 rb->lcd_framebuffer[0] = LCD_WHITE; 1783 *rb->lcd_framebuffer[0] = LCD_WHITE;
1784 rb->lcd_update(); 1784 rb->lcd_update();
1785 } 1785 }
1786#endif 1786#endif
@@ -2909,7 +2909,7 @@ static void bench_aa(void)
2909 int i = 0; 2909 int i = 0;
2910 while(*rb->current_tick < next) 2910 while(*rb->current_tick < next)
2911 { 2911 {
2912 draw_antialiased_line(rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT, 0, 0, 20, 31); 2912 draw_antialiased_line(*rb->lcd_framebuffer, LCD_WIDTH, LCD_HEIGHT, 0, 0, 20, 31);
2913 ++i; 2913 ++i;
2914 } 2914 }
2915 rb->splashf(HZ, "%d AA lines/sec", i); 2915 rb->splashf(HZ, "%d AA lines/sec", i);
diff --git a/apps/plugins/rockboy/lcd.c b/apps/plugins/rockboy/lcd.c
index 143b8fdfa8..387a88c3df 100644
--- a/apps/plugins/rockboy/lcd.c
+++ b/apps/plugins/rockboy/lcd.c
@@ -742,9 +742,9 @@ static void spr_scan(void)
742void lcd_begin(void) 742void lcd_begin(void)
743{ 743{
744#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 744#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
745 vdest=(unsigned char*)rb->lcd_framebuffer; 745 vdest=(unsigned char*)*rb->lcd_framebuffer;
746#else 746#else
747 vdest=rb->lcd_framebuffer; 747 vdest=*rb->lcd_framebuffer;
748#endif 748#endif
749 749
750#ifdef HAVE_LCD_COLOR 750#ifdef HAVE_LCD_COLOR
@@ -975,9 +975,9 @@ void lcd_refreshline(void)
975 975
976#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 976#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
977 if(options.scaling==3) { 977 if(options.scaling==3) {
978 rb->lcd_blit_pal256((unsigned char*)rb->lcd_framebuffer,(LCD_WIDTH-160)/2, (LCD_HEIGHT-144)/2, (LCD_WIDTH-160)/2, (LCD_HEIGHT-144)/2, 160, 144); 978 rb->lcd_blit_pal256((unsigned char*)*rb->lcd_framebuffer,(LCD_WIDTH-160)/2, (LCD_HEIGHT-144)/2, (LCD_WIDTH-160)/2, (LCD_HEIGHT-144)/2, 160, 144);
979 } else { 979 } else {
980 rb->lcd_blit_pal256((unsigned char*)rb->lcd_framebuffer,0,0,0,0,LCD_WIDTH,LCD_HEIGHT); 980 rb->lcd_blit_pal256((unsigned char*)*rb->lcd_framebuffer,0,0,0,0,LCD_WIDTH,LCD_HEIGHT);
981 } 981 }
982#else 982#else
983 if(options.scaling==3) { 983 if(options.scaling==3) {
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c
index e27cbbe3e7..364176ce2d 100644
--- a/apps/plugins/rockboy/sys_rockbox.c
+++ b/apps/plugins/rockboy/sys_rockbox.c
@@ -290,7 +290,7 @@ void vid_update(int scanline)
290 else if (fb.mode==2) 290 else if (fb.mode==2)
291 scanline-=8; 291 scanline-=8;
292 scanline_remapped = scanline / 16; 292 scanline_remapped = scanline / 16;
293 frameb = rb->lcd_framebuffer + scanline_remapped * LCD_WIDTH; 293 frameb = *rb->lcd_framebuffer + scanline_remapped * LCD_WIDTH;
294 while (cnt < 160) { 294 while (cnt < 160) {
295 balance += LCD_WIDTH; 295 balance += LCD_WIDTH;
296 if (balance > 0) 296 if (balance > 0)
@@ -316,7 +316,7 @@ void vid_update(int scanline)
316 else if (fb.mode==2) 316 else if (fb.mode==2)
317 scanline-=8; 317 scanline-=8;
318 scanline_remapped = scanline / 4; 318 scanline_remapped = scanline / 4;
319 frameb = rb->lcd_framebuffer + scanline_remapped * LCD_WIDTH; 319 frameb = *rb->lcd_framebuffer + scanline_remapped * LCD_WIDTH;
320 while (cnt < 160) { 320 while (cnt < 160) {
321 *(frameb++) = (scan.buf[0][cnt]&0x3) | 321 *(frameb++) = (scan.buf[0][cnt]&0x3) |
322 ((scan.buf[1][cnt]&0x3)<<2) | 322 ((scan.buf[1][cnt]&0x3)<<2) |
diff --git a/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c b/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c
index 9d11ae2acc..5e0ccfb167 100644
--- a/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c
+++ b/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c
@@ -639,7 +639,7 @@ SDL_Surface *ROCKBOX_SetVideoMode(_THIS, SDL_Surface *current,
639 this->hidden->w = current->w = width; 639 this->hidden->w = current->w = width;
640 this->hidden->h = current->h = height; 640 this->hidden->h = current->h = height;
641 current->pitch = current->w * (bpp / 8); 641 current->pitch = current->w * (bpp / 8);
642 current->pixels = this->hidden->direct ? rb->lcd_framebuffer : this->hidden->buffer; 642 current->pixels = this->hidden->direct ? *rb->lcd_framebuffer : this->hidden->buffer;
643 643
644 /* We're done */ 644 /* We're done */
645 return(current); 645 return(current);
@@ -674,7 +674,7 @@ static void flip_pixels(int x, int y, int w, int h)
674 for(int x_0 = x; x_0 < x + w; ++x_0) 674 for(int x_0 = x; x_0 < x + w; ++x_0)
675 { 675 {
676 /* swap pixels directly in the framebuffer */ 676 /* swap pixels directly in the framebuffer */
677 rb->lcd_framebuffer[y_0 * LCD_WIDTH + x_0] = swap16(rb->lcd_framebuffer[y_0 * LCD_WIDTH + x_0]); 677 *rb->lcd_framebuffer[y_0 * LCD_WIDTH + x_0] = swap16(*rb->lcd_framebuffer[y_0 * LCD_WIDTH + x_0]);
678 } 678 }
679 } 679 }
680} 680}
@@ -684,7 +684,7 @@ static void blit_rotated(fb_data *src, int x, int y, int w, int h)
684{ 684{
685 for(int y_0 = y; y_0 < y + h; ++y_0) 685 for(int y_0 = y; y_0 < y + h; ++y_0)
686 for(int x_0 = x; x_0 < x + w; ++x_0) 686 for(int x_0 = x; x_0 < x + w; ++x_0)
687 rb->lcd_framebuffer[x_0 * LCD_WIDTH + y_0] = src[(LCD_WIDTH - y_0) * LCD_HEIGHT + x_0]; 687 *rb->lcd_framebuffer[x_0 * LCD_WIDTH + y_0] = src[(LCD_WIDTH - y_0) * LCD_HEIGHT + x_0];
688} 688}
689 689
690static void ROCKBOX_UpdateRects(_THIS, int numrects, SDL_Rect *rects) 690static void ROCKBOX_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
@@ -720,7 +720,7 @@ static void ROCKBOX_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
720 720
721 out_bmp.width = LCD_WIDTH; 721 out_bmp.width = LCD_WIDTH;
722 out_bmp.height = LCD_HEIGHT; 722 out_bmp.height = LCD_HEIGHT;
723 out_bmp.data = (char*)rb->lcd_framebuffer; 723 out_bmp.data = (char*)*rb->lcd_framebuffer;
724 simple_resize_bitmap(&in_bmp, &out_bmp); 724 simple_resize_bitmap(&in_bmp, &out_bmp);
725 } 725 }
726 else 726 else
diff --git a/apps/plugins/test_resize.c b/apps/plugins/test_resize.c
index 2ab10eb7ee..3e50bdc8cc 100644
--- a/apps/plugins/test_resize.c
+++ b/apps/plugins/test_resize.c
@@ -65,7 +65,7 @@ enum plugin_status plugin_start(const void* parameter)
65{ 65{
66 (void)parameter; 66 (void)parameter;
67 67
68 b = rb->lcd_framebuffer; 68 b = *rb->lcd_framebuffer;
69 69
70 rb->lcd_set_background(LCD_RGBPACK(0,0,0)); 70 rb->lcd_set_background(LCD_RGBPACK(0,0,0));
71 rb->lcd_clear_display(); // TODO: Optimizes this by e.g. invalidating rects 71 rb->lcd_clear_display(); // TODO: Optimizes this by e.g. invalidating rects
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c
index db01dcc974..0bd1e0dc08 100644
--- a/apps/plugins/xworld/sys.c
+++ b/apps/plugins/xworld/sys.c
@@ -584,7 +584,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
584 struct bitmap out_bmp; 584 struct bitmap out_bmp;
585 out_bmp.width = LCD_WIDTH; 585 out_bmp.width = LCD_WIDTH;
586 out_bmp.height = LCD_HEIGHT; 586 out_bmp.height = LCD_HEIGHT;
587 out_bmp.data = (unsigned char*) rb->lcd_framebuffer; 587 out_bmp.data = (unsigned char*) *rb->lcd_framebuffer;
588 588
589#ifdef HAVE_LCD_COLOR 589#ifdef HAVE_LCD_COLOR
590 if(sys->settings.scaling_quality == 1) 590 if(sys->settings.scaling_quality == 1)
@@ -631,25 +631,25 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
631 { 631 {
632#ifdef HAVE_LCD_COLOR 632#ifdef HAVE_LCD_COLOR
633 int r, g, b; 633 int r, g, b;
634 fb_data pix = rb->lcd_framebuffer[y * LCD_WIDTH + x]; 634 fb_data pix = *rb->lcd_framebuffer[y * LCD_WIDTH + x];
635#if (LCD_DEPTH > 24) 635#if (LCD_DEPTH > 24)
636 r = 0xff - pix.r; 636 r = 0xff - pix.r;
637 g = 0xff - pix.g; 637 g = 0xff - pix.g;
638 b = 0xff - pix.b; 638 b = 0xff - pix.b;
639 rb->lcd_framebuffer[y * LCD_WIDTH + x] = (fb_data) { b, g, r, 255 }; 639 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = (fb_data) { b, g, r, 255 };
640#elif (LCD_DEPTH == 24) 640#elif (LCD_DEPTH == 24)
641 r = 0xff - pix.r; 641 r = 0xff - pix.r;
642 g = 0xff - pix.g; 642 g = 0xff - pix.g;
643 b = 0xff - pix.b; 643 b = 0xff - pix.b;
644 rb->lcd_framebuffer[y * LCD_WIDTH + x] = (fb_data) { b, g, r }; 644 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = (fb_data) { b, g, r };
645#else 645#else
646 r = RGB_UNPACK_RED (pix); 646 r = RGB_UNPACK_RED (pix);
647 g = RGB_UNPACK_GREEN(pix); 647 g = RGB_UNPACK_GREEN(pix);
648 b = RGB_UNPACK_BLUE (pix); 648 b = RGB_UNPACK_BLUE (pix);
649 rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_RGBPACK(0xff - r, 0xff - g, 0xff - b); 649 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_RGBPACK(0xff - r, 0xff - g, 0xff - b);
650#endif 650#endif
651#else 651#else
652 rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_BRIGHTNESS(0xff - rb->lcd_framebuffer[y * LCD_WIDTH + x]); 652 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_BRIGHTNESS(0xff - *rb->lcd_framebuffer[y * LCD_WIDTH + x]);
653#endif 653#endif
654 } 654 }
655 } 655 }
@@ -671,14 +671,14 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
671 if(prev_frames && orig_fb) 671 if(prev_frames && orig_fb)
672 { 672 {
673 673
674 rb->memcpy(orig_fb, rb->lcd_framebuffer, sizeof(fb_data) * LCD_WIDTH * LCD_HEIGHT); 674 rb->memcpy(orig_fb, *rb->lcd_framebuffer, sizeof(fb_data) * LCD_WIDTH * LCD_HEIGHT);
675 /* fancy useless slow motion blur */ 675 /* fancy useless slow motion blur */
676 for(int y = 0; y < LCD_HEIGHT; ++y) 676 for(int y = 0; y < LCD_HEIGHT; ++y)
677 { 677 {
678 for(int x = 0; x < LCD_WIDTH; ++x) 678 for(int x = 0; x < LCD_WIDTH; ++x)
679 { 679 {
680 int r, g, b; 680 int r, g, b;
681 fb_data pix = rb->lcd_framebuffer[y * LCD_WIDTH + x]; 681 fb_data pix = *rb->lcd_framebuffer[y * LCD_WIDTH + x];
682 r = RGB_UNPACK_RED (pix); 682 r = RGB_UNPACK_RED (pix);
683 g = RGB_UNPACK_GREEN(pix); 683 g = RGB_UNPACK_GREEN(pix);
684 b = RGB_UNPACK_BLUE (pix); 684 b = RGB_UNPACK_BLUE (pix);
@@ -695,7 +695,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
695 r /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1); 695 r /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1);
696 g /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1); 696 g /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1);
697 b /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1); 697 b /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1);
698 rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_RGBPACK(r, g, b); 698 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_RGBPACK(r, g, b);
699 } 699 }
700 } 700 }
701 prev_baseidx -= LCD_WIDTH * LCD_HEIGHT; 701 prev_baseidx -= LCD_WIDTH * LCD_HEIGHT;
diff --git a/apps/plugins/zxbox/zxvid_16bpp.c b/apps/plugins/zxbox/zxvid_16bpp.c
index 6380d3d7d7..f8482e3147 100644
--- a/apps/plugins/zxbox/zxvid_16bpp.c
+++ b/apps/plugins/zxbox/zxvid_16bpp.c
@@ -58,7 +58,7 @@ void update_screen(void)
58 byte *scrptr; 58 byte *scrptr;
59 scrptr = (byte *) SPNM(image); 59 scrptr = (byte *) SPNM(image);
60 */ 60 */
61 frameb = rb->lcd_framebuffer; 61 frameb = *rb->lcd_framebuffer;
62 for ( y = 0 ; y < HEIGHT*WIDTH; y++ ){ 62 for ( y = 0 ; y < HEIGHT*WIDTH; y++ ){
63 frameb[y] = FB_SCALARPACK(_16bpp_colors[(unsigned)sp_image[y]]); 63 frameb[y] = FB_SCALARPACK(_16bpp_colors[(unsigned)sp_image[y]]);
64 } 64 }
@@ -68,7 +68,7 @@ void update_screen(void)
68 int srcx, srcy=0; /* x / y coordinates in source image */ 68 int srcx, srcy=0; /* x / y coordinates in source image */
69 unsigned char* image; 69 unsigned char* image;
70 image = sp_image + ( (Y_OFF)*(WIDTH) ) + X_OFF; 70 image = sp_image + ( (Y_OFF)*(WIDTH) ) + X_OFF;
71 frameb = rb->lcd_framebuffer; 71 frameb = *rb->lcd_framebuffer;
72 for(y = 0; y < LCD_HEIGHT; y++) 72 for(y = 0; y < LCD_HEIGHT; y++)
73 { 73 {
74 srcx = 0; /* reset our x counter before each row... */ 74 srcx = 0; /* reset our x counter before each row... */
diff --git a/apps/plugins/zxbox/zxvid_2bpp.c b/apps/plugins/zxbox/zxvid_2bpp.c
index 9f98ab4cfb..9772625387 100644
--- a/apps/plugins/zxbox/zxvid_2bpp.c
+++ b/apps/plugins/zxbox/zxvid_2bpp.c
@@ -51,7 +51,7 @@ void update_screen(void)
51#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 51#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
52 for(y = 0; y < LCD_HEIGHT; y++) 52 for(y = 0; y < LCD_HEIGHT; y++)
53 { 53 {
54 frameb = rb->lcd_framebuffer + (y) * FB_WIDTH; 54 frameb = *rb->lcd_framebuffer + (y) * FB_WIDTH;
55 srcx = 0; /* reset our x counter before each row... */ 55 srcx = 0; /* reset our x counter before each row... */
56 for(x = 0; x < LCD_WIDTH; x++) 56 for(x = 0; x < LCD_WIDTH; x++)
57 { 57 {
@@ -67,7 +67,7 @@ void update_screen(void)
67 int shift; 67 int shift;
68 for(y = 0; y < LCD_HEIGHT; y++) 68 for(y = 0; y < LCD_HEIGHT; y++)
69 { 69 {
70 frameb = rb->lcd_framebuffer + (y/4) * LCD_WIDTH; 70 frameb = *rb->lcd_framebuffer + (y/4) * LCD_WIDTH;
71 srcx = 0; /* reset our x counter before each row... */ 71 srcx = 0; /* reset our x counter before each row... */
72 shift = ((y & 3 ) * 2 ); 72 shift = ((y & 3 ) * 2 );
73 mask = ~pixmask[y & 3]; 73 mask = ~pixmask[y & 3];
@@ -84,7 +84,7 @@ void update_screen(void)
84 int shift; 84 int shift;
85 for(y = 0; y < LCD_HEIGHT; y++) 85 for(y = 0; y < LCD_HEIGHT; y++)
86 { 86 {
87 frameb = rb->lcd_framebuffer + (y/8) * LCD_WIDTH; 87 frameb = *rb->lcd_framebuffer + (y/8) * LCD_WIDTH;
88 srcx = 0; /* reset our x counter before each row... */ 88 srcx = 0; /* reset our x counter before each row... */
89 shift = (y & 7); 89 shift = (y & 7);
90 mask = ~pixmask[y & 7]; 90 mask = ~pixmask[y & 7];
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 9346a6815b..ae06307dca 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -434,13 +434,12 @@ static inline unsigned fb_to_scalar(fb_data p)
434#endif 434#endif
435/* The actual framebuffer */ 435/* The actual framebuffer */
436extern fb_data *lcd_framebuffer; 436extern fb_data *lcd_framebuffer;
437extern fb_data lcd_static_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH];
438#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE 437#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
439#define FBADDR(x, y) (lcd_framebuffer + ((x) * LCD_FBHEIGHT) + (y)) 438#define FBADDR(x, y) (lcd_framebuffer + ((x) * LCD_FBHEIGHT) + (y))
440#else 439#else
441#define FBADDR(x, y) (lcd_framebuffer + ((y) * LCD_FBWIDTH) + (x)) 440#define FBADDR(x, y) (lcd_framebuffer + ((y) * LCD_FBWIDTH) + (x))
442#endif 441#endif
443#define FRAMEBUFFER_SIZE (sizeof(lcd_static_framebuffer)) 442#define FRAMEBUFFER_SIZE (sizeof(fb_data)*LCD_FBWIDTH*LCD_FBHEIGHT)
444 443
445/** Port-specific functions. Enable in port config file. **/ 444/** Port-specific functions. Enable in port config file. **/
446#ifdef HAVE_REMOTE_LCD_AS_MAIN 445#ifdef HAVE_REMOTE_LCD_AS_MAIN