[RFC PATCH] drm/panfrost: Add initial panfrost driver

Neil Armstrong narmstrong at baylibre.com
Thu Mar 14 09:01:41 UTC 2019


On 08/03/2019 01:24, Rob Herring wrote:
> From: "Marty E. Plummer" <hanetzer at startmail.com>
> 
> This adds the initial driver for panfrost which supports Arm Mali
> Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU
> has been tested.
> 
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard at bootlin.com>
> Cc: Sean Paul <sean at poorly.run>
> Cc: David Airlie <airlied at linux.ie>
> Cc: Daniel Vetter <daniel at ffwll.ch>
> Cc: Alyssa Rosenzweig <alyssa at rosenzweig.io>
> Cc: Lyude Paul <lyude at redhat.com>
> Cc: Eric Anholt <eric at anholt.net>
> Signed-off-by: Marty E. Plummer <hanetzer at startmail.com>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
> Signed-off-by: Rob Herring <robh at kernel.org>
> ---
> Sending this out in the spirit of release early, release often. We're 
> close to parity compared to mesa + the vendor driver. There's a few 
> issues Tomeu is chasing. 
> 
> There's still some pieces of the h/w setup we've just hardcoded. Locking 
> in various places is probably missing. Error recovery is non-existent 
> (other than module unload/load). There's some work to add tracepoints 
> and perf counters that's not here yet. Bifrost GPUs are definitely not 
> supported yet other than identifying them. Primarily the MMU setup is 
> missing.
> 
> How's performance? Great, because I haven't measured it.
> 
> This patch and its dependencies are available here[1]. The mesa support 
> is here[2]. Both are likely to change (daily).
> 
> Rob
> 
> [1] https://gitlab.freedesktop.org/robh/linux-panfrost.git panfrost-rebase
> [2] https://gitlab.freedesktop.org/tomeu/mesa.git mainline-driver
> 
>  drivers/gpu/drm/Kconfig                      |   2 +
>  drivers/gpu/drm/Makefile                     |   1 +
>  drivers/gpu/drm/panfrost/Kconfig             |  14 +
>  drivers/gpu/drm/panfrost/Makefile            |  11 +
>  drivers/gpu/drm/panfrost/panfrost_device.c   | 127 ++++
>  drivers/gpu/drm/panfrost/panfrost_device.h   |  83 +++
>  drivers/gpu/drm/panfrost/panfrost_drv.c      | 419 ++++++++++++
>  drivers/gpu/drm/panfrost/panfrost_features.h | 308 +++++++++
>  drivers/gpu/drm/panfrost/panfrost_gem.c      |  92 +++
>  drivers/gpu/drm/panfrost/panfrost_gem.h      |  29 +
>  drivers/gpu/drm/panfrost/panfrost_gpu.c      | 464 +++++++++++++
>  drivers/gpu/drm/panfrost/panfrost_gpu.h      |  15 +
>  drivers/gpu/drm/panfrost/panfrost_issues.h   | 175 +++++
>  drivers/gpu/drm/panfrost/panfrost_job.c      | 662 +++++++++++++++++++
>  drivers/gpu/drm/panfrost/panfrost_job.h      |  47 ++
>  drivers/gpu/drm/panfrost/panfrost_mmu.c      | 409 ++++++++++++
>  drivers/gpu/drm/panfrost/panfrost_mmu.h      |  15 +
>  include/uapi/drm/panfrost_drm.h              | 138 ++++
>  18 files changed, 3011 insertions(+)
>  create mode 100644 drivers/gpu/drm/panfrost/Kconfig
>  create mode 100644 drivers/gpu/drm/panfrost/Makefile
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_device.c
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_device.h
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_drv.c
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_features.h
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_gem.c
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_gem.h
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_gpu.c
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_gpu.h
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_issues.h
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_job.c
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_job.h
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_mmu.c
>  create mode 100644 drivers/gpu/drm/panfrost/panfrost_mmu.h
>  create mode 100644 include/uapi/drm/panfrost_drm.h
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index febdc102b75c..cdafe35f0576 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -335,6 +335,8 @@ source "drivers/gpu/drm/tve200/Kconfig"
>  
>  source "drivers/gpu/drm/xen/Kconfig"
>  
> +source "drivers/gpu/drm/panfrost/Kconfig"
> +
>  # Keep legacy drivers last
>  
>  menuconfig DRM_LEGACY
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 7476ed945e30..66fd696ae60c 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -110,3 +110,4 @@ obj-$(CONFIG_DRM_TINYDRM) += tinydrm/
>  obj-$(CONFIG_DRM_PL111) += pl111/
>  obj-$(CONFIG_DRM_TVE200) += tve200/
>  obj-$(CONFIG_DRM_XEN) += xen/
> +obj-$(CONFIG_DRM_PANFROST) += panfrost/
> diff --git a/drivers/gpu/drm/panfrost/Kconfig b/drivers/gpu/drm/panfrost/Kconfig
> new file mode 100644
> index 000000000000..eb7283149354
> --- /dev/null
> +++ b/drivers/gpu/drm/panfrost/Kconfig
> @@ -0,0 +1,14 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +config DRM_PANFROST
> +	tristate "Panfrost (DRM support for ARM Mali Midgard/Bifrost GPUs)"
> +	depends on DRM
> +	depends on ARCH_ROCKCHIP

Could you switch to
+       depends on ARM || ARM64 || COMPILE_TEST
instead of ARCH_ROCKHIP ?

It will simply bringup on non-rockchip boards.

Neil

> +	depends on MMU
> +	select DRM_SCHED
> +	select IOMMU_SUPPORT
> +	select IOMMU_IO_PGTABLE_LPAE
> +	select DRM_GEM_SHMEM_HELPER
> +	help
> +	  DRM driver for ARM Mali Midgard (t6xx, t7xx, t8xx) and
> +	  Bifrost (G3x, G5x, G7x) GPUs.

[...]

> +/**
> + * Returns the offset for the BO in the GPU address space for this DRM fd.
> + * This is the same value returned by drm_panfrost_create_bo, if that was called
> + * from this DRM fd.
> + */
> +struct drm_panfrost_get_bo_offset {
> +	__u32 handle;
> +	__u32 pad;
> +	__u64 offset;
> +};
> +
> +#if defined(__cplusplus)
> +}
> +#endif
> +
> +#endif /* _PANFROST_DRM_H_ */
> 



More information about the dri-devel mailing list