If two devices/instances are created, the VMID reservation will just
fail. It seems fine as long as it's reserved before SPM is used.
Fixes: a7a4abc8d8 ("radv: Move VMID reservation to vkCreateDevice")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Those outputs are never compact in GLSL mesh shaders. The assertions might
not be needed.
Cc: mesa-stable
Reviewed-by: Qiang Yu <yuq825@gmail.com>
(cherry picked from commit bba2536bb0)
Conflicts:
src/compiler/nir/nir_lower_clip_cull_distance_array_vars.c
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Missing f in other cases seems to be caught either elsewhere in the
script or by the C compiler.
Fixes: c49d6e0480 ("nir/algebraic: Elide range clamping of f2u sources")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
(cherry picked from commit aba079b3af)
Conflicts:
src/compiler/nir/nir_algebraic.py
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Comparing the ctx values and then updating the refcounts is not
thread-safe so add an assert to make sure the ctx wasn't updated
by another thread (via detach_ctx_from_buffer).
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 090f4d9a5d)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
This reverts commit 45b6aa1eb7.
This is not thread safe and will lead to buffer leaks, eg:
[threadA] _mesa_reference_buffer_object_ ctx=0x60bc07fa33f0 buf=0x60bc09b90020 CtxRefCount-=993187
[threadB] _mesa_glthread_release_upload_buffer ctx=0x60bc07fa33f0 buf=0x60bc09b90020 ref=7768 CtxRefCount=993212 -> 954
[threadB] _mesa_glthread_upload ctx=0x60bc07fa33f0 buf=0x60bc09eb7d00 CtxRefCount=1000000
[threadA] _mesa_reference_buffer_object_ ctx=0x60bc07fa33f0 buf=0x60bc09b90020 CtxRefCount-=993186
../src/mesa/main/bufferobj.h:201: _mesa_reference_buffer_object_: Assertion `oldObj->Ctx == ctx' failed.
The assert is one added by the previous commit.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14483
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 68ef044b3b)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Add pipe format to sized internal format mappings for R32F,
RG32F and RGBA32F in the DRIImage format table. This fixes shader
image store operations on EGL images imported from DMA-BUF with
respective DRM formats.
Without these mappings, DMA-BUF imported textures received base internal
formats instead of sized internal formats, causing shader image unit
validation to fail and DispatchCompute write zeroes on compute shader
imageStore operation.
Fixes: 6d3f266406 ("dri: Add additional 16/32b float/int formats")
Signed-off-by: Lakshman Chandu Kondreddy <lkondred@qti.qualcomm.com>
(cherry picked from commit ffb5d5d224)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
ANV can return different memory requirements with and w/o the ALIAS bit.
See https://gitlab.freedesktop.org/mesa/mesa/-/issues/14671 for details.
Meanwhile, venus has a driver side cache for image memory requirements.
As blessed per spec for memory aliasing, venus strips the ALIAS bit when
populating the cache key. Because of the use of imageless mem req query,
the ALIAS mem req now can hit the cache first, leaving a smaller/relaxed
requirement in the cache...busted.
Venus is unable to fix ANV behavior behind the scene, so this workaround
is only to align Venus behavior with ANV to not suffer from Venus-only
rendering artifacts.
Cc: mesa-stable
(cherry picked from commit c2c9266fed)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
The Function glInternalReleaseBufferMESA is called whenever a
intermediate buffer is used by MESA internal and being released, however
it's only exported for GLES3, which leads to drawing w/o VBO not
operational for GLES1/2.
Fixes invalid operation warning in `glmark2-es2 -b build:use-vbo=false` for
GLES2 HW / any HW with MESA_GLES_VERSION_OVERRIDE=2.0 .
VBO-less drawing is possible for GLES 1.0 too, so this function is also
exported with GLES1. Tested on GLES1 with mesa-demos gears demo with
VBO allocation commented out.
Fixes: ae75b59cb5 ("glthread, tc: Fix buffer release with glthread and tc")
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
(cherry picked from commit ba43568f4b)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Kopper draw codepath calls an internal helper called
InternalInvalidateFramebufferAncillaryMESA, which is currently only
exported for GLES3 contexts.
This leads to a warning when the underlying Vulkan driver capability
isn't enough for GLES3 or GLES version number is forced to 2.0 or the
program is a GLES1 one.
Export this internal helper for GLES1/2 too.
Fixes: 0c7994bb2d ("mapi: add InternalInvalidateFramebufferAncillaryMESA")
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
(cherry picked from commit f1d199285a)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Mesa internally converts some draw calls to DrawArraysInstancedBaseInstance
or DrawElementsInstancedBaseVertexBaseInstance, which are only available
in GLES contexts via GL_EXT_base_instance, a GLES3-only extension.
Export these two functions into the internal namespace for GLES 2.0
contexts too.
This fixes black screen for `glmark2-es2 -b build:use-vbo=false` (which is
the first test item for glmark2 auto test sequence) on GLES 2 HW / GLES
3 HW with MESA_GLES_VERSION_OVERRIDE=2.0 .
Fixes: 7c1f8b63ad ("glthread: work around GL_INVALID_OPERATION with OpenGL ES 1.x draws")
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
(cherry picked from commit 2c770a8dce)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
We need to support this if we advertise KHR_swapchain_maintenance1
Cc: mesa-stable
Signed-off-by: llyyr <llyyr.public@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
(cherry picked from commit c3763b12e2)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
Similar to last MR, since we advertise support for
KHR_swapchain_maintenance1, we need to advertise this
Cc: mesa-stable
Signed-off-by: llyyr <llyyr.public@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
(cherry picked from commit a1dd7eec87)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
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>