cs_finish() is doing two things:
1. wrapping up the CS to prepare for its execution
2. freeing the temporary instrs array and maybe_ctx allocations
Mixing those two things lead to confusion and leaks, so let's split
those into cs_end() and cs_builder_fini(), and make sure panvk/panfrost
call both when appropriate.
Fixes: 50d2396b7e ("pan/cs: add helpers to emit contiguous csf code blocks")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
In 0ca870c6f3 I forgot to fill the bind_map::dynamic_descriptors
array... Duh!
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 0ca870c6f3 ("anv: fix broken ray tracing dynamic descriptors")
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
(cherry picked from commit 6dff50c8bc)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
Shader objects are by definition I think independents.
But implementation like Anv would like to optimize dynamic descriptors
if possible. It's possible if the sets are not independent.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
(cherry picked from commit 104206fb0f)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
This will also fix NIR_DEBUG=extended_validation complaining about
invalid loop analysis. GCM will invalidate loop analysis if progress
was made, and depending on the removed instruction it will affect the
instr_cost.
Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit a4e84c9244)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
This matches better what we do in pan_emit_fbd, where we don't increase
the cbuf_offset variable for unused render-targets. This way we simply
make sure we *at least* can fit a dummy-RT (as per the HW spec), but
since we don't write to it we also don't need to give it dedicated
memory beyond that.
This also seemingly fixes a subtle bug where we don't deal with PLS if
there's no active render-targets.
Fixes: 9ec6197a0b ("panfrost: allocate tile-buffer for dummy render-targets")
Fixes: c15a43cce0 ("pan/lib: prepare for pixel local storage support")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
(cherry picked from commit 762fe6e9dc)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
If we don't do that and something fails in the middle, we leak
the decode context.
Fixes: d155d6b7a3 ("panvk: Add a decode context at the panvk_device level")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
(cherry picked from commit 55481b6f10)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
own_bin needs to be set to true if we want the bin_ptr to be freed.
Fixes: 3d2cc01f8a ("panvk: Add create_shader_from_binary")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
(cherry picked from commit d9fa4d5cbb)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
s/util_dynarray_clear/util_dynarray_fini/ to fix the leak.
Fixes: 7dc4f28507 ("pan/bi: schedule simple iterators to avoid extra move")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
(cherry picked from commit b66861a5f0)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
The desc_heap field is unconditionally initialized, so we need to
call util_vma_heap_finish() on it.
Fixes: ec02137c86 ("panvk: Support DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
(cherry picked from commit 29d173060e)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
When considering ((x << y) % divisor), we recursed to calculate
mod = (x % (divisor << y)) but incorrectly returned mod directly,
rather than the correct value, (mod << y).
(Note that we require divisor to be a power-of-two.)
As an example of this going wrong, (x << 1) % 4 was returning (x % 2)
which is 0 or 1, but x << 1 is 2x, which is always an even number so
the result mod 4 can only be 0 or 2.
Unit test suggested by Caio Oliveira during review.
Fixes: 2255375c4d ("nir: add nir_mod_analysis & its tests")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
(cherry picked from commit 97857d3224)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
In case vk_color_attachment_location_state is in its default state, we
would end up with an identity mapping for color_map resulting in 8 RTs
being selected instead of what is really required.
This now use the rendering state attachment count to properly emit
SET_CT_SELECT.
Found while debugging MRT on
"dEQP-VK.shader_object.rendering.color_attachment_count_1.extra_attachment_after_1.none.none.same_color_formats.after.none.r16g16_sint_d32_sfloat_s8_uint"
and while comparing with the proprietary driver.
Signed-off-by: Mary Guillemard <mary@mary.zone>
Fixes: 84de6c12b2 ("nvk: Emit SET_CT_SELECT based on the dynamic color location map")
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
(cherry picked from commit 86d190e158)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
Although a crate may happen to be compatible with multiple editions, building with the wrong
edition can - generally speaking - lead to subtle bugs.
There are no known failures in this case, but better to match the official Cargo.toml anyway.
Fixes: e28ff81869 ("meson: Add pest rust dependencies")
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
(cherry picked from commit 2044cf885b)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
Although a crate may happen to be compatible with multiple editions, building with the wrong
edition can - generally speaking - lead to subtle bugs.
There are no known failures in this case, but better to match the official Cargo.toml anyway.
Fixes: dde95fc039 ("meson,ci: Add the paste crate")
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
(cherry picked from commit f95a5d5df8)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
Although a crate may happen to be compatible with multiple editions, building with the wrong
edition can - generally speaking - lead to subtle bugs.
There are no known failures in this case, but better to match the official Cargo.toml anyway.
Fixes: 9e3e12e6a9 ("meson: Add indexmap rust dependencies")
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
(cherry picked from commit d757018e77)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
This avoids u_upload_data_ref() when cb0 is bound. The u_upload_*_ref()
paths are still problematic to mix with uploaders that the front-end
uses with explicitly managed releasebufs, but this at least side-steps
the issue, and is a legit fix on it's own.
Cc: mesa-stable
Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
(cherry picked from commit cb9d9b8a6e)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
pipe_upload_constant_buffer0() was immediately releasing the
u_upload_alloc() releasebuf. But it is used in various call-
paths where the release needs to be deferred further.
Fixes crashes in firefox for any driver that uses the same
u_upload_mgr instance for pipe->const_uploader and
pipe->stream_uploader.
Fixes: b3133e250e ("gallium: add pipe_context::resource_release to eliminate buffer refcounting")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14309
Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
(cherry picked from commit 51605bfac2)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
Current stack size is stored in layout.sw_stack_size, but the function
thats supposed to update it is comparing layout.total_size instead.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
CC: mesa-stable
(cherry picked from commit 0b3f0d1662)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
cat2_may_use_scalar_alu() was incorrect because the instruction could
use an indirectly-accessed const where a0.x (i.e. the offset) is
non-uniform. Fortunately, we already know whether this is the case,
because the original instruction would then write a non-shared GPR.
Also, the restrictions for scalar ALU are the same regardless of whether
we write up0.x or a shared GPR, and vice versa the restrictions for
normal cat2 are the same regardless of whether we write p0.x or a
non-shared GPR, so it should always be safe to write p0.x if non-shared
and up0.x if shared. So, just do that.
Fixes: 2a8c5ebc77 ("ir3: enable scalar predicates")
(cherry picked from commit da969df092)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
Add the new file so panfrost CI jobs are properly triggered.
Fixes: c793f612fc ("ci/panfrost: Split inherit definitions into -inc")
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
(cherry picked from commit 040a24785e)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
We forgot to call tu_fill_render_pass_state when resuming because it was
mixed in with emitting commands for the start of the subpass. Fix that
by pulling it out. This adds some duplication, but I think it's better
than mixing command emission and CPU-side state setup in the same
function.
Fixes: cb0f414b2a ("tu: Add support for suspending and resuming renderpasses")
(cherry picked from commit f734dff419)
Conflicts:
src/freedreno/vulkan/tu_cmd_buffer.cc
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
The shader assembly was only available when not hitting the cache.
Additionally the serialized shader code was also the relocated variant
which meant that it could differ from one run to the next. Instead
serialize the unrelocated code produced by the compiler.
With this change we now decode the copy of the ISA we have on the
host.
NIR dumps are only available for shaders not loaded from the cache
(much like the other drivers).
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 8f4c2bd566 ("anv: add runtime shader statistic support")
Acked-by: Michael Cheng <michael.cheng@intel.com>
(cherry picked from commit 37789249a1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
Coverity notices that we read past the end of the array we're pointing
to, which is intentional, we want to copy additional members from the
source struct into the target pointer. As such, cast to a `void *`,
since this will make Coverity happy.
CID: 1649589
Fixes: 314de7af06 ("anv: Initial support for VP9 decoding")
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
(cherry picked from commit 938fb7703e)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>
I'm assuming this based off the `if` branch above, after reading the
code for bit that Coverity pointed out in that branch. It doesn't look
correct to start at the base pointer, which will be 0 initialized and
has 52 bits of zero padding, while the default values are 255.
Fixes: 314de7af06 ("anv: Initial support for VP9 decoding")
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
(cherry picked from commit 0735551b08)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39003>