Commit graph

207788 commits

Author SHA1 Message Date
Boris Brezillon
dad53edc9c pan/layout: Relax alignment constraints on pre-v7 for imports of linear/u-tiled
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>
2025-06-25 12:10:37 +02:00
Boris Brezillon
25059a4576 pan/layout: Fix get_plane_blocksize()
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>
2025-06-25 12:10:37 +02:00
Boris Brezillon
1389a23708 pan/layout: Fix size_B calculation for AFBC(3D)
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>
2025-06-25 12:10:37 +02:00
Boris Brezillon
a6ba8019d4 panvk: Check the return of pan_image_layout_init()
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>
2025-06-25 12:10:37 +02:00
Boris Brezillon
e25a91d919 panvk: Lower maxImageDimension{2D,3D,Cube} to match the HW caps
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>
2025-06-25 12:10:37 +02:00
Boris Brezillon
c4f1dd1e2d panvk: Make sure we don't use AFBC on images that are too big
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>
2025-06-25 12:10:37 +02:00
Boris Brezillon
700f179bc8 panfrost: Let ::can_create_resource() report when the layout init failed
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>
2025-06-25 12:10:37 +02:00
Boris Brezillon
4c9d3bc171 panfrost: Make sure we don't use AFBC on resources that are too big
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>
2025-06-25 12:10:37 +02:00
Boris Brezillon
737fc5d3c1 pan/genxml: Make sure we catch overflows on 32-bit integer fields
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>
2025-06-25 12:10:37 +02:00
David Rosca
189bf9fe9a radv/video: Prefer visible VRAM for host visible context buffers
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
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>
2025-06-25 09:39:11 +00:00
Christoph Pillmayer
f5498fda2a panvk: Fix occlusion query oq_chain order
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>
2025-06-25 08:15:54 +00:00
Christoph Pillmayer
d1448e3243 panvk: Add cs_single_link_list
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>
2025-06-25 08:15:54 +00:00
Samuel Pitoiset
2d4b4a296e radv: move pipeline layout implementation to radv_pipeline_layout.c/h
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35708>
2025-06-25 07:52:12 +00:00
Samuel Pitoiset
46f78b40f0 radv: simplify add_descriptor_set()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35708>
2025-06-25 07:52:12 +00:00
Samuel Pitoiset
f5a71a1262 radv: rename border_color_slot to border_color_index
To match future work.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35708>
2025-06-25 07:52:12 +00:00
Samuel Pitoiset
c08a97633c radv: remove an useless check about custom border color
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>
2025-06-25 07:52:12 +00:00
Martin Roukala (né Peres)
7272323d48 zink/ci: run glcts and piglit on NVK's ad106
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35546>
2025-06-25 07:34:51 +00:00
Martin Roukala (né Peres)
15111a6e36 nvk/ci: run on our jobs on ad106
We currently only have 2 hosts with RTX 4060 GPUs, with more expected
to be added in a near future in order to enable pre-merge testing for
NVK.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35546>
2025-06-25 07:34:51 +00:00
Martin Roukala (né Peres)
dfecd38519 nvk/ci: uprev the kernel to v6.16-rc2
This allows us to use the GSP v570 which has been reported to be more
stable than the previous v535.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35546>
2025-06-25 07:34:51 +00:00
Martin Roukala (né Peres)
d1e9b56dd1 nvk/ci: split the common ci-tron parts to their own job
This will allow us to add new DUTs without duplicating the driver-level
variables.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35546>
2025-06-25 07:34:51 +00:00
Valentine Burley
a7f970ee6d zink/ci: Add glcts and piglit job on Cezanne with RADV
AMD Cezanne is Vega, where we already have radeonsi coverage on Raven.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35682>
2025-06-25 07:09:08 +00:00
Valentine Burley
fc9dbe4e01 zink/ci: Rename zink-radv Valve rule to make it unambiguous
Also drop redundant build-piglit.sh rule, as changes to .gitlab-ci are
already tracked by the core rules.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35682>
2025-06-25 07:09:07 +00:00
Valentine Burley
57f97ad64a radeonsi/ci: Add glcts and piglit job on Mendocino
Like Van Gogh, Mendocino is RDNA 2. This new job is intended to replace
the existing radeonsi-vangogh-glcts job, which couldn't run the full
test suite pre-merge.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35682>
2025-06-25 07:09:07 +00:00
Valentine Burley
e5323ff07b radeonsi/ci: Rename radeonsi Collabora rule to make it unambiguous
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35682>
2025-06-25 07:09:06 +00:00
Valentine Burley
1e31ebc21e radeonsi/ci: Move full radeonsi-stoney-glcts-piglit job to pre-merge
The full job previously ran in the nightly pipeline, but its runtime is
within the recommended 10-minute limit reported by deqp-runner. This
allows us to run it pre-merge and remove the separate nightly job.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35682>
2025-06-25 07:09:05 +00:00
Georg Lehmann
1819e1caef radv: keep fp8 conversions vectorized
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Totals from 11 (0.01% of 80265) affected shaders:
MaxWaves: 102 -> 104 (+1.96%)
Instrs: 24105 -> 21027 (-12.77%)
CodeSize: 190744 -> 167480 (-12.20%)
VGPRs: 1968 -> 1920 (-2.44%)
Latency: 91890 -> 90302 (-1.73%); split: -2.86%, +1.13%
InvThroughput: 100616 -> 98496 (-2.11%); split: -2.24%, +0.13%
VClause: 802 -> 759 (-5.36%); split: -6.48%, +1.12%
Copies: 3131 -> 3329 (+6.32%); split: -0.48%, +6.80%
PreVGPRs: 1816 -> 1802 (-0.77%)
VALU: 12543 -> 11399 (-9.12%)
SALU: 4635 -> 2859 (-38.32%)
VOPD: 1133 -> 1195 (+5.47%); split: +7.33%, -1.85%

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35676>
2025-06-25 05:34:48 +00:00
Georg Lehmann
e6d208b1f9 nir/opt_shrink_vectors: also split vecs into distinct smaller vecs if possible
Foz-DB Navi48:
Totals from 17 (0.02% of 80265) affected shaders:
Instrs: 75085 -> 74912 (-0.23%); split: -0.23%, +0.00%
CodeSize: 428968 -> 427028 (-0.45%); split: -0.45%, +0.00%
Latency: 1306841 -> 1306080 (-0.06%); split: -0.06%, +0.00%
InvThroughput: 598998 -> 598719 (-0.05%)
Copies: 15733 -> 15561 (-1.09%)
Branches: 2435 -> 2422 (-0.53%)
PreVGPRs: 1723 -> 1721 (-0.12%)
VALU: 43019 -> 42847 (-0.40%)

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35676>
2025-06-25 05:34:48 +00:00
Georg Lehmann
22d7dd69b2 nir/shrink_vectors: shrink larger vectors too
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35676>
2025-06-25 05:34:48 +00:00
Iván Briano
d964b8d5fa anv: don't report custom sample locations for sample count 1
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
We can't actually enable MSAA for images with sample count 1, and
without MSAA active, the sample location machinery does not get used.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35504>
2025-06-24 19:44:34 +00:00
Eric Engestrom
127926977a lavapipe/ci: explicitly state in the job name which test is being run
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35683>
2025-06-24 19:24:45 +00:00
Eric Engestrom
7f66823fd7 lavapipe/ci: move job timeout definition to jobs
The `.lavapipe-rules` job template cannot know what the job will run and how long it will take.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35683>
2025-06-24 19:24:45 +00:00
Eric Engestrom
686b774952 lavapipe/ci: drop redundant .lavapipe-rules in .lavapipe-test
All the jobs (except two, fixed here) already re-specify whether they
want `.lavapipe-rules` or `.lavapipe-manual-rules`, so drop this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35683>
2025-06-24 19:24:44 +00:00
Eric Engestrom
90439f6af5 lavapipe/ci: promote vkd3d job from nightly to merge pipelines
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35683>
2025-06-24 19:24:43 +00:00
Eric Engestrom
afc0b7bed3 lavapipe/ci: drop unneeded MESA_VK_IGNORE_CONFORMANCE_WARNING
The non-conformance warning on lavapipe was removed 3 years ago, in
bfebf51571 ("lavapipe: state latest conformance tests passed")

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35683>
2025-06-24 19:24:43 +00:00
Eric Engestrom
9d970a442c lavapipe/ci: drop redundant stage:
It's already defined by `.lavapipe-rules`/`.lavapipe-manual-rules`.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35683>
2025-06-24 19:24:42 +00:00
Caterina Shablia
3653085b45 panvk: add panvk_as_alloc and panvk_as_free helpers
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
In panvk we often need to allocate and free address ranges in the
address space represented by panvk_device::as::heap. In most
situations, panvk_device::as::lock has to be held while performing
an operation on panvk_device::as::heap, so there are a lot of
instances of exactly the same 3 locs locking the as::lock,
allocating or freeing a range in as::heap, and unlocking the lock.
These helpers are the less verbose replacements for these 3 locs
that should be used going forward.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35692>
2025-06-24 18:53:04 +00:00
Caterina Shablia
e16d4b3eba panvk: move panvk_image_plane_bind to the beginning of the file
We'll need this function in panvk_CreateImage in order to implement
sparse images.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35692>
2025-06-24 18:53:04 +00:00
Caterina Shablia
09814eb32a panvk: prepare for multiple queue types
Make the queue entry points forward to the implementations
appropriate for the queue's type.

Rename panvk_queue to panvk_gpu_queue.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35692>
2025-06-24 18:53:04 +00:00
Boris Brezillon
33060373c0 panvk: Make panvk_device.{c,h} panvk_queue agnostic
We will soon have a panvk_bind_queue object to expose bind queues,
so let's modify the code to make this reasonably clean by letting
the CSF/JM backing keep their queue object opaque.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Caterina Shablia <caterina.shablia@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35692>
2025-06-24 18:53:04 +00:00
Yiwei Zhang
4d972bce5b venus: use more common wsi codes
This has been unblocked a while back after common queue adoption.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35705>
2025-06-24 18:38:32 +00:00
Yiwei Zhang
25d7c6cd4d venus: relocate tls ring hint from wsi init to queue submission
This ensures synchronous shader compilation doesn't occur on most render
threads.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35705>
2025-06-24 18:38:32 +00:00
Adrián Larumbe
cf4a137459 panfrost: Add missing util_range_init()
It was absent when initialising a panfrost_resource from a winsys handle.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Fixes: 7da251fc72 ("panfrost: Check in sources for command stream")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224>
2025-06-24 18:11:09 +00:00
Adrián Larumbe
b351600436 panfrost: Implement pipe screen's resource_label interface
Extend the panfrost resource screen interface with a function that lets
the pipe resource the BO belongs to share a label pointer for debugging
purposes.

Then append this resource label to the existing driver tag and label the
backing kernel BO accordingly.

A panfrost_resource::user_label field was added to store the argument
user label. Because in the case of an AFBC-packed resource, user tagging
can happen before the packed BO is created, we need to store it
separately, so that all the necessary label fields are available before
a complete label can be given to the kernel driver.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224>
2025-06-24 18:11:09 +00:00
Adrián Larumbe
a4ffd2395f mesa: Implement label sharing from GL objects with UM drivers
At the moment, the string passed to glObjectLabel() stays only within the
confines of GL objects. It would be nice if that textual description could
be made known to the underlying drivers somehow.

Expand the pipe screen function interface to allow passing GL object labels
down to the UM driver that handles a particular pipe screen.

Not all GL objects have an associated GL resources, so this behaviour has
been implemented for those which are associated with at least one.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224>
2025-06-24 18:11:08 +00:00
Adrián Larumbe
3bd0e58d66 panfrost: Expand BO label for panfrost resources
When creating a BO that backs a panfrost resource, append additional
information. To this end, add a new helper that composes it from
a base resource label and some parameters of interest.

To avoid dealing with situations in which a BO is referenced by multiple
resources, we only allow the BO creator to claim ownership at resource
creation time. There are, however, code paths in which a panfrost
resource's BO is assigned from an existing resource. In those cases, we
transfer ownership between resources.

In those cases, we assign the old BO a label in static memory without
passing it down to the kernel, because in a majority of times that BO
will immediately reach a refcnt of 0, leading to its destruction. That
way we avoid a useless round-trip to the kernel through the BO labelling
ioctl().

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224>
2025-06-24 18:11:08 +00:00
Adrián Larumbe
0f22729d51 panfrost: Flag resources with imported BOs
In preparation of a future commit in which UM will be able to pass
down a label from the GL layer and append it to the existing BO's driver
label, we want to disallow resource handling of imported BO labels.

To this end, add a boolean flag to the panfrost_resource definition so
that future commits can take this into account when managing resource
labels.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224>
2025-06-24 18:11:08 +00:00
Adrián Larumbe
b9b1c5438e panfrost: Label kernel BO's for newly created objects
To this end, provide a helper that passes the label to the kmod layer
upon demand. Helper returns the old label, in preparation for future
commits in which the label might not be in static RO memory, but
dynamically alocated instead, and its lifetime managed by the resource
layer.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224>
2025-06-24 18:11:07 +00:00
Adrián Larumbe
32b128be01 panfrost: Fix Panfrost BO leak in error handling path
When panfrost_resource_init_afbc_headers() fails, freeing the newly
created resource is not enough, because we need to unreference its BOs.
This will also take care of freeing its resource label.

Also replace instances of FREE() in error-handling paths with
panfrost_resource_destroy(), as it is capable of handling partially
initialised resources.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Fixes: e3f2bc7963 ("panfrost: handle mmap failures")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224>
2025-06-24 18:11:07 +00:00
Adrián Larumbe
28c43385d1 pan/kmod: Add Panfrost BO Labeling IOCTL support
Implement kmod->ops->bo_label operation for Panfrost kmod driver.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224>
2025-06-24 18:11:07 +00:00
Adrián Larumbe
a05b6829c8 pan/kmod: Add Panthor BO Labeling IOCTL support
Implement kmod->ops->bo_label operation for Panthor kmod driver.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34224>
2025-06-24 18:11:07 +00:00