summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-03-08 04:14:30 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-03-08 04:14:30 +0000
commit9d75acbaf706912082c967f79e9c01637ed55f54 (patch)
treecab74c7f82b108208b3b9b3cd7f307819667e0b9 /firmware/drivers
parent10e7e22452e2aa92c43926f2465a1a3bcaf2ff8e (diff)
downloadrockbox-9d75acbaf706912082c967f79e9c01637ed55f54.tar.gz
rockbox-9d75acbaf706912082c967f79e9c01637ed55f54.zip
~2% performance improvement and some code cleanups for ipod video lcd update
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8953 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/lcd-ipodvideo.c67
1 files changed, 36 insertions, 31 deletions
diff --git a/firmware/drivers/lcd-ipodvideo.c b/firmware/drivers/lcd-ipodvideo.c
index c113652bd0..bdc85fbbde 100644
--- a/firmware/drivers/lcd-ipodvideo.c
+++ b/firmware/drivers/lcd-ipodvideo.c
@@ -137,28 +137,21 @@ extern void _HD_ARM_Update5G (fb_data *fb, int x, int y, int w, int h);
137void lcd_update_rect(int x, int y, int width, int height) ICODE_ATTR; 137void lcd_update_rect(int x, int y, int width, int height) ICODE_ATTR;
138void lcd_update_rect(int x, int y, int width, int height) 138void lcd_update_rect(int x, int y, int width, int height)
139{ 139{
140 int rect1,rect2,rect3,rect4;
141 int newx,newwidth;
142 int count;
143 int c, r;
144 unsigned int data;
145 unsigned short *src;
146 static int finishup_needed = 0; 140 static int finishup_needed = 0;
147 141
148 /* Ensure x and width are both even - so we can read 32-bit aligned 142 {
149 data from lcd_framebuffer */ 143 int endy = x + width;
150 newx=x&~1; 144 /* Ensure x and width are both even - so we can read 32-bit aligned
151 newwidth=width&~1; 145 data from lcd_framebuffer */
152 if (newx+newwidth < x+width) { newwidth+=2; } 146 x &= ~1;
153 x=newx; width=newwidth; 147 width &= ~1;
154 148 if (x + width < endy) {
155 /* calculate the drawing region */ 149 width += 2;
156 rect1 = x; /* start horiz */ 150 }
157 rect2 = y; /* start vert */ 151 }
158 rect3 = (x + width) - 1; /* max horiz */
159 rect4 = (y + height) - 1; /* max vert */
160 152
161 if (finishup_needed) { 153 if (finishup_needed) {
154 unsigned int data;
162 /* Bottom-half of original lcd_bcm_finishup() function */ 155 /* Bottom-half of original lcd_bcm_finishup() function */
163 do { 156 do {
164 /* This function takes about 14ms to execute - so we yield() */ 157 /* This function takes about 14ms to execute - so we yield() */
@@ -169,12 +162,18 @@ void lcd_update_rect(int x, int y, int width, int height)
169 162
170 lcd_bcm_read32(0x1FC); 163 lcd_bcm_read32(0x1FC);
171 164
172 165 {
173 /* setup the drawing region */ 166 int rect1, rect2, rect3, rect4;
174 count=(width * height) << 1; 167 int count = (width * height) << 1;
175 lcd_bcm_setup_rect(0x34, rect1, rect2, rect3, rect4, count); 168 /* calculate the drawing region */
176 169 rect1 = x; /* start horiz */
177 src = (unsigned short*)&lcd_framebuffer[y][x]; 170 rect2 = y; /* start vert */
171 rect3 = (x + width) - 1; /* max horiz */
172 rect4 = (y + height) - 1; /* max vert */
173
174 /* setup the drawing region */
175 lcd_bcm_setup_rect(0x34, rect1, rect2, rect3, rect4, count);
176 }
178 177
179 /* write out destination address as two 16bit values */ 178 /* write out destination address as two 16bit values */
180 outw((0xE0020 & 0xffff), 0x30010000); 179 outw((0xE0020 & 0xffff), 0x30010000);
@@ -183,14 +182,20 @@ void lcd_update_rect(int x, int y, int width, int height)
183 /* wait for it to be write ready */ 182 /* wait for it to be write ready */
184 while ((inw(0x30030000) & 0x2) == 0); 183 while ((inw(0x30030000) & 0x2) == 0);
185 184
186 for (r = 0; r < height; r++) { 185 {
187 /* for each column */ 186 int r;
188 for (c = 0; c < width; c+=2) { 187 int line_size = (LCD_WIDTH - width);
189 /* write out two pixels */ 188 unsigned short *src = (unsigned short*)&lcd_framebuffer[y][x];
190 outw(*(src++), 0x30000000); 189 for (r = 0; r < height; r++) {
191 outw(*(src++), 0x30000000); 190 /* for each column */
191 unsigned short *end = src + width;
192 while (src < end) {
193 /* write out two pixels */
194 outw(*(src++), 0x30000000);
195 outw(*(src++), 0x30000000);
196 }
197 src += line_size;
192 } 198 }
193 src += (LCD_WIDTH - width);
194 } 199 }
195 200
196 /* Top-half of original lcd_bcm_finishup() function */ 201 /* Top-half of original lcd_bcm_finishup() function */