Search code examples
linux-kernellinux-device-driverframebuffer

Linux device driver for display | Framebuffer


I am studying the display device driver for linux that runs TFT display, now framebuffer stores all the data that is to be displayed.

Question: does display driver have equvalant buffer of its own to handle framebuffer from the kernel?

My concern is that the processor has to take the output from the GPU and produce a framebuffer to be sent out to the display driver, but depending on the display there might be some latencies and other issues so do display driver access framebuffer directly or it uses its own buffer as well?


Solution

  • This is a rabbit-hole question; it seems simple on the surface, but a factual answer is bound to end up in fractal complexity.

    It's literally impossible to give a generalized answer.


    The cliff notes version is: GPUs have their own memory, which is directly visible to the CPU in the form of a memory mapping (you can query the actual range of physical addresses from e.g. /sys/class/drm/card0/device/resource). Somewhere in there, there's also the memory used for the display scanout buffer. When using GPU accelerated graphics, the GPU will write directly to those scanout buffers – possibly to memory that's on a different graphics card (that's how e.g. Hybrid graphics work).

    My concern is that the processor has to take the output from the GPU and produce a framebuffer to be sent out to the display driver

    Usually that's not the case. However even if there's a copy involved, these days bus bandwidths are large enough for that copy operation not to matter.

    I am studying the display device driver for linux that runs TFT display

    If this is a TFT display connected with SPI or an parallel bus made from GPIOs, then yes, there'll be some memory reserved for the image to reside on. Strictly speaking this can be in the RAM for the CPU, or in the VRAM of a GPU, if there is one. However as far as latencies go, the copy operations for scanout don't really matter these days.

    20 years ago, yes, and even back then with clever scheduling you could avoid the latencies.