GLSL 4.60 spec, section 4.3.6: output variables
should behave like private variables during shader
execution. Framebuffer fetching now also checks
that fb_fetch_output is set on the variable.
cc: mesa-stable
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31047>
this was accidentally duplicated from the conditional below,
except this one didn't have the buffer_stride_unaligned
caps check, which meant any 4-byte attrib which was
unaligned got marked for rewrites even on drivers
supporting unaligned strides
the correct change should have checked the stride against
the component size in the top case
Fixes: 7672545223 ("gallium: move vertex stride to CSO")
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31425>
vk_image.h has these guards, and any non-{Linux}/{BSD}
compile would hit this issue.
The alternative is just to remove the OS-specific guards
in vk_image.h, since the modifier is just 64-bit opaque
number and theoretically can work on any OS, though the
non-Linux spec language is lacking.
Acked-by: Rob Clark <robdclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31453>
Newer versions of the blob don't seem to expose linear features for VK_FORMAT_D32_SFLOAT_S8_UINT,
but they advertise VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT for more formats now.
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31304>
Turnip supports VK_KHR_format_feature_flags2 but has been using a mixture of VK_FORMAT_FEATURE and
VK_FORMAT_FEATURE_2 flags. Always use the new 64-bit flags.
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31304>
Assign the feature bits for depth formats and VK_FORMAT_*_PACK16 earlier.
If we configure their optimalTilingFeatures before we copy those over to linearTilingFeatures
we don't have repeat them.
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31304>
Add and use a new helper function, tu_aspects_to_plane, that combines tu6_plane_index and tu6_plane_format.
This allowed for spotting and fixing a copy-paste mistake in tu6_blit_image, in dst_format for D32_S8.
The existing code wouldn't return the right dst_format if you blitted an S8 image to the stencil aspect
of a D32_S8 image, which should be a legal thing to do.
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31304>
Use existing helpers for deciding the VK format to treat our data as for memcpy-style blits.
No need to special case these a second time when it's already done in our helpers.
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31304>
Only call tu6_plane_format for VK_FORMAT_D32_SFLOAT_S8_UINT in tu_image_view_init.
vk_format is always a single plane format here but checking the aspect mask wasn't enough.
It was possible for e.g. R8_UNORM to not have VK_IMAGE_ASPECT_COLOR_BIT apsect mask but a
PLANE aspect mask in formats like G8_B8_R8_3PLANE_420_UNORM.
This was masked by the default case in tu6_plane_format, which just returned vk_format_to_pipe_format
anyway without checking the plane index.
We need to fix this for when we switch tu6_plane_format to using vk_format_get_plane_format, where we
would otherwise trip an assert.
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31304>
Use ycbcr_info instead of checking the layout or the format directly.
Swap the order of the if statement for clarity.
These should make the code significanntly easier to read.
Also document Chia-I's findings on SEPARATE_RECONSTRUCTION_FILTER_BIT.
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31304>
This kernel unmask all the MMU errors, so it gives us more visibility
for driver issues.
Reviewed-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31445>
This prevents folding something like this:
add.u hrA, hrB, hrC
mov.u8u32 rD, hrA
When I wrote this I assumed that because the conversion source and ALU
destination were the same register that meant the types must have the
same size, but that's not the case with u8 which is an 8-bit type in a
16-bit register, so this could've been broken with 8-bit types.
Fixes: f58e1ef7ec ("tu: enable shaderInt8 support")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31399>
The kmod layer allocates memory through the vulkan allocator for its
internal objects. When the allocation fails, we should return
VK_ERROR_OUT_OF_HOST_MEMORY, and the
dEQP-VK.api.object_management.alloc_callback_fail.* tests check this.
Generalize the errno trick we have and hide it behind panvk_error[f]()
macros, which serve as a replacement for vk_error[f]().
We also catch allocation failures in the panvk_cmd_alloc_xxx() path
so we can report the right error on the command buffer.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
Knowing that a private BO couldn't be allocated is not enough, in some
situations we need to know why. Rework the panvk_priv_bo_create() to
return a VkResult.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
panvk_pool_cleanup call was missing.
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Fixes: 7049d31676 ("panvk: Add a read-write non-cached memory pool for CSF events"
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
Vertex shaders can have up to three different program descriptors. Free
all of them in panvk_shader_destroy().
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
panvk_per_arch(queue_init)() can fail, and we need to undo the
initialization only on queues that were properly initialized.
In order to do that, increment queue_count only after the
initialization succeeds, and adjust the test in the error path to not
leave an allocated but non-initialized panvk_queue object behind.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
Fixes a memory leak reported by
dEQP-VK.api.object_management.alloc_callback_fail.device_group.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
We need to update resolve_info to point to the stencil resolve info,
otherwise it's still pointing to the depth resolve info.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
vk_image_view::extent is adjusted to take non-compressed views of
compressed images into account, so let's use it instead of calling
vk_image_mip_level_extent() on the image.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
Allocation of the texture payload can fail, we need to report
VK_ERROR_OUT_OF_DEVICE_MEMORY in that case.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
Allocations done in panvk_shader_upload() can fail. Add NULL checks so
we don't silently ignore such allocation failures.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
Texture is aligned on 32-byte, which matches the plane or multiplanar
surface descriptor constraint, and exceeds the surface descriptor one,
but let's be accurate and use the right descriptor alignment.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
We don't depend on it, and panvk_vX_blend.c already includes it.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
We shouldn't reset errno when the allocation succeeds, otherwise we might
be overriding previous allocation failures.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
panthor_kmod_vm_bind() is usually called with a single op and at most
one sync, so let's optimize the low-number-of-ops-or-syncs case to
avoid transient heap allocation.
This also fixes some dEQP-VK.api.object_management.alloc_callback_fail.*
crashes where panthor_kmod_vm_bind(UNBIND) is called and not expected
to fail.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31382>
Otherwise, we could end up with phis of derefs.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Fixes: 6b4b044739 ("nir/opt_loop: add loop peeling optimization")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31324>
Rename it to SmallVec, make it more generic and switch NAK
to it.
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31409>