Advertise support for VK_EXT_robustness2 with only the nullDescriptor
feature enabled.
Except for index buffers, the same implementation should work for v9 as
well.
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35609>
When loading the texure/image glsl builtins from a descriptor, we
currently apply modifiers to account for the stored value. This does not
work for nullDescriptors.
Therefore, check whether the Descriptor Type field is set to zero, which
would indicate a nullDescriptor, and if so directly return zero.
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35609>
Adds support for nullDescriptors in PanVK by memsetting the relevant
descriptors to zero. This is valid for v9+.
Note that vertex/index buffers require special handling in order to rely
on out-of-bounds behavior.
For index buffers specifically, the approach is only valid for v10+, as
v9 does not have a way to specify index buffer size.
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35609>
Some layout related helpers are being passed images subfields. Let's
make things consistent by always passing an image, plus extra parameters
to specify which part of the image is addressed.
While at it, move these helpers protypes/definitions to pan_image.h.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
There are a few operations that are modifier specific. Instead of
spreading the
if (is_mod_x) do_x
else if (is_mod_y) do_y
...
pattern, let's add the concept of mod handler so we can abstract away
these operations and get rid of some boiler-plate.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Now that pan_layout_init() has been fixed to report the correct
slice size, we can do what the comment says and allow AFBC(3D)
on v7+.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
AFBC is different from other modifiers (AFRC, u-tiled and linear) in that
metadata is placed in a separate memory section that needs to be properly
sized/aligned. This forces us to have header/body (or metadata/payload)
info stored at the layout level if we don't want to recalculate one
from the other everytime we need to fill descriptors.
Those properties were already present, but some of them were encoded in
non-afbc prefixed fields which makes things very confusing. Let's clarify
that by moving AFBC properties to their own struct, and move the
previously generic {row,surface}_stride_B to a tiled_or_linear struct.
We use a union to combine both.
With this sanitized semantics, we can fix some inconsistencies in our
AFBC layout initialization, hence the functional changes to
test-layout.cpp.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
We were leaving the depth to zero, but the layout code expects a depth
of at least one.
Add an assert() in pan_image_layout_init() to catch this in the future.
Fixes: 916f75a2a6 ("pan/layout: Test WSI import behavior on all supported format/mods")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
pan_image_layout_constraints::strict only applies to imports of AFBC/AFRC
resources. Linear/tiled imports are already strict, and any new modifier
addition should be strict too.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Now that things are handled per-modifier at the pan_layout level, there's
no good reason to keep those helpers.
The BlockSize.Linear test is dropped, since blocksize is assumed to be
<1,1> all the time.
panfrost_resource_create_with_modifier() is changed to make use of the
pan_image_get_wsi_row_pitch() helper to calculate the DUMB_BUFFER
stride/width.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Prepare for mod handlers by splitting the layout logic per modifier.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Expose a pan_format_get_planed_blocksize() so we don't have to duplicate
the logic in test-layout.cpp.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Those are just pan_afbc_{render,super}block_size_el() but with the
size returned in number of elements instead of pixels. This is only
relevant for YUV-formats whose block extent is bigger than one pixel.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
For AFBC images it's not clear what the offset/stride refers to (header
or body). Let's clear the confusion by dropping the helper and letting
the callers dereference the layout directly.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
No longer used, get rid of it.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Will be needed for the pan_mod_handler abstraction we'll introduce later
on.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
We use specialized plane descriptors now almost everywhere except when
we want to get the plane descriptor size, and we can use a null plane in
that case, so let's get rid of the old definitions.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
This is a preliminary step to allow delegating texture payload emission
to a modifier handler.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
It makes it easier to decipher when reading a dump, and it will also
make overlapping fields impossible to set twice once we've converted the
texture logic to use those.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Let's stay consistent with the rest of the afxc helpers and
prefix this helper with pan_afxc.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
This is actually 64 byte on Midgard. This makes pan_afbc_body_align()
and pan_afbc_header_align() return the same value, so let's define
one as a wrapper around the other.
Not flagged as a fix because pan_image_layout() init is handling AFBC
header alignment properly on Midgard already, but we want that fixed
to cleanup the image layout logic.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Pick the same names we use on v9+ for the "Render Target AFBC Overlay"
properties that exist on v5+ too.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Those fields are only used for AFBC packing which has deep knowledge
of AFBC layouts and can easily recover the row_stride/size in superblock
from other layout fields.
By getting rid of these two fields we also reduce the number of ways we
can express the same information, which makes things less confusing
overall.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
As things are now, the pan_image_slice_layout::{offset,size}_B calculation
can exceed UINT32_MAX, and we silently droppin the upper 32-bit on the
floor. Same goes for the crc offset. Let's use a uint64_t to make sure
that doesn't happen.
While at it, move the two 64-bit field next to each other to avoid
padding, and document what size_B encodes.
It's hard to find the commit that introduced the problem with all the
code motion that happened this this struct was introduced, so I'll
just flag for backport.
Backport-to: 25.1
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Commit f64a7c1506 ("pan/layout: Check the wsi_layout consistency in
wsi_row_pitch_to_row_stride()") introduced stricter alignments on pre-v7
for linear/tiled imports. It turns out alignment constraints on pre-v7 are
weaker than they are on v7+, and this got lost in the refactoring.
Let's fix linear_or_tiled_row_align_req() helper so we can import images
that don't have their base address/row_pitch aligned on a cacheline, and
only cacheline alignment for images we create ourselves.
Also add unittests to make sure we don't regress that in the future.
With this being tested, we can also use
pan_linear_or_tiled_row_align_req() in offset_align_for_mod()
(test-layout.cpp) instead of open-coding it.
Fixes: f64a7c1506 ("pan/layout: Check the wsi_layout consistency in wsi_row_pitch_to_row_stride()")
Fixes: 916f75a2a6 ("pan/layout: Test WSI import behavior on all supported format/mods")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
The blocksize of for R8G8_R8G8_xxx formats is 4 bytes, not 2 bytes.
Fixes: 4d9a4e8228 ("pan/image: Teach pan_image/layout about planar images")
Fixes: 916f75a2a6 ("pan/layout: Test WSI import behavior on all supported format/mods")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Right now the headers are not counted when we calculate the total slice
size of an AFBC(3D) image. Fix that by special-casing size_B
initialization for AFBC.
I couldn't get back to the original commit introducing this mistakes,
so I'm flagging for backport instead of adding a proper Fixes tag.
Backport-to: 25.1
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Fail the image creation if the image layout initialization fails instead
of silently ignoring the problem.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
Maximum texture dimension is 2^16, but we're limited by the 32-bit
fields that are used to pass strides/sizes in various descriptors.
Assuming RGBA32_FLOAT is the biggest format we support, that gives us a
16k-1 image size for 2D and cube map, and 512 for 3D.
Change our GetPhysicalDeviceImageFormatProperties2() implementation so
that smaller formats can still advertise bigger image sizes.
Fixes: d5ed77800e ("panvk: Fix GetPhysicalDeviceProperties2() to report accurate info")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
AFBC headers point to their tile with a 32-bit offset, meaning the last
header has to cross the entire body to reach its tile, so we can't
have a body size that's bigger than UINT32_MAX.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
We will soon make pan_image_layout_init() return false even for
non-explicit layout case, which will allow panfrost_can_create_resource()
to properly report when the resource size doesn't fix some HW limits.
But before we can do that, we need to let panfrost_resource_setup()
return an error instead of asserting() that pan_image_layout_init()
always return true. Add a new panfrost_resource_try_setup() helper
and define panfrost_resource_setup() as wrapper around it with the
existing assert(valid), and make panfrost_can_create_resource() use the
new helper.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
AFBC headers point to their tile with a 32-bit offset, meaning the last
header has to cross the entire body to reach its tile, so we can't
have a body size that's bigger than UINT32_MAX.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
If we store the temporary value in a [u]int32_t, the result might be
silently truncated, making the overflow check in the u_pack helpers
useless.
Make sure we use 64-bit fields as soon as the size is greater than 31
bits to prevent that.
It forces us to fix some types in the xml and helper arguments (sint
wrongly defined as uint) and add explicit casts on u32 subtraction
whose result is stored in an s32.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
In most cases this has little to no effect, but AV1 decode on VCN5
is up to 40% slower when the context buffer is in GTT.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35684>
We were pointing the new_node.next at the previous node but trying to
iterate over the nodes starting at the first one.
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35687>
The linked list will be used to store occlusion queries to signal after a
renderpass.
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35687>
The Vulkan spec is pretty clear and says:
"VUID-VkSamplerCreateInfo-None-04012
The maximum number of samplers with custom border colors which can be
simultaneously created on a device is implementation-dependent and
specified by the maxCustomBorderColorSamplers member of the
VkPhysicalDeviceCustomBorderColorPropertiesEXT structure"
So this check can be removed because it would be an application bug
otherwise.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35708>