]>
git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/video/sandbox_sdl.c
2 * Copyright (c) 2013 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/u-boot-sandbox.h>
14 DECLARE_GLOBAL_DATA_PTR
;
17 /* Maximum LCD size we support */
20 LCD_MAX_LOG2_BPP
= 4, /* 2^4 = 16 bpp */
25 void lcd_setcolreg(ushort regno
, ushort red
, ushort green
, ushort blue
)
29 void lcd_ctrl_init(void *lcdbase
)
32 * Allocate memory to keep BMP color conversion map. This is required
33 * for 8 bit BMPs only (hence 256 colors). If malloc fails - keep
34 * going, it is not even clear if displyaing the bitmap will be
35 * required on the way up.
37 panel_info
.cmap
= malloc(256 * NBITS(panel_info
.vl_bpix
) / 8);
42 if (sandbox_sdl_init_display(panel_info
.vl_col
, panel_info
.vl_row
,
44 puts("LCD init failed\n");
47 int sandbox_lcd_sdl_early_init(void)
49 const void *blob
= gd
->fdt_blob
;
50 int xres
= LCD_MAX_WIDTH
, yres
= LCD_MAX_HEIGHT
;
55 * The code in common/lcd.c does not cope with not being able to
56 * set up a frame buffer. It will just happily keep writing to
57 * invalid memory. So here we make sure that at least some buffer
58 * is available even if it actually won't be displayed.
60 node
= fdtdec_next_compatible(blob
, 0, COMPAT_SANDBOX_LCD_SDL
);
62 xres
= fdtdec_get_int(blob
, node
, "xres", LCD_MAX_WIDTH
);
63 yres
= fdtdec_get_int(blob
, node
, "yres", LCD_MAX_HEIGHT
);
64 if (xres
< 0 || xres
> LCD_MAX_WIDTH
) {
68 if (yres
< 0 || yres
> LCD_MAX_HEIGHT
) {
69 yres
= LCD_MAX_HEIGHT
;
74 panel_info
.vl_col
= xres
;
75 panel_info
.vl_row
= yres
;
76 panel_info
.vl_bpix
= LCD_COLOR16
;