summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-05-15 14:26:44 +0000
committerDave Chapman <dave@dchapman.com>2007-05-15 14:26:44 +0000
commite22b33ec72abbcc71df30a38328311dd68a178c7 (patch)
tree0818bcd82df7a5f252d391d04b70394696a9d659
parent4bf27eccdd91c9999e1bcbfe6350193498e30e96 (diff)
downloadrockbox-e22b33ec72abbcc71df30a38328311dd68a178c7.tar.gz
rockbox-e22b33ec72abbcc71df30a38328311dd68a178c7.zip
Gigabeat LCD driver cleanup: Revert the DMA optimisations to the gigabeat LCD driver - they are both buggy (the wrong background colour was often seen, e.g. in the USB screen after using a plugin) and significantly slower than the standard implementations (which use the ARM-optimised mem* functions) in lcd-16bit.c. lcd_clear_update was 4.5 times slower with DMA when a backdrop is in use, and 12 times slower with DMA when no backdrop is in use.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13392 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/lcd-16bit.c7
-rw-r--r--firmware/export/lcd.h2
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c105
3 files changed, 0 insertions, 114 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index 67736ddf85..0a3d193cad 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -105,24 +105,20 @@ int lcd_get_drawmode(void)
105 return drawmode; 105 return drawmode;
106} 106}
107 107
108#if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
109void lcd_set_foreground(unsigned color) 108void lcd_set_foreground(unsigned color)
110{ 109{
111 fg_pattern = color; 110 fg_pattern = color;
112} 111}
113#endif
114 112
115unsigned lcd_get_foreground(void) 113unsigned lcd_get_foreground(void)
116{ 114{
117 return fg_pattern; 115 return fg_pattern;
118} 116}
119 117
120#if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
121void lcd_set_background(unsigned color) 118void lcd_set_background(unsigned color)
122{ 119{
123 bg_pattern = color; 120 bg_pattern = color;
124} 121}
125#endif
126 122
127unsigned lcd_get_background(void) 123unsigned lcd_get_background(void)
128{ 124{
@@ -221,7 +217,6 @@ void lcd_set_backdrop(fb_data* backdrop)
221 lcd_backdrop_offset = 0; 217 lcd_backdrop_offset = 0;
222 lcd_fastpixelfuncs = lcd_fastpixelfuncs_bgcolor; 218 lcd_fastpixelfuncs = lcd_fastpixelfuncs_bgcolor;
223 } 219 }
224 lcd_device_prepare_backdrop(backdrop);
225} 220}
226 221
227fb_data* lcd_get_backdrop(void) 222fb_data* lcd_get_backdrop(void)
@@ -232,7 +227,6 @@ fb_data* lcd_get_backdrop(void)
232/*** drawing functions ***/ 227/*** drawing functions ***/
233 228
234/* Clear the whole display */ 229/* Clear the whole display */
235#if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
236void lcd_clear_display(void) 230void lcd_clear_display(void)
237{ 231{
238 fb_data *dst = LCDADDR(0, 0); 232 fb_data *dst = LCDADDR(0, 0);
@@ -250,7 +244,6 @@ void lcd_clear_display(void)
250 } 244 }
251 scrolling_lines = 0; 245 scrolling_lines = 0;
252} 246}
253#endif
254 247
255/* Set a single pixel */ 248/* Set a single pixel */
256void lcd_drawpixel(int x, int y) 249void lcd_drawpixel(int x, int y)
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 40e5129ad3..077664040e 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -346,10 +346,8 @@ extern void lcd_set_drawinfo(int mode, unsigned foreground,
346 unsigned background); 346 unsigned background);
347void lcd_set_backdrop(fb_data* backdrop); 347void lcd_set_backdrop(fb_data* backdrop);
348#if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR) 348#if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
349void lcd_device_prepare_backdrop(fb_data* backdrop);
350bool lcd_enabled(void); 349bool lcd_enabled(void);
351#else 350#else
352#define lcd_device_prepare_backdrop(x) ;
353#define lcd_enabled() true 351#define lcd_enabled() true
354#endif 352#endif
355 353
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
index 11edcfecb1..3bb2801b02 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
@@ -13,11 +13,6 @@
13#include "bidi.h" 13#include "bidi.h"
14 14
15#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) 15#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)])
16/*
17** We prepare foreground and background fills ahead of time - DMA fills in 16 byte groups
18*/
19unsigned long fg_pattern_blit[4];
20unsigned long bg_pattern_blit[4];
21 16
22volatile bool use_dma_blit = false; 17volatile bool use_dma_blit = false;
23static volatile bool lcd_on = true; 18static volatile bool lcd_on = true;
@@ -77,11 +72,6 @@ void lcd_init_device(void)
77 LCDCON5 |= 1 << 11; /* Switch from 555I mode to 565 mode */ 72 LCDCON5 |= 1 << 11; /* Switch from 555I mode to 565 mode */
78 73
79#if !defined(BOOTLOADER) 74#if !defined(BOOTLOADER)
80 memset16(fg_pattern_blit, fg_pattern, sizeof(fg_pattern_blit)/2);
81 memset16(bg_pattern_blit, bg_pattern, sizeof(bg_pattern_blit)/2);
82 clean_dcache_range((void *)fg_pattern_blit, sizeof(fg_pattern_blit));
83 clean_dcache_range((void *)bg_pattern_blit, sizeof(bg_pattern_blit));
84 use_dma_blit = true;
85 lcd_poweroff = false; 75 lcd_poweroff = false;
86#endif 76#endif
87} 77}
@@ -155,101 +145,6 @@ void lcd_enable(bool state)
155 } 145 }
156} 146}
157 147
158void lcd_set_foreground(unsigned color)
159{
160 fg_pattern = color;
161
162 memset16(fg_pattern_blit, fg_pattern, sizeof(fg_pattern_blit)/2);
163 invalidate_dcache_range((void *)fg_pattern_blit, sizeof(fg_pattern_blit));
164}
165
166void lcd_set_background(unsigned color)
167{
168 bg_pattern = color;
169 memset16(bg_pattern_blit, bg_pattern, sizeof(bg_pattern_blit)/2);
170 invalidate_dcache_range((void *)bg_pattern_blit, sizeof(bg_pattern_blit));
171}
172
173void lcd_device_prepare_backdrop(fb_data* backdrop)
174{
175 if(backdrop)
176 invalidate_dcache_range((void *)backdrop, (LCD_HEIGHT * sizeof(fb_data) * LCD_WIDTH));
177}
178
179void lcd_clear_display_dma(void)
180{
181 void *src;
182 bool inc = false;
183
184 if(!lcd_on) {
185 sleep(200);
186 }
187 if (lcd_get_drawmode() & DRMODE_INVERSEVID)
188 src = fg_pattern_blit;
189 else
190 {
191 fb_data* lcd_backdrop = lcd_get_backdrop();
192
193 if (!lcd_backdrop)
194 src = bg_pattern_blit;
195 else
196 {
197 src = lcd_backdrop;
198 inc = true;
199 }
200 }
201 /* Wait for any pending transfer to complete */
202 while((DSTAT3 & 0x000fffff))
203 CLKCON |= (1 << 2); /* set IDLE bit */
204 DMASKTRIG3 |= 0x4; /* Stop controller */
205 DIDST3 = ((int) &lcd_framebuffer[0][0]) + 0x30000000; /* set DMA dest, physical address */
206 DIDSTC3 = 0; /* Dest on AHB, increment */
207
208 DISRC3 = ((int) src) + 0x30000000; /* Set source, in physical space */
209 DISRCC3 = inc ? 0x00 : 0x01; /* memory is on AHB bus, increment addresses based on backdrop */
210
211 /* Handshake on AHB, Burst mode, whole service mode, no reload, move 32-bits */
212 DCON3 = ((1<<30) | (1<<28) | (1<<27) | (1<<22) | (2<<20)) | ((LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data)) >> 4);
213
214 /* Dump DCache for dest, we are about to overwrite it with DMA */
215 invalidate_dcache_range((void *)lcd_framebuffer, sizeof(lcd_framebuffer));
216 /* Activate the channel */
217 DMASKTRIG3 = 2;
218 /* Start DMA */
219 DMASKTRIG3 |= 1;
220
221 /* Wait for transfer to complete */
222 while((DSTAT3 & 0x000fffff))
223 CLKCON |= (1 << 2); /* set IDLE bit */
224}
225
226void lcd_clear_display(void)
227{
228 lcd_stop_scroll();
229
230 if(use_dma_blit)
231 {
232 lcd_clear_display_dma();
233 return;
234 }
235
236 fb_data *dst = &lcd_framebuffer[0][0];
237
238 if (lcd_get_drawmode() & DRMODE_INVERSEVID)
239 {
240 memset16(dst, fg_pattern, LCD_WIDTH*LCD_HEIGHT);
241 }
242 else
243 {
244 fb_data* lcd_backdrop = lcd_get_backdrop();
245 if (!lcd_backdrop)
246 memset16(dst, bg_pattern, LCD_WIDTH*LCD_HEIGHT);
247 else
248 memcpy(dst, lcd_backdrop, sizeof(lcd_framebuffer));
249 }
250}
251
252
253/* Update the display. 148/* Update the display.
254 This must be called after all other LCD functions that change the display. */ 149 This must be called after all other LCD functions that change the display. */
255void lcd_update(void) 150void lcd_update(void)