summaryrefslogtreecommitdiff
path: root/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/sandisk/sansa-c200/lcd-c200.c')
-rw-r--r--firmware/target/arm/sandisk/sansa-c200/lcd-c200.c54
1 files changed, 43 insertions, 11 deletions
diff --git a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
index 5975ab159d..fa8581f286 100644
--- a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
+++ b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
@@ -22,6 +22,9 @@
22#include "kernel.h" 22#include "kernel.h"
23#include "system.h" 23#include "system.h"
24 24
25/* Display status */
26static unsigned lcd_yuv_options NOCACHEBSS_ATTR = 0;
27
25/* LCD command set for Samsung S6B33B2 */ 28/* LCD command set for Samsung S6B33B2 */
26 29
27#define R_OSCILLATION_MODE 0x02 30#define R_OSCILLATION_MODE 0x02
@@ -206,10 +209,20 @@ void lcd_blit(const fb_data* data, int x, int by, int width,
206 (void)stride; 209 (void)stride;
207} 210}
208 211
212void lcd_yuv_set_options(unsigned options)
213{
214 lcd_yuv_options = options;
215}
216
209/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ 217/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
210extern void lcd_write_yuv420_lines(unsigned char const * const src[3], 218extern void lcd_write_yuv420_lines(unsigned char const * const src[3],
211 int width, 219 int width,
212 int stride); 220 int stride);
221extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3],
222 int width,
223 int stride,
224 int x_screen, /* To align dither pattern */
225 int y_screen);
213/* Performance function to blit a YUV bitmap directly to the LCD */ 226/* Performance function to blit a YUV bitmap directly to the LCD */
214void lcd_yuv_blit(unsigned char * const src[3], 227void lcd_yuv_blit(unsigned char * const src[3],
215 int src_x, int src_y, int stride, 228 int src_x, int src_y, int stride,
@@ -236,19 +249,38 @@ void lcd_yuv_blit(unsigned char * const src[3],
236 lcd_send_command(x); 249 lcd_send_command(x);
237 lcd_send_command(x + width - 1); 250 lcd_send_command(x + width - 1);
238 251
239 do 252 if (lcd_yuv_options & LCD_YUV_DITHER)
240 { 253 {
241 lcd_send_command(R_Y_ADDR_AREA); 254 do
242 lcd_send_command(y); 255 {
243 lcd_send_command(y + 1); 256 lcd_send_command(R_Y_ADDR_AREA);
244 257 lcd_send_command(y);
245 lcd_write_yuv420_lines(yuv_src, width, stride); 258 lcd_send_command(y + 1);
246 yuv_src[0] += stride << 1; /* Skip down two luma lines */ 259
247 yuv_src[1] += stride >> 1; /* Skip down one chroma line */ 260 lcd_write_yuv420_lines_odither(yuv_src, width, stride, x, y);
248 yuv_src[2] += stride >> 1; 261 yuv_src[0] += stride << 1; /* Skip down two luma lines */
249 y += 2; 262 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
263 yuv_src[2] += stride >> 1;
264 y += 2;
265 }
266 while (--height > 0);
267 }
268 else
269 {
270 do
271 {
272 lcd_send_command(R_Y_ADDR_AREA);
273 lcd_send_command(y);
274 lcd_send_command(y + 1);
275
276 lcd_write_yuv420_lines(yuv_src, width, stride);
277 yuv_src[0] += stride << 1; /* Skip down two luma lines */
278 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
279 yuv_src[2] += stride >> 1;
280 y += 2;
281 }
282 while (--height > 0);
250 } 283 }
251 while (--height > 0);
252} 284}
253 285
254/* Update the display. 286/* Update the display.