pan/kmod: Expose the BO flags supported by a pan_kmod_device
Will be needed to let the frontend know if it can use cached CPU-mappings, and it allows us to extend the set of supported flags without introducing a new field if we ever have to. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36385>
This commit is contained in:
committed by
Boris Brezillon
parent
7e65322c93
commit
cd8b8baf6e
@@ -102,6 +102,13 @@ enum pan_kmod_bo_flags {
|
||||
* is called.
|
||||
*/
|
||||
PAN_KMOD_BO_FLAG_GPU_UNCACHED = BITFIELD_BIT(5),
|
||||
|
||||
/* CPU map the buffer object in userspace by forcing the "Write-Back
|
||||
* Cacheable" cacheability attribute. The mapping otherwise uses the
|
||||
* "Non-Cacheable" attribute if the ACE-Lite coherency protocol isn't
|
||||
* supported by the GPU.
|
||||
*/
|
||||
PAN_KMOD_BO_FLAG_WB_MMAP = BITFIELD_BIT(6),
|
||||
};
|
||||
|
||||
/* Allowed group priority flags. */
|
||||
@@ -213,6 +220,9 @@ struct pan_kmod_dev_props {
|
||||
|
||||
/* A mask of flags containing the allowed group priorities. */
|
||||
enum pan_kmod_group_allow_priority_flags allowed_group_priorities_mask;
|
||||
|
||||
/* Mask of BO flags supported by the KMD. */
|
||||
uint32_t supported_bo_flags;
|
||||
};
|
||||
|
||||
/* Memory allocator for kmod internal allocations. */
|
||||
|
||||
@@ -197,6 +197,12 @@ panfrost_dev_query_props(struct panfrost_kmod_dev *panfrost_dev)
|
||||
if (prios & BITFIELD_BIT(PANFROST_JM_CTX_PRIORITY_HIGH))
|
||||
props->allowed_group_priorities_mask |=
|
||||
PAN_KMOD_GROUP_ALLOW_PRIORITY_HIGH;
|
||||
|
||||
props->supported_bo_flags = PAN_KMOD_BO_FLAG_EXECUTABLE |
|
||||
PAN_KMOD_BO_FLAG_ALLOC_ON_FAULT |
|
||||
PAN_KMOD_BO_FLAG_NO_MMAP;
|
||||
if (pan_kmod_driver_version_at_least(&dev->driver, 1, 6))
|
||||
props->supported_bo_flags |= PAN_KMOD_BO_FLAG_WB_MMAP;
|
||||
}
|
||||
|
||||
static struct pan_kmod_dev *
|
||||
@@ -250,6 +256,11 @@ to_panfrost_bo_flags(struct pan_kmod_dev *dev, uint32_t flags)
|
||||
panfrost_flags |= PANFROST_BO_NOEXEC;
|
||||
}
|
||||
|
||||
if (flags & PAN_KMOD_BO_FLAG_WB_MMAP) {
|
||||
assert(!(flags & PAN_KMOD_BO_FLAG_NO_MMAP));
|
||||
panfrost_flags |= PANFROST_BO_WB_MMAP;
|
||||
}
|
||||
|
||||
return panfrost_flags;
|
||||
}
|
||||
|
||||
|
||||
@@ -171,12 +171,18 @@ panthor_dev_query_props(struct panthor_kmod_dev *panthor_dev)
|
||||
|
||||
.allowed_group_priorities_mask = to_kmod_group_allow_priority_flags(
|
||||
panthor_dev->props.group_priorities.allowed_mask),
|
||||
|
||||
.supported_bo_flags = PAN_KMOD_BO_FLAG_EXECUTABLE |
|
||||
PAN_KMOD_BO_FLAG_NO_MMAP |
|
||||
PAN_KMOD_BO_FLAG_GPU_UNCACHED,
|
||||
};
|
||||
|
||||
if (panthor_dev->base.driver.version.major > 1 ||
|
||||
panthor_dev->base.driver.version.minor >= 6)
|
||||
if (pan_kmod_driver_version_at_least(&panthor_dev->base.driver, 1, 6))
|
||||
props->timestamp_device_coherent = true;
|
||||
|
||||
if (pan_kmod_driver_version_at_least(&panthor_dev->base.driver, 1, 7))
|
||||
props->supported_bo_flags |= PAN_KMOD_BO_FLAG_WB_MMAP;
|
||||
|
||||
static_assert(sizeof(props->texture_features) ==
|
||||
sizeof(panthor_dev->props.gpu.texture_features),
|
||||
"Mismatch in texture_features array size");
|
||||
@@ -333,6 +339,11 @@ to_panthor_bo_flags(uint32_t flags)
|
||||
if (flags & PAN_KMOD_BO_FLAG_NO_MMAP)
|
||||
panthor_flags |= DRM_PANTHOR_BO_NO_MMAP;
|
||||
|
||||
if (flags & PAN_KMOD_BO_FLAG_WB_MMAP) {
|
||||
assert(!(flags & PAN_KMOD_BO_FLAG_NO_MMAP));
|
||||
panthor_flags |= DRM_PANTHOR_BO_WB_MMAP;
|
||||
}
|
||||
|
||||
return panthor_flags;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user