Newer
Older
#endif
#else /* CONFIG_ATMEL_LCD */
lcd_setcolreg(i, cte.red, cte.green, cte.blue);
#endif
}
}
/*
* BMP format for Monochrome assumes that the state of a
* pixel is described on a per Bit basis, not per Byte.
* So, in case of Monochrome BMP we should align widths
* on a byte boundary and convert them from Bit to Byte
* units.
* Probably, PXA250 and MPC823 process 1bpp BMP images in
* their own ways, so make the converting to be MCC200
* specific.
*/
#if defined(CONFIG_MCC200)
width = ((width + 7) & ~7) >> 3;
x = ((x + 7) & ~7) >> 3;
pwidth= ((pwidth + 7) & ~7) >> 3;
}
#endif
padded_width = (width & 0x3 ? (width & ~0x3) + 4 : width);
#ifdef CONFIG_SPLASH_SCREEN_ALIGN
splash_align_axis(&x, pwidth, width);
splash_align_axis(&y, panel_info.vl_row, height);
#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
if ((y + height) > panel_info.vl_row)
height = panel_info.vl_row - y;
bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
fb = (uchar *)(lcd_base +
(y + height - 1) * lcd_line_length + x * bpix / 8);
u32 compression = get_unaligned_le32(&bmp->header.compression);
if (compression == BMP_BI_RLE8) {
if (bpix != 16) {
/* TODO implement render code for bpix != 16 */
printf("Error: only support 16 bpix");
return 1;
}
lcd_display_rle8_bitmap(bmp, cmap_base, fb, x, y);
break;
}
#endif
if (bpix != 16)
byte_width = width;
else
byte_width = width * 2;
for (i = 0; i < height; ++i) {
WATCHDOG_RESET();
for (j = 0; j < width; j++) {
if (bpix != 16) {
} else {
*(uint16_t *)fb = cmap_base[*(bmap++)];
fb += sizeof(uint16_t) / sizeof(*fb);
}
}
bmap += (padded_width - width);
fb -= byte_width + lcd_line_length;
}
break;
#if defined(CONFIG_BMP_16BPP)
case 16:
for (i = 0; i < height; ++i) {
WATCHDOG_RESET();
for (j = 0; j < width; j++)
fb_put_word(&fb, &bmap);
bmap += (padded_width - width) * 2;
fb -= width * 2 + lcd_line_length;
}
break;
#endif /* CONFIG_BMP_16BPP */
#if defined(CONFIG_BMP_32BPP)
case 32:
for (i = 0; i < height; ++i) {
for (j = 0; j < width; j++) {
*(fb++) = *(bmap++);
*(fb++) = *(bmap++);
*(fb++) = *(bmap++);
*(fb++) = *(bmap++);
}
fb -= lcd_line_length + width * (bpix / 8);
}
break;
#endif /* CONFIG_BMP_32BPP */
lcd_sync();
{
#ifdef CONFIG_SPLASH_SCREEN
char *s;
ulong addr;
static int do_splash = 1;
if (do_splash && (s = getenv("splashimage")) != NULL) {
do_splash = 0;
if (splash_screen_prepare())
return (void *)lcd_base;
addr = simple_strtoul (s, NULL, 16);
splash_get_pos(&x, &y);
}
#endif /* CONFIG_SPLASH_SCREEN */
#ifdef CONFIG_LCD_INFO
console_col = LCD_INFO_X / VIDEO_FONT_WIDTH;
console_row = LCD_INFO_Y / VIDEO_FONT_HEIGHT;
lcd_show_board_info();
#endif /* CONFIG_LCD_INFO */
#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
return (void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length);
#endif /* CONFIG_LCD_LOGO && !defined(CONFIG_LCD_INFO_BELOW_LOGO) */
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
#ifdef CONFIG_SPLASHIMAGE_GUARD
static int on_splashimage(const char *name, const char *value, enum env_op op,
int flags)
{
ulong addr;
int aligned;
if (op == env_op_delete)
return 0;
addr = simple_strtoul(value, NULL, 16);
/* See README.displaying-bmps */
aligned = (addr % 4 == 2);
if (!aligned) {
printf("Invalid splashimage value. Value must be 16 bit aligned, but not 32 bit aligned\n");
return -1;
}
return 0;
}
U_BOOT_ENV_CALLBACK(splashimage, on_splashimage);
#endif
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
void lcd_position_cursor(unsigned col, unsigned row)
{
console_col = min(col, CONSOLE_COLS - 1);
console_row = min(row, CONSOLE_ROWS - 1);
}
int lcd_get_pixel_width(void)
{
return panel_info.vl_col;
}
int lcd_get_pixel_height(void)
{
return panel_info.vl_row;
}
int lcd_get_screen_rows(void)
{
return CONSOLE_ROWS;
}
int lcd_get_screen_columns(void)
{
return CONSOLE_COLS;
}
#if defined(CONFIG_LCD_DT_SIMPLEFB)
static int lcd_dt_simplefb_configure_node(void *blob, int off)
{
u32 stride;
fdt32_t cells[2];
int ret;
static const char format[] =
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
#if LCD_BPP == LCD_COLOR16
"r5g6b5";
#else
"";
#endif
if (!format[0])
return -1;
stride = panel_info.vl_col * 2;
cells[0] = cpu_to_fdt32(gd->fb_base);
cells[1] = cpu_to_fdt32(stride * panel_info.vl_row);
ret = fdt_setprop(blob, off, "reg", cells, sizeof(cells[0]) * 2);
if (ret < 0)
return -1;
cells[0] = cpu_to_fdt32(panel_info.vl_col);
ret = fdt_setprop(blob, off, "width", cells, sizeof(cells[0]));
if (ret < 0)
return -1;
cells[0] = cpu_to_fdt32(panel_info.vl_row);
ret = fdt_setprop(blob, off, "height", cells, sizeof(cells[0]));
if (ret < 0)
return -1;
cells[0] = cpu_to_fdt32(stride);
ret = fdt_setprop(blob, off, "stride", cells, sizeof(cells[0]));
if (ret < 0)
return -1;
ret = fdt_setprop(blob, off, "format", format, strlen(format) + 1);
if (ret < 0)
return -1;
ret = fdt_delprop(blob, off, "status");
if (ret < 0)
return -1;
return 0;
}
int lcd_dt_simplefb_add_node(void *blob)
{
static const char compat[] = "simple-framebuffer";
static const char disabled[] = "disabled";
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
int off, ret;
off = fdt_add_subnode(blob, 0, "framebuffer");
if (off < 0)
return -1;
ret = fdt_setprop(blob, off, "status", disabled, sizeof(disabled));
if (ret < 0)
return -1;
ret = fdt_setprop(blob, off, "compatible", compat, sizeof(compat));
if (ret < 0)
return -1;
return lcd_dt_simplefb_configure_node(blob, off);
}
int lcd_dt_simplefb_enable_existing_node(void *blob)
{
int off;
off = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
if (off < 0)
return -1;
return lcd_dt_simplefb_configure_node(blob, off);
}
#endif