pan/kmod: Add a backend for panthor

Panthor is a new kernel driver handling CSF-based GPUs. It's designed
around the new VM model where:

- VM management is all explicit (you get to choose where objects are
  mapped in the GPU VA space)
- synchronization is explicit too (there's not BO_WAIT, and we don't
  pass BOs around to serve as implicit deps)

We add a few panthor specific helpers (those exposed in panthor_kmod.h)
too:

- panthor_kmod_xxx_sync_point() are needed to make pan_kmod_bo_wait()
  work with the new synchronization/VM model
- panthor_kmod_get_flush_id() is exposing the LATEST_FLUSH_ID register
- panthor_kmod_vm_handle() is providing a way to query the VM handle
  attached to the pan_kmod_vm object (needed for a few panthor ioctls)

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Antonino Maniscalco <antonino.maniscalco@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26358>
This commit is contained in:
Boris Brezillon 2023-11-21 10:06:04 +01:00 committed by Marge Bot
parent fe76c22aeb
commit 97f6a62f7e
5 changed files with 1144 additions and 0 deletions

View file

@ -21,6 +21,7 @@
libpankmod_lib_files = files(
'pan_kmod.c',
'panfrost_kmod.c',
'panthor_kmod.c',
)
libpankmod_lib = static_library(

View file

@ -11,6 +11,7 @@
#include "pan_kmod.h"
extern const struct pan_kmod_ops panfrost_kmod_ops;
extern const struct pan_kmod_ops panthor_kmod_ops;
static const struct {
const char *name;
@ -20,6 +21,10 @@ static const struct {
"panfrost",
&panfrost_kmod_ops,
},
{
"panthor",
&panthor_kmod_ops,
},
};
static void *

View file

@ -32,6 +32,8 @@
#include "util/sparse_array.h"
#include "util/u_atomic.h"
#include "kmod/panthor_kmod.h"
#if defined(__cplusplus)
extern "C" {
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,38 @@
/*
* Copyright © 2023 Collabora, Ltd.
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
extern "C" {
#endif
struct drm_panthor_csif_info;
struct pan_kmod_bo;
struct pan_kmod_dev;
struct pan_kmod_vm;
int panthor_kmod_bo_attach_sync_point(struct pan_kmod_bo *bo,
uint32_t sync_handle,
uint64_t sync_point, bool written);
int panthor_kmod_bo_get_sync_point(struct pan_kmod_bo *bo,
uint32_t *sync_handle, uint64_t *sync_point,
bool read_only);
uint32_t panthor_kmod_vm_sync_handle(struct pan_kmod_vm *vm);
uint64_t panthor_kmod_vm_sync_lock(struct pan_kmod_vm *vm);
void panthor_kmod_vm_sync_unlock(struct pan_kmod_vm *vm,
uint64_t new_sync_point);
uint32_t panthor_kmod_get_flush_id(const struct pan_kmod_dev *dev);
const struct drm_panthor_csif_info *
panthor_kmod_get_csif_props(const struct pan_kmod_dev *dev);
#if defined(__cplusplus)
} // extern "C"
#endif