Unlike BitSet, which is backed by a Vec<u32>, this is backed by a
fixed-length array is therefore Copy. It's also mostly const so it can
be constructed and used from const contexts. Because of the const
rules, it's a bit more rigid and can only really accept keys which are
unsigned integer types.
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41915>
checking completion alone disregards submit_count, which is used to
determine the validity of any existing usage pointer. this could lead to
large numbers of bos with stale usage and infinite memory ballooning
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41936>
Given the relative cost of the extra syscall and kmalloc for the name
versus actually allocating pages, we can just always do this and give a
better debugging experience by default. We expect infrequent memory
allocation on Vulkan, anyway.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41878>
To use the common function, this gives up the warning about the
memory being too small to meet the Vulkan spec for low end
devices.
Note: the common helper expose 25% for devices with <=1GiB but
to adhere to the Vulkan spec, the value is clamped to 1GiB.
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41242>
The budget calculation has changes slightly as the budget scaling
is applied prior to adding the used up heap memory.
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41242>
This also changes `video_memory` to use the heuristic instead of
the 10%, consistent with `max_mem_alloc_size`.
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41242>
The budget calculation has changes slightly as the budget scaling
is applied prior to adding the used up heap memory.
This also introduces a new tier since the common helper exposes
25% of memory as heap on devices with <=1GiB memory. Previously
50% was being used.
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41242>
Also remove the clamping to va_size in the budget calculation
since the heap_size is already clamped to va_size and the budget
is clamped to heap_size.
This also introduces a new tier since the common helper exposes
25% of memory as heap on devices with <=1GiB memory. Previously
50% was being used.
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41242>
This also introduces a new tier since the common helper exposes
25% of memory as heap on devices with <=1GiB memory. Previously
50% was being used.
This also fixes `device->heap_used` not using atomic read.
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41242>
The budget calculation has changes slightly as the budget scaling
is applied prior to adding the used up heap memory.
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41242>
Some drivers scale the available memory proportionally to the
advertised heap memory. The `heap_memory_percent` driconf option
allows tweaking the percentage of system memory exposed as heap
memory, so drivers supporting this also need to scale their
budgets accordingly. So add `vk_gpu_heap_budget_from_system()`.
Some drivers just clamp the available memory to the heap size. This
is accounted for by having the `scale_with_heap` parameter.
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41242>
Also adds helper function to be used by drivers.
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41242>
When moving the code of creating image views to the init_sampler_view()
function, the check for Z/S aspect bits was forgotten to be added
(because it was a big if gating a lot of code originally).
When the driver doesn't have needs_zs_shader_swizzle set, this is not
problematic, because the condition for creating Z/S view is to have only
Z aspect; however the needs_zs_shader_swizzle case now fails because Z/S
views are now created for color images.
Fix the issue by re-adding the Z/S aspect check before checking
needs_zs_shader_swizzle flag.
Fixes: cafa22142b ("zink: create views for samplers lazily")
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41923>
agx_batch_writes_range takes the offset within the buffer, not the address
Fixes: 4a3b905bb8 ("agx: move texture lowering into lib")
Reviewed-by: Mary Guillemard <mary@mary.zone>
Reviewed-by Janne Grunau <j@jannau.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41386>
When both inputs are denorms, the bcsel picks the integer min/max result,
which does not flush denorms and therefore might return the wrong result.
Fixes OpenCL fmin/fmax on asahi.
Fixes: d238d766c6 ("nir: add lower_fminmax_signed_zero")
Reviewed-by: Mary Guillemard <mary@mary.zone>
Reviewed-by Janne Grunau <j@jannau.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41386>
numFds could be no less than 1 based on the number of plane(s) and
metadata(optional) fd in a gralloc buf handle. and amdgpu backend
of gralloc should make sure all plane bufs within same dma_buf fd
but different offset.
handle->data[0] already indicates dma_buf fd of plane(s) well.
Signed-off-by: Ken Xue <Ken.Xue@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41879>
This change updates the configuration to fix some
regressions with the fpu64 emulation.
Note: The r600 has a single precision fma op code which
breaks the fpu64 emulation if used as nir_op_ffma (It
likely returns a double).
This change was tested on palm and barts.
Fixes: aeea2e7c1f ("nir: add fmad_or_ffma helpers and use it in lower_double_ops")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41781>
The Mesa PowerVR driver is Vulkan only, and Zink is used solely for
APIs implemented by Gallium.
Change the driver name to "zink" if the device node's driver is
"powervr".
Backport-to: 26.1
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Acked-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41737>
This reverts commit adf18abb40.
Some setups rely on matching kmsro for render nodes (e.g. clients to
wlroot-based compositors).
Backport-to: 26.1
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Acked-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41737>