display驱动模块中dev_fb.c文件中,Fb_map_kernel_logo函数中:
paddr = bootlogo_addr; =====》 这个地址从哪里得到呀,那来的呀??
static int Fb_map_kernel_logo(u32 sel, struct fb_info *info)
{
void *vaddr = NULL;
uintptr_t paddr = 0;
void *screen_offset = NULL, *image_offset = NULL;
char *tmp_buffer = NULL;
char *bmp_data = NULL;
struct sunxi_bmp_store s_bmp_info;
struct sunxi_bmp_store *bmp_info = &s_bmp_info;
struct bmp_pad_header bmp_pad_header;
struct bmp_header *bmp_header;
int zero_num = 0;
unsigned int x, y, bmp_bpix, fb_width, fb_height;
unsigned int effective_width, effective_height;
uintptr_t offset;
int i = 0;
struct disp_manager *mgr;
mgr = g_disp_drv.mgr[sel];
paddr = bootlogo_addr; =====》 这个地址从哪里得到呀,那来的呀??
if (paddr == 0) {
__inf("Fb_map_kernel_logo failed!");
return Fb_copy_boot_fb(sel, info);
}
printk("%s%d%s\n",__FILE__,__LINE__,__FUNCTION__);
/* parser bmp header */
offset = paddr & ~PAGE_MASK;
vaddr = (void *)Fb_map_kernel(paddr, sizeof(struct bmp_header));
if (vaddr == NULL) {
__wrn("fb_map_kernel failed, paddr=0x%p,size=0x%x\n",
(void *)paddr, (unsigned int)sizeof(struct bmp_header));
return -1;
}
memcpy(&bmp_pad_header.signature[0], vaddr + offset,
sizeof(struct bmp_header));
bmp_header = (struct bmp_header *) &bmp_pad_header.signature[0];
if ((bmp_header->signature[0] != 'B')
|| (bmp_header->signature[1] != 'M')) {
Fb_unmap_kernel(vaddr);
#if defined(CONFIG_DECOMPRESS_LZMA)
return lzma_decode(paddr, info);
#else
__wrn("this is not a bmp picture.\n");
return -1;
#endif
}
bmp_bpix = bmp_header->bit_count / 8;
if ((bmp_bpix != 3) && (bmp_bpix != 4))
return -1;
x = bmp_header->width;
y = (bmp_header->height & 0x80000000) ? (-bmp_header->
height) : (bmp_header->height);
if (bmp_bpix == 3) {
zero_num = (4 - ((3 * x) % 4)) & 3;
#ifndef SUPPORT_ROTATE
/*uboot have removed zero for us*/
zero_num = 0;
#endif
}
fb_width = info->var.xres;
fb_height = info->var.yres;
if ((paddr <= 0) || x <= 1 || y <= 1) {
__wrn("kernel logo para error!\n");
return -EINVAL;
}
bmp_info->x = x;
bmp_info->y = y;
bmp_info->bit = bmp_header->bit_count;
bmp_info->buffer = (void *__force)(info->screen_base);
if (bmp_bpix == 3)
info->var.bits_per_pixel = 24;
else if (bmp_bpix == 4)
info->var.bits_per_pixel = 32;
else
info->var.bits_per_pixel = 32;
Fb_unmap_kernel(vaddr);
printk("%s%d%s\n",__FILE__,__LINE__,__FUNCTION__);
/* map the total bmp buffer */
vaddr =
(void *)Fb_map_kernel(paddr,
(x * bmp_bpix + zero_num) * y + sizeof(struct bmp_header));
if (vaddr == NULL) {
__wrn("fb_map_kernel failed, paddr=0x%p,size=0x%x\n",
(void *)paddr,
(unsigned int)(x * y * bmp_bpix +
sizeof(struct bmp_header)));
return -1;
}
tmp_buffer = (char *)bmp_info->buffer;
screen_offset = (void *)bmp_info->buffer;
bmp_data = (char *)(vaddr + bmp_header->data_offset);
image_offset = (void *)bmp_data;
effective_width = (fb_width < x) ? fb_width : x;
effective_height = (fb_height < y) ? fb_height : y;
if (bmp_header->height & 0x80000000) {
#if defined(SUPPORT_ROTATE)
if (info->var.bits_per_pixel == 24) {
screen_offset =
(void *)((void *__force)info->screen_base +
(fb_width * (abs(fb_height - y) / 2)
+ abs(fb_width - x) / 2)
* 4);
rgb24_to_rgb32(image_offset, bmp_header, info,
screen_offset, zero_num);
} else
#endif
{
screen_offset =
(void *)((void *__force)info->screen_base +
(fb_width * (abs(fb_height - y) / 2)
+ abs(fb_width - x) / 2)
* (info->var.bits_per_pixel >> 3));
for (i = 0; i < effective_height; i++) {
memcpy((void *)screen_offset, image_offset,
effective_width *
(info->var.bits_per_pixel >> 3));
screen_offset =
(void *)(screen_offset + fb_width *
(info->var.bits_per_pixel >> 3));
image_offset =
(void *)image_offset +
x * (info->var.bits_per_pixel >> 3);
}
}
} else {
#if defined(SUPPORT_ROTATE)
if (info->var.bits_per_pixel == 24) {
screen_offset =
(void *)((void *__force)info->screen_base +
(fb_width * (abs(fb_height - y) / 2)
+ abs(fb_width - x) / 2)
* 4);
image_offset =
(void *)bmp_data +
(effective_height - 1) * (x * 3 + zero_num);
rgb24_to_rgb32(image_offset, bmp_header, info,
screen_offset, zero_num);
} else
#endif
{
screen_offset =
(void *)((void *__force)info->screen_base +
(fb_width * (abs(fb_height - y) / 2)
+ abs(fb_width - x) / 2)
* (info->var.bits_per_pixel >> 3));
image_offset =
(void *)bmp_data + (effective_height -
1) * x *
(info->var.bits_per_pixel >> 3);
for (i = effective_height - 1; i >= 0; i--) {
memcpy((void *)screen_offset, image_offset,
effective_width *
(info->var.bits_per_pixel >> 3));
screen_offset =
(void *)(screen_offset +
fb_width *
(info->var.bits_per_pixel >> 3));
image_offset =
(void *)bmp_data +
i * x * (info->var.bits_per_pixel >> 3);
}
}
}
Fb_unmap_kernel(vaddr);
return 0;
}
离线
uboot在bootm还是disp_bmp的时候,会更新fdt里的/soc/disp下面属性,会更新bootargs启动参数,显存地址和大小好像是通过bootargs传递给内核的
离线
uboot在bootm还是disp_bmp的时候,会更新fdt里的/soc/disp下面属性,会更新bootargs启动参数,显存地址和大小好像是通过bootargs传递给内核的
这个地址该怎样去确定,就是这个地址的值怎样去确定呢?bmp图片放置的地址
我看display驱动模块里面,logo的显示就是在这一块实现的
最近编辑记录 jkl (2022-06-15 14:30:38)
离线
@jkl
好像是uboot自动分配的地址
离线