freedreno: replace all dup() with os_dupfd_cloexec() Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5369>
meson: use gnu_symbol_visibility argument This uses a meson builtin to handle -fvisibility=hidden. This is nice because we don't need to track which languages are used, if C++ is suddenly added meson just does the right thing. Acked-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4740>
freedreno/drm: disallow exported buffers in bo cache Otherwise we can MADVISE(WONTNEED) a bo that someone else is still using. We already handled that in the dma-buf and flink-name export paths. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5204>
freedreno/drm: handle ancient kernels Older kernels did not support `MSM_INFO_GET_IOVA`. But this is only required for (a) clover (ie. `fd_set_global_binding()`) and drm paths that are limited to newer kernels. So move the location of the assert to fix new userspace on old kernels. Fixes: c9e8df61dc8 ("freedreno: Initialize the bo's iova at creation time.") Signed-off-by: Rob Clark <robdclark@chromium.org> Tested-by: Ilia Mirkin <imirkin@alum.mit.edu> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5081>
freedreno/drm: don't pass thru 'DUMP' flag on older kernels "softpin" mode was introduced in the same kernel as the 'DUMP' flag. So if we are using the legacy non-softpin path, clear the dump flag. OTOH the 'DUMP' flag isn't quite so needed on older kernels, since we would get all cmdstream, even SDS stateobjs, dumped regardless, as they would have cmd table entries. Fixes: b2c23b1e48f ("freedreno: Mark all ringbuffer BOs as to be dumped on crash.") Signed-off-by: Rob Clark <robdclark@chromium.org> Tested-by: Ilia Mirkin <imirkin@alum.mit.edu> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5081>
freedreno: Avoid duplicate BO relocs in FD_RINGBUFFER_OBJECTs. For the piglit drawoverhead case, 5/18 of the objects' relocs were duplicated. We can dedupe them at object create time (since objects are long-lived) and avoid repeated relocation work at emit time. nohw drawoverhead program statechange throughput 2.34082% +/- 0.645832% (n=10). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5020>
freedreno: Tell the kernel that all BOs are for writing. Using non-write flags is pretty dubious -- it means the kernel tracking an array of read-only consumers of the BO and having exclusive consumers wait on each reader's fence. It allows multiple readers through dma-bufs to do work in parallel, but at the cost of kernel CPU time and memory management of the shared array. Other drivers have dropped this distinction since dma-buf sharing is usually producer-consumer, not producer-two-consumers, and the userspace and kernel space tracking is expensive. For us, this lets us drop the flags passed in for relocs and tracked in the ringbuffer reloc lists. The end result of the flags reduction work is drawoverhead uniforms test throughput 2.37195% +/- 0.365579% (n=15) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4967>
freedreno: Mark all ringbuffer BOs as to be dumped on crash. We can avoid passing these flags around in the DRM backends by just marking ring BOs up front. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4967>
freedreno: Start moving relocs flags into the BOs. It's silly to have all the reloc emitters passing around FD_RELOC_READ when you have to have it set on all relocs (that don't include WRITE, which implies read) for the kernel to actually track the fences on the BO. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4967>
freedreno: Initialize the bo's iova at creation time. Avoids repeated conditionals at reloc time checking if we need to go ask the kernel. No statistically significant difference on the drawoverhead case I'm looking at (n=300). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4957>
freedreno: Rename append_bo() in case it doesn't get inlined. In a debugoptimized build, it wasn't inlined and so I wasn't noticing where a bunch of CPU usage was going in the DRM functions. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4957>
freedreno: Clean up tests around ORing in the reloc flags. gcc was surprisingly not seeing through this to just do an AND and an OR. Improves drawoverhead's few uniforms / 1 change throughput 1.64141% +/- 0.188152% (n=60). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4957>
freedreno/drm: inline the things The existing structure dates back to when this code was part of libdrm, and we wanted some of this not to be exposed as ABI between libdrm and mesa. Now that this is no longer a constraint, inline things. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4813>
meson: inline `inc_common` Let's make it clear what includes are being added everywhere, so that they can be cleaned up. Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4360>