For large constants inlined into phis, this would overread the remap[] array,
which could crash. No CTS tests affected though.
Christoph found the bug and fixed it for Bifrost over in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39305. I just did a
quick CTS run of the obvious AGX backport over this morning's breakfast.
Cc: mesa-stable
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reported-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
(cherry picked from commit e4520b1dda)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Otherwise, we'll only mark the first location for matrix and array
variables. Ideally, someone would split these before we get here but we
should at least be correct.
Cc: mesa-stable
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
(cherry picked from commit 871875d0ce)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
This is what the JM code is doing and it lets us assume we always have a
fragment shader. Right now, we're already making that assumption, we
just haven't been bitten by it yet because no one has tried to use a
shader-requiring blend configuration with no FS yet.
Cc: mesa-stable
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
(cherry picked from commit 9cab0c4bf0)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Since the move to MEMORY_*_LOGICAL the result value was being ignored, so
change to use that.
Since the conversion to use new registers, some issues were introduced:
- Even with `has_64bit_int` ADD with 64-bit immediate value is not supported;
- `dst_high` was not being filled if there was no overflow;
- Only `dst_low` returned.
Found when writing some new code involving large block loads.
Fixes: b79e85a93f ("brw: always use new registers for load address increments")
Fixes: b55f77161d ("intel/brw: Switch to emitting MEMORY_*_LOGICAL opcodes")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
(cherry picked from commit b542ac4ca0)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
vi_bindings_valid doesn't necessarily match the # of VBOs emitted,
resulting an invalid size in the CP_SET_DRAW_STATE packet. Somehow
this didn't seem to cause problems prior to Dxx (although may
potentially have been a source of flakes, depending on what random
cmds followed in memory). But caused hangs on Dxx.
See, for example, dEQP-VK.pipeline.fast_linked_library.vertex_input.misc.unused_binding
Fixes: 97da0a7734 ("tu: Rewrite to use common Vulkan dynamic state")
Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
(cherry picked from commit 63243bcc3e)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
This fixes a llvm validation error seen in dEQP-VK.robustness.robustness2.push.notemplate.rgba32f.dontunroll.nonvolatile.sampled_image.no_fmt_qual.img.samples_1.1d_array.rgen
Cc: mesa-stable
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
(cherry picked from commit 1e59dbf66b)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
When suboptimal is returned, the fence payload is missed to be installed
unexpectedly. Instead, we can directly return errors from sync import.
With this change, dEQP-VK.wsi.xcb.maintenance1.release_images.* can pass
robustly now.
Fixes: a312bb4285 ("venus: refactor wsi acquire to use semaphore and fence SYNC_FD import")
(cherry picked from commit c8c6ee1dd7)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
panfrost_emit_image_attribs is only called when the context's image
state is dirtied and uses the context's image_mask to write attributes
and attribute buffers.
However, it uses the shader's attribute_count (which in this context is
the last bit of the shader's images_used) to calculate the size of the
buffers.
In case more images are bound than the currently bound shader uses, this
would lead to out-of-bounds writes.
This change updates the allocation to use the last bit in the context's
image_mask for size calculations.
It also removes an unused parameter from emit_image_bufs and updates a
parameter name in emit_image_attribs to be more descriptive and match
the documentation.
Fixes: dc85f65e05 ("panfrost: emit shader image attribute descriptors")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
(cherry picked from commit cdaf6b5d5e)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
`_mesa_delete_program` and `_mesa_reference_program_` both use fields
in `sh` without determining whether `sh` or `arb` is valid. Herein
lies the problem. I cannot see any reliable way to determine which is
valid without knowing what call path you are in.
There are two possible methods, but neither seems particularly
reliable. We could check whether `shader_program` is `NULL`, or we
could check whether `Parameters` (only used for ARB assembly shaders)
is `NULL`.
Instead of doing that, I chose to add a new field that captures the
`is_arb_asm` parameter already passed to `_mesa_init_gl_program`. This
seemed the most reliable. It is possible that more
`assert(!prog->is_arb_asm)` and `assert(prog->is_arb_asm)` should be
sprinkled throughout the code base.
I don't know how this has not already been a problem. Starting with
492a176cbb ("util: increase SHA1_DIGEST_LENGTH to 32
(BLAKE3_KEY_LEN)"), I observed segfaults in
`_mesa_uniform_detach_all_driver_storage` while freeing ARB assembly
shaders. Those shaders should never hit this path.
Not all assembly shaders hit this path. In fact, **nothing** in the
open shader-db encounters this problem. This is presumably why
pre-merge CI didn't catch this problem. In my closed shader-db,
shaders from the following applications hit this:
- rocketbirds-hardboiled-chicken
- shadowrun-returns
- windward
- ziggurat
I believe it was just blind luck that most of the time the fields of
`sh::data` that were access through this path, `sh::BindlessSamplers`,
and `sh::BindlessImages` happened to line up with fields of `arb` that
contained `NULL`. Changing the size of the hash key changed that luck.
Fixes: ca16c271fa ("mesa: make struct in gl_program a union and remove FIXME")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 884cf1d39e)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Not sure how we missed this, but we need the declaration here. This
probably only worked because of transitative includes, which we shound't
rely on.
Fixes: 82fad3f258 ("pvr: Enable PBE_FILTERABLE_F16")
Reviewed-by: Ashish Chauhan <ashish.chauhan@imgtec.com>
(cherry picked from commit ae6ddec410)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
This helper is shorter and it also caches the result in the collect
cache so it can be used as a vector (or, in this case, a 64-bit value).
Cc: mesa-stable
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
(cherry picked from commit 87f924d91f)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
tu_render_pass_state_merge checks if lrz_disable_reason is NULL,
but it wasn't initialized to NULL.
Fixes: d6684aedf4 ("tu: Track at which draw call LRZ is disabled")
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
(cherry picked from commit d5199e2d29)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
PIPE_VIDEO_VPP_PRI_RESERVED0 and PIPE_VIDEO_VPP_TRC_RESERVED0 have value 0,
and this is what we will get from apps that doesn't set primaries and transfer
characteristics at all.
Fixes: a284bff8ad ("frontends/va: Set color properties when not using explicit color standard")
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
(cherry picked from commit 1395d806ba)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Preamble save/restore for BINs doesn't handle PC_TESS_BASE, so we
assume that PC_TESS_BASE is invalid after any GMEM pass.
In addition on A7XX PC_TESS_BASE doesn't require WFI.
Fixes misrendering on A750 in "Industria", "Resident Evil 2" and
any other game that uses tesselation.
Cc: mesa-stable
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
(cherry picked from commit 12416c9fca)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Each group of 16 lanes inside a SIMD32 shader will load different globals.
In SIMD8/16 shaders, the divergence analysis will turn this load into
nir_load_global_constant_uniform_block_intel.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
(cherry picked from commit 527ae448e5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
We were only accounting for the multiview mask when the fragment stage
was present causing wrong cached shaders to be possibly used.
This fixes
"dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.*_multiview"
failures.
Signed-off-by: Mary Guillemard <mary@mary.zone>
Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
(cherry picked from commit 9a6c57b5c7)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
This is no longer necessary because we're not building Cuttlefish in the
container anymore.
This reverts commit 92488c4598.
Fixes: 0e80e831f8 ("ci/android: Use prebuilt cuttlefish packages from ci-deb-repo")
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
(cherry picked from commit 8c5cf0c720)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Without this, nir_algebraic.py was treating "f2i{int_sz}_sat" as the
literal opcode name when it should have been "f2i8_sat" or similar.
Fixes: c49d6e0480 ("nir/algebraic: Elide range clamping of f2u sources")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
(cherry picked from commit d4a87e85b3)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
The users of exportable might have different expectations for what can
be exported, and some are more tight. So we need a new exportable_dmabuf
flag to track where dmabuf is actually needed.
If the underlying driver does not advertise dmabuf extension, requesting
dmabuf export violates the spec VU:
> VUID-VkMemoryGetFdInfoKHR-handleType-00671
>
> handleType must have been included in
> VkExportMemoryAllocateInfo::handleTypes when memory was created
Cc: mesa-stable
(cherry picked from commit 4f53828aa6)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
It is not actually available to all the platforms mesa can be compiled
to, so let's keep an opt-in list of supported platforms instead, and
compile it out on all other platforms.
Fixes: 48a0478126 ("zink: add renderdoc handling")
(cherry picked from commit 93390d4b73)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
fmin/fmax are not signed zero correct.
The name is taken from RDNA4's ISA, because the full IEEE name is a bit long.
Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
(cherry picked from commit f68b891a81)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Otherwise we will have width of -1 later in null_fill_state_s.
Fixes: 2eb45daa9c ("gallium: de-pointerize pipe_surface")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
(cherry picked from commit 4ac7bbb1d1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
In the case where we have a device that we want to choose after
probing, there is no point in asking the device select layer to do
any reordering at all.
This helps avoid a deadlock inside compositors where we don't need
device selection anyways.
Cc: mesa-stable
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
(cherry picked from commit 04071c5f9a)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
There are cases like zink where we have a file descriptors we are searching
for devices for, so we don't need device selecting reordering, we just want
the fastest path to get the devices so we can match them.
This also helps avoid some cases of deadlock inside compositors where
zink/vulkan initialises later and tries to connect to the compositor.
This uses a VK_EXT_layer_setting to add a bypass setting.
Cc: mesa-stable
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
(cherry picked from commit 833706e381)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
component_addr_off (in bytes) was used to offset a component index (in dwords).
Cc: mesa-stable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
(cherry picked from commit 3552028e87)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Currently the image creation failure handling codepath of
wsi_headless_surface_create_swapchain() just calls
wsi_headless_swapchain_destroy() , which will try to destroy all
`image_count` of images. However, some of these images might never be
successfully created because of the failure, which leads to double-free.
Set image_count to the number of successfully created images before
calling wsi_headless_swapchin_destroy() to prevent over-destroying.
Fixes dEQP-VK.wsi.headless.swapchain.simulate_oom.* on lavapipe and pvr,
although some of the tests got QualityWarning saying "Creating swapchain
did not succeed, callback limit exceeded" on lavapipe (Pass on pvr).
Cc: mesa-stable
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
(cherry picked from commit e8c81652c9)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
The code originally disabled reuse whenever a pNext was passed to
`bo_create_internal`, however code has been added before it that messed
with the pointer disabling it more often that necessary.
Rearrange code to restore the original check.
cc: mesa-stable
(cherry picked from commit 6a68542167)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>