From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans de Goede Date: Mon, 02 Feb 2015 19:56:15 +0100 Subject: [U-Boot] [PATCH] video: sunxi: Enable cache for the framebuffer In-Reply-To: <1422667318-27022-1-git-send-email-siarhei.siamashka@gmail.com> References: <1422667318-27022-1-git-send-email-siarhei.siamashka@gmail.com> Message-ID: <54CFC84F.3070200@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, On 31-01-15 02:21, Siarhei Siamashka wrote: > Because the framebuffer resides in a hidden chopped off part of DRAM, > caching is not enabled for this area automatically when the MMU is > configured. So it needs to be set explicitly. > > Additionally, the cfb console has a function to check whether the > framebuffer resides in DRAM or not. And the hidden sunxi framebuffer > needs special treatment again. > > This fix resolves the sluggish scrolling problem. > > Signed-off-by: Siarhei Siamashka Thanks for figuring this out! As already discussed it seems that the problem is that using CONFIG_SYS_MEM_TOP_HIDE seems to be the wrong thing to do. So I've written a patch with results in the same behavior in a slightly different way, with as added bonus that we can give back unused memory to the kernel when booting. I'll Cc you on the patch-set when I send it. Regards, Hans > --- > drivers/video/cfb_console.c | 2 +- > drivers/video/sunxi_display.c | 10 ++++++++++ > 2 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c > index a81affa..23b50df 100644 > --- a/drivers/video/cfb_console.c > +++ b/drivers/video/cfb_console.c > @@ -2090,7 +2090,7 @@ static void *video_logo(void) > } > #endif > > -static int cfb_fb_is_in_dram(void) > +__weak int cfb_fb_is_in_dram(void) > { > bd_t *bd = gd->bd; > #if defined(CONFIG_ARM) || defined(CONFIG_AVR32) || defined(COFNIG_NDS32) || \ > diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c > index f5f24fc..22a1319 100644 > --- a/drivers/video/sunxi_display.c > +++ b/drivers/video/sunxi_display.c > @@ -1060,6 +1060,12 @@ static const char *sunxi_get_mon_desc(enum sunxi_monitor monitor) > return NULL; /* never reached */ > } > > +/* The framebuffer is in DRAM, even though it is in the hidden part of it */ > +int cfb_fb_is_in_dram(void) > +{ > + return 1; > +} > + > void *video_hw_init(void) > { > static GraphicDevice *graphic_device = &sunxi_display.graphic_device; > @@ -1079,6 +1085,10 @@ void *video_hw_init(void) > CONFIG_SUNXI_FB_SIZE >> 10); > gd->fb_base = gd->ram_top; > > + mmu_set_region_dcache_behaviour(gd->fb_base, > + CONFIG_SUNXI_FB_SIZE, > + DCACHE_WRITEBACK); > + > video_get_ctfb_res_modes(RES_MODE_1024x768, 24, &mode, > &sunxi_display.depth, &options); > #ifdef CONFIG_VIDEO_HDMI >