[U-Boot] [PATCH 3/3] sunxi: display: Add overscan correction

Ian Campbell ijc+uboot at hellion.org.uk
Wed Aug 12 12:45:40 CEST 2015


On Wed, 2015-08-05 at 17:17 +0200, Hans de Goede wrote:
>  > 	> sunxi_display.fb_size =
>  > 	> 	> (mode->xres * mode->yres * 4 + 0xfff) & ~0xfff;
> +> 	> overscan_offset = (overscan_y * mode->xres + overscan_x) * 4;
> +> 	> /* We want to keep the fb_base for simplefb page aligned, where as
> +> 	>  * the sunxi dma engines will happily accept an unaligned address. */
> +> 	> if (overscan_offset)
> +> 	> 	> sunxi_display.fb_size += 0x1000;

Why plus 4K regardless of the magnitude of overscan_offset? What if it was
0x1004?

Also, what's the link between fb_base's alignment and fb_size which is
implied by the comment?

>  > 	> gd->fb_base = gd->bd->bi_dram[0].start +
>  > 	> 	>       gd->bd->bi_dram[0].size - sunxi_display.fb_size;
>  > 	> sunxi_engines_init();
> -> 	> sunxi_mode_set(mode, gd->fb_base - CONFIG_SYS_SDRAM_BASE);
> +
> +> 	> fb_dma_addr = gd->fb_base - CONFIG_SYS_SDRAM_BASE;
> +> 	> sunxi_display.fb_addr = gd->fb_base;
> +> 	> if (overscan_offset) {
> +> 	> 	> fb_dma_addr += 0x1000 - (overscan_offset & 0xfff);
> +> 	> 	> sunxi_display.fb_addr += (overscan_offset + 0xfff) & ~0xfff;
> +> 	> 	> memset((void *)gd->fb_base, 0, sunxi_display.fb_size);
> +> 	> 	> flush_cache(gd->fb_base, sunxi_display.fb_size);
> +> 	> }

Hrm, I think this starts to answer, but I'm still not sure I follow, sorry.

> +	sunxi_mode_set(mode, fb_dma_addr);
>  
>  	/*
>  > 	>  * These are the only members of this structure that are used. All the
>  > 	>  * others are driver specific. There is nothing to decribe pitch or


Pre-existing typo "describe".



More information about the U-Boot mailing list