09-09-2023, 05:34 AM
A frame buffer is normally a buffer provided by the hardware (using memory-mapped I/O (MMIO) or DMA) or by the driver where the userspace can just write to the predetermined address. So yes, using the pointer returned by the driver is how you use it. If you want to allocate your own buffer, that would be double-buffering, so then you need to "blit" (copy) your double buffer into the real frame buffer regularly (usually in some interrupt handler, synchronized to the screen refresh to avoid flickering). It can make sense on some hardware, not so much on other hardware. I do not know the internals of the PinePhone display hardware well enough to be able to tell you whether it makes sense here. (Well, technically, some hardware also allows you to remap its DMA to a different address, provided by you, usually under some constraints such as a minimum alignment, but I do not know whether this is possible on the PinePhone.)