Repository navigation
Conversation
|
About holding buffers in (And I'm really sorry for whatever copilot thing is??? It never happened in my other PRs, I have no idea why it was even enabled) |
I don't think anyone's explicitly enabled anything Copilot related on this repo. Maybe something Github has turned on by default that we may want to disable... |
| "virtio_gpu" => false, | ||
| // kernel driver leaks imported dma-bufs | ||
| "vmwgfx" => false, | ||
| _ => true, |
There was a problem hiding this comment.
If this isn't something we can generally assume to be properly supported by drivers, we should probably default to false.
There are various other drivers that might be used on ARM hardware, and I'm not sure how it will compare there.
There was a problem hiding this comment.
Changed it. Plus I originally planned something for discrete gpus but for now they're slower through udmabuf (decided that gpus thing will be in a separate pr after this one)
|
So the idea of Something I was wondering is if we can just allocate a udmabuf file descriptor for the whole Does that amount to the same thing as creating multiple udmabufs with different offsets? And perform the same? If so we may need to create new udmabufs on pool resizes, but it sounds cleaner than trying to make assumptions about how many buffers to cache per pool. |
Only integrated GPUs are allowed. Discrete would read udmabuf over PCIe on every draw, so copying into their own memory is faster if a buffer is drawn more than once. Known broken ones: - nvidia-drm: sometimes shows outdated data, `DMA_BUF_IOCTL_SYNC` doesn't help - i915 without LLC: CPU cache is flushed only on the first import - virtio_gpu: breaks virgl context (KWin report, precaution) - vmwgfx: kernel leak (KWin report, precaution)
gpu reads use DMA_BUF_IOCTL_SYNC for sync, END on every import, and START right after udmabuf creation (since the kernel rejects END without a preceding START). The syncs only matter where CPU caches aren't coherent with the GPU (e.g. many ARM SoCs).
Delays their wl_buffer.release until gpu is done reading them, so `wait_udmabuf_idle` doesn't block the compositor for miliseconds. Unlike `wait_udmabuf_idle`, this also works on gpus that don't report their reads (e.g. nvidia).
|
Yeah that's it, every I've considered one udmabuf per pool. For the gpu it's the same thing and works fine, but it's not faster, the renderer caches imports per Dmabuf, so a new Dmabuf per wl_buffer means a new import every frame, increasing cpu usage, and +- doubling import time. Fixing that needs the same cache again. About buffers number: my description was a bit misleading, it's up to 4, not always 4. Cache only keeps layouts pool actually used, and the vast majority of apps use only one. Dynamic number is easy to implement I think, but I don't know any app using more than 4, and if it needs more it will just create a new udmabuf, which is still faster than copying |

Description
Import shm buffers via udmabuf.
Closes #2044, indirectly helps a bit with #1652.
Details
prefers_udmabuf, but it's a breaking change.wl_buffer.releasewhile the gpu is still reading it. Two solutions are implemented: a blocking one via a fence, and a fast non blocking one via DrmCompositor (not a driver workaround). Fence is still required when DrmCompositor isn't available.create_buffer_from_memfd:removed the stride and offset checks. Offset and size no longer need to be page multiples: the udmabuf starts at the page boundary, and the remainder is passed as the plane offset.Testing results
Intel Tiger Lake + NVIDIA GeForce RTX 3050 Ti Mobile, using Cosmic and anvil.
Results on Intel:
wl_buffer.releasegoes from 1.6 ms to 19 microseconds with itsmall note: Nvidia stale pixel issue (the reason it's fully denied in kde) occurs very rarely for me, but it was widely reported in Kde, so there's no point in making an exception for Nvidia.
Checklist