From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] sunxi: display: Add overscan correction
Date: Wed, 12 Aug 2015 14:44:58 +0200 [thread overview]
Message-ID: <55CB3FCA.2030907@redhat.com> (raw)
In-Reply-To: <1439376340.8356.13.camel@hellion.org.uk>
Hi,
On 12-08-15 12:45, Ian Campbell wrote:
> 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?
If overscan offset is 0x1004 then we make the simplefb start point to
fb_base + 0x2000:
sunxi_display.fb_addr = gd->fb_base
sunxi_display.fb_addr += (overscan_offset + 0xfff) & ~0xfff
And make the dma engine start at fb_base + 0xffc:
fb_dma_addr = gd->fb_base
fb_dma_addr += 0x1000 - (overscan_offset & 0xfff)
Notice how we make the dma_engine start at less then 0x1000 offset of
fb_base, so making fb_size 0x1000 larger is enough.
Basically to page-align the start of the simplefb / sunxi_display.fb_addr
we only need a single page, the rest we can get by offsetting
sunxi_display.fb_addr from fb_base by a multiple of the page size.
> Also, what's the link between fb_base's alignment and fb_size which is
> implied by the comment?
To align we need a page extra size as the dma-engine may start at
an offset of up-to a page-size from gd->fb_base and the dma-engine
will dma a full framebuffer size, including the black borders.
>
>> > > 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.
Correct this is the answer, sorry for the tricky maths, this is the best
solution without wasting a ton of memory with large overscans.
I hope the above explanation helps, if not keep asking.
>> + 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".
Will fix,
Regards,
Hans
next prev parent reply other threads:[~2015-08-12 12:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 15:17 [U-Boot] [PATCH 0/3] sunxi: display: Add overscan correction Hans de Goede
2015-08-05 15:17 ` [U-Boot] [PATCH 1/3] cfbconsole: Remove width argument from the logo functions Hans de Goede
2015-08-12 21:57 ` Anatolij Gustschin
2015-08-05 15:17 ` [U-Boot] [PATCH 2/3] cfbconsole: Add support for stride != width Hans de Goede
2015-08-12 22:01 ` Anatolij Gustschin
2015-08-05 15:17 ` [U-Boot] [PATCH 3/3] sunxi: display: Add overscan correction Hans de Goede
2015-08-12 10:45 ` Ian Campbell
2015-08-12 12:44 ` Hans de Goede [this message]
2015-08-12 16:18 ` Ian Campbell
2015-08-12 16:42 ` Hans de Goede
2015-08-12 22:11 ` Anatolij Gustschin
2015-08-12 22:15 ` [U-Boot] [PATCH 0/3] " Anatolij Gustschin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55CB3FCA.2030907@redhat.com \
--to=hdegoede@redhat.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.