linux-kernelembedded-linuxframebuffer

Linux simple-framebuffer is not detected by kernel


I'm trying to get the simple-framebuffer working in Linux, so that I can use a region in System RAM as a framebuffer. I'm running Linux kernel v5.10.7 on a RISC-V system.

So far, I have enabled framebuffer support and the necessary driver in Linux:

CONFIG_FB=y
CONFIG_FB_SIMPLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y 

Add added these lines to the device tree

chosen {
    #address-cells = <2>;
    #size-cells = <2>;
    ranges;
    framebuffer {
        compatible = "simple-framebuffer";
        memory-region = <&framebuffer_reserved>;
        width = <640>;
        height = <480>;
        stride = <(640 * 2)>;
        format = "r5g6b5";
    };
};

reserved-memory {

    #address-cells = <2>;
    #size-cells = <2>;
    ranges;
    framebuffer_reserved: framebuffer@A0000000 {
        compatible = "framebuffer";
        reg = <0x0 0xA0000000 0x0 (640 * 480 * 2)>;
        no-map;
    };
};

Neither the reserved memory nor the framebuffer appear in Linux. When doing a

cat /proc/iomem
...
80200000-bfffffff : System RAM
...

even though in theory there should be a split at A0000000 and no /dev/fb0 device exists.


Solution

  • I got it working using the following entries in my device tree

    chosen {
        #address-cells = <2>;
        #size-cells = <2>;
        ranges;
        framebuffer {
            compatible = "simple-framebuffer";
            reg = <0x0 0xA0000000 0x0 (640 * 480 * 2)>;
            width = <640>;
            height = <480>;
            stride = <(640 * 2)>;
            format = "r5g6b5";
        };
    };
    

    Turns out, the reserved-memory block was preventing simple-framebuffer from attaching to the memory region. I'm not sure whether this poses any risk to the framebuffer being overwritten, once RAM starts to fill up.