diff options
author | Leonardo Graboski Veiga <leonardo.veiga@toradex.com> | 2016-08-31 15:05:51 -0300 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2016-09-29 06:03:32 +0200 |
commit | 84e4b425e6237cb026a6fe71025d89fa6359a685 (patch) | |
tree | 87308e5eb522126d1220289c95442fa41a5033dd | |
parent | 4ce5f79a237fbdb995d560b291bd05c824764a2e (diff) |
tegra: lcd: video: add mem alloc for bmp colour conversion map
While trying to display a BMP image by running the command
'bmp display <address>' the Colibri T30 was getting stuck (while on
iMX6, iMX7 and Vybrid it worked). After investigation on what was going
wrong, I noticed that the function 'lcd_set_cmap' should get a pointer
address for the cmap variable, but the function returned 00000000.
After further investigation, I noticed that this value should be held
in the structure.member 'panel_info.cmap', which memory was being
dynamically allocated in the function 'lcd_ctrl_init' of the file
'drivers/video/sandbox_sdl.c' (which was not being called). After
copying the allocation to the same function in the file
'drivers/video/tegra.c', the command 'bmp display' didn't break
anymore. The Colibri T20 module was working without the patch, as the
module does have valid memory at the address 0, and of course it kept
working after the patch now properly allocating memory for it.
Signed-off-by: Leonardo Graboski Veiga <leonardo.veiga@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r-- | drivers/video/tegra.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c index 5a5afb9413c..c1f83b578fd 100644 --- a/drivers/video/tegra.c +++ b/drivers/video/tegra.c @@ -6,6 +6,7 @@ #include <common.h> #include <fdtdec.h> #include <lcd.h> +#include <malloc.h> #include <asm/system.h> #include <asm/gpio.h> @@ -93,6 +94,17 @@ void lcd_ctrl_init(void *lcdbase) lcd_set_flush_dcache(config.cache_type & FDT_LCD_CACHE_FLUSH); debug("LCD frame buffer at %08X\n", disp_config->frame_buffer); + + /* + * Allocate memory to keep BMP colour conversion map. This is + required for 8-bit BMPs only (hence giving 256 colours). If malloc + fails - keep going, it is not even clear if displaying the bitmap + will be required on the way up. + */ + panel_info.cmap = malloc(256 * NBITS(panel_info.vl_bpix) / 8); + if (panel_info.cmap == NULL) { + printf("No memory available for panel_info.cmap!"); + } } ulong calc_fbsize(void) |