litex-hub / linux-on-litex-vexriscv

Linux on LiteX-VexRiscv
BSD 2-Clause "Simplified" License
572 stars 174 forks source link

Support for 1bpp framebuffer #396

Open machdyne opened 3 months ago

machdyne commented 3 months ago

I'm interested in getting a 1bpp black and white framebuffer working in order to improve video performance where color isn't needed.

My understanding is that this would require some changes to LiteX and simplefb in the Linux kernel:

https://stackoverflow.com/questions/67397306/monochromatic-1bpp-simple-framebuffer-simplefb-c-format-depth

Am I right in thinking that this could significantly speed up the text console and possibly X11 also? Does anyone else think this is a good idea?

enjoy-digital commented 2 months ago

Hi @machdyne,

this could be interesting yes. We would first need to add 1bpp support to LiteX's framebuffer and test it. Then we could see to add Linux support and enable it for the project.

machdyne commented 2 months ago

Thanks @enjoy-digital,

I was able to get this working, and the console appears to be drawing faster with 1bpp mono, but I wonder if it could be improved further.

https://github.com/machdyne/litex-linux/tree/litex-monochrome

I had to manually update the DTS file:

            framebuffer0: framebuffer@40c00000 {
                compatible = "simple-framebuffer";
                reg = <0x40c00000 0x9600>;
                width = <640>;
                height = <480>;
                stride = <80>;
                format = "mono1";
            };