fb_deferred_io callback is never called in framebuffer driver on Raspberry Pi Zero V1.1

63 Views Asked by At

Writing a framebuffer driver for an TFT LCD panel on a buildroot distribution (having armv6l kernel V 5.4.51) finally installed on a Raspberry Pi Zero WH V1.1 I wanted to register a callback via

static struct fb_deferred_io fb_defio = {
        .delay          = HZ/20,
        .deferred_io    = fb_update_deferred_io,
};

[...]
unsigned char  *videomemory;
[...]

videomemory=vmalloc(info->fix.smem_len);
if (!videomemory)
{
   [...]
}
info->fix.smem_start =(unsigned long)(videomemory);
info->screen_base = (char __iomem *)info->fix.smem_start;
item->videomem = videomemory;

info->fbdefio = &fb_defio;
fb_deferred_io_init(info);

(to do the TFT update stuff) that normally should be called as kernel documentation states: "It uses host memory as a buffer and the MMU pagefault as a pretrigger for when to perform the device IO." Doing a lot of printk() debugging of the module I'm sure that the update callback fb_update_deferred_io() is never called. But doing the update in the framebuffer drawing function directly slows down the driver to much.

I also downloaded/ investigated a found solution (such as ili9341 driver) but again debug resulted in the same conclusion - callback is never called.

So something in regard to MMU seams to be the problem?! And now I'm entering new territory.

Investigations of the Kconfig kernel configurations revealed that CONFIG_FB_DEFERRED_IO is "true". Which finally provides the fb_deferred_io_init() etc. interface to the kernel module - so no surprise. Also CONFIG_MMU is "true" which maybe must be set to have MMU enabled which in turn is needed to generate pagefaults as a pretrigger?!

But has a Raspberry Pi Zero WH V1.1 kernel really paging etc. enabled? Reading articles in the internet increased my impression that it's not really the case? And ... until today I didn't found a working framebuffer driver (as part of the kernel video driver section) that uses successful the fb_deferred_io mechanism. Such as reading the sources of the (also installed and working) bcm2708_fb driver no fb_deferred_io is used.

Maybe an expert can tell me more and/ or give me a hint how to implement a performant driver (if needed) without fb_deferred_io?

Thanks in advance.

0

There are 0 best solutions below