pan/kmod: Expose the IO coherency property
Will be used to skip cache maintenance operations when the GPU is IO coherent. Reviewed-by: Faith Ekstrand <faith.ekstrand@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:
@@ -109,6 +109,12 @@ enum pan_kmod_bo_flags {
|
||||
* supported by the GPU.
|
||||
*/
|
||||
PAN_KMOD_BO_FLAG_WB_MMAP = BITFIELD_BIT(6),
|
||||
|
||||
/* Set by default when the device is IO coherent. We might want to
|
||||
* make it optional at some point and pass a NON_COHERENT flag to
|
||||
* the KMD to force non-coherent mappings on IO coherent setup.
|
||||
*/
|
||||
PAN_KMOD_BO_FLAG_IO_COHERENT = BITFIELD_BIT(7),
|
||||
};
|
||||
|
||||
/* Allowed group priority flags. */
|
||||
@@ -223,6 +229,11 @@ struct pan_kmod_dev_props {
|
||||
|
||||
/* Mask of BO flags supported by the KMD. */
|
||||
uint32_t supported_bo_flags;
|
||||
|
||||
/* GPU is IO coherent, meaning BOs can be created with WB_MMAP without
|
||||
* requiring explicit CPU cache maintenance.
|
||||
*/
|
||||
bool is_io_coherent;
|
||||
};
|
||||
|
||||
/* Memory allocator for kmod internal allocations. */
|
||||
|
||||
@@ -78,6 +78,13 @@ pan_kmod_bo_init(struct pan_kmod_bo *bo, struct pan_kmod_dev *dev,
|
||||
struct pan_kmod_vm *exclusive_vm, uint64_t size, uint32_t flags,
|
||||
uint32_t handle)
|
||||
{
|
||||
/* Set by default when the device is IO coherent. We might want to
|
||||
* make it optional at some point and pass a NON_COHERENT flag to
|
||||
* the KMD to force non-coherent mappings on IO coherent setup.
|
||||
*/
|
||||
if (dev->props.is_io_coherent)
|
||||
flags |= PAN_KMOD_BO_FLAG_IO_COHERENT;
|
||||
|
||||
bo->dev = dev;
|
||||
bo->exclusive_vm = exclusive_vm;
|
||||
bo->size = size;
|
||||
|
||||
@@ -201,8 +201,16 @@ panfrost_dev_query_props(struct panfrost_kmod_dev *panfrost_dev)
|
||||
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))
|
||||
|
||||
if (pan_kmod_driver_version_at_least(&dev->driver, 1, 6)) {
|
||||
uint32_t selected_coherency =
|
||||
panfrost_query_raw(fd, DRM_PANFROST_PARAM_SELECTED_COHERENCY, true,
|
||||
DRM_PANFROST_GPU_COHERENCY_NONE);
|
||||
|
||||
props->supported_bo_flags |= PAN_KMOD_BO_FLAG_WB_MMAP;
|
||||
props->is_io_coherent =
|
||||
selected_coherency != DRM_PANFROST_GPU_COHERENCY_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static struct pan_kmod_dev *
|
||||
|
||||
@@ -180,8 +180,11 @@ panthor_dev_query_props(struct panthor_kmod_dev *panthor_dev)
|
||||
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))
|
||||
if (pan_kmod_driver_version_at_least(&panthor_dev->base.driver, 1, 7)) {
|
||||
props->is_io_coherent = panthor_dev->props.gpu.selected_coherency !=
|
||||
DRM_PANTHOR_GPU_COHERENCY_NONE;
|
||||
props->supported_bo_flags |= PAN_KMOD_BO_FLAG_WB_MMAP;
|
||||
}
|
||||
|
||||
static_assert(sizeof(props->texture_features) ==
|
||||
sizeof(panthor_dev->props.gpu.texture_features),
|
||||
|
||||
Reference in New Issue
Block a user