summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c')
-rw-r--r--firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c83
1 files changed, 10 insertions, 73 deletions
diff --git a/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c b/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
index c6ec9ee996..4f1ec2a1f2 100644
--- a/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
+++ b/firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c
@@ -28,7 +28,6 @@
28static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; 28static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
29 29
30/* LCD command set for Samsung S6B33B2 */ 30/* LCD command set for Samsung S6B33B2 */
31
32#define R_NOP 0x00 31#define R_NOP 0x00
33#define R_OSCILLATION_MODE 0x02 32#define R_OSCILLATION_MODE 0x02
34#define R_DRIVER_OUTPUT_MODE 0x10 33#define R_DRIVER_OUTPUT_MODE 0x10
@@ -179,7 +178,7 @@ void lcd_init_device(void)
179 178
180 lcd_send_command(R_SPEC_DISPLAY_PATTERN); 179 lcd_send_command(R_SPEC_DISPLAY_PATTERN);
181 lcd_send_command(0x0); 180 lcd_send_command(0x0);
182 181
183 /* Rockbox init */ 182 /* Rockbox init */
184 lcd_clear_display(); 183 lcd_clear_display();
185 lcd_update(); 184 lcd_update();
@@ -212,89 +211,27 @@ void lcd_set_flip(bool yesno)
212} 211}
213 212
214/*** update functions ***/ 213/*** update functions ***/
215
216void lcd_yuv_set_options(unsigned options) 214void lcd_yuv_set_options(unsigned options)
217{ 215{
218 lcd_yuv_options = options; 216 lcd_yuv_options = options;
219} 217}
220 218
221/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ 219/* TODO: implement me */
222extern void lcd_write_yuv420_lines(unsigned char const * const src[3], 220void lcd_blit_yuv(unsigned char *const src[3],
223 int width,
224 int stride);
225extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3],
226 int width,
227 int stride,
228 int x_screen, /* To align dither pattern */
229 int y_screen);
230/* Performance function to blit a YUV bitmap directly to the LCD */
231void lcd_blit_yuv(unsigned char * const src[3],
232 int src_x, int src_y, int stride, 221 int src_x, int src_y, int stride,
233 int x, int y, int width, int height) 222 int x, int y, int width, int height)
234{ 223{
235 unsigned char const * yuv_src[3]; 224 (void) src;
236 off_t z; 225 (void) src_x;
226 (void) src_y;
227 (void) stride;
228 (void) x;
229 (void) y;
237 230
238 /* Sorry, but width and height must be >= 2 or else */ 231 return;
239 width &= ~1;
240 height >>= 1;
241
242 y += 0x1a;
243
244 z = stride*src_y;
245 yuv_src[0] = src[0] + z + src_x;
246 yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1);
247 yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
248 232
249 lcd_send_command(R_ENTRY_MODE);
250 lcd_send_command(0x80);
251
252 lcd_send_command(R_X_ADDR_AREA);
253 lcd_send_command(x);
254 lcd_send_command(x + width - 1);
255
256 if (lcd_yuv_options & LCD_YUV_DITHER)
257 {
258 do
259 {
260 lcd_send_command(R_Y_ADDR_AREA);
261 lcd_send_command(y);
262 lcd_send_command(y + 1);
263
264 /* NOP needed because on some c200s, the previous lcd_send_command
265 is interpreted as a separate command instead of part of
266 R_Y_ADDR_AREA. */
267 lcd_send_command(R_NOP);
268
269 lcd_write_yuv420_lines_odither(yuv_src, width, stride, x, y);
270 yuv_src[0] += stride << 1; /* Skip down two luma lines */
271 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
272 yuv_src[2] += stride >> 1;
273 y += 2;
274 }
275 while (--height > 0);
276 }
277 else
278 {
279 do
280 {
281 lcd_send_command(R_Y_ADDR_AREA);
282 lcd_send_command(y);
283 lcd_send_command(y + 1);
284
285 lcd_send_command(R_NOP);
286
287 lcd_write_yuv420_lines(yuv_src, width, stride);
288 yuv_src[0] += stride << 1; /* Skip down two luma lines */
289 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
290 yuv_src[2] += stride >> 1;
291 y += 2;
292 }
293 while (--height > 0);
294 }
295} 233}
296 234
297
298/* Update the display. 235/* Update the display.
299 This must be called after all other LCD functions that change the display. */ 236 This must be called after all other LCD functions that change the display. */
300void lcd_update(void) 237void lcd_update(void)