On Thursday, November 9th, 2023 at 20:17, Maxime Ripard <mripard@xxxxxxxxxx> wrote: > > Can we add another function pointer to the struct drm_driver (or > > similar) to do the allocation, and move the actual dmabuf handling > > code into the core? > > Yeah, I agree here, it just seems easier to provide a global hook and a > somewhat sane default to cover all drivers in one go (potentially with > additional restrictions, like only for modeset-only drivers or > something). First off not all drivers are using the GEM DMA helpers (e.g. vc4 with !vc5 does not). The heap code in this patch only works with drivers leveraging GEM DMA helpers. Then maybe it's somewhat simple to cover typical display devices found on split render/display SoCs, however for the rest it's going to be much more complicated. For x86 typically there are multiple buffer placements supported by the GPU and we need to have one heap per possible placement. And then figuring out all of the rules, priority and compatibility stuff is a whole other task in and of itself. In short: I think it's unreasonable to expose a heap without good knowledge of the specific hardware. In other words, unreasonable to expose a heap for all drivers at once.