[PATCH 3/3] drm/etnaviv: implement softpin
Philipp Zabel
p.zabel at pengutronix.de
Mon Aug 5 08:58:57 UTC 2019
On Fri, 2019-08-02 at 19:29 +0200, Lucas Stach wrote:
> With softpin we allow the userspace to take control over the GPU virtual
> address space. The new capability is relected by a bump of the minor DRM
> version. There are a few restrictions for userspace to take into
> account:
>
> 1. The kernel reserves a bit of the address space to implement zero page
> faulting and mapping of the kernel internal ring buffer. Userspace can
> query the kernel for the first usable GPU VM address via
> ETNAVIV_PARAM_SOFTPIN_START_ADDR.
>
> 2. We only allow softpin on GPUs, which implement proper process
> separation via PPAS. If softpin is not available the softpin start
> address will be set to ~0.
>
> 3. Softpin is all or nothing. A submit using softpin must not use any
> address fixups via relocs.
>
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> ---
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 2 +-
> drivers/gpu/drm/etnaviv/etnaviv_drv.h | 2 ++
> drivers/gpu/drm/etnaviv/etnaviv_gem.c | 4 ++--
> drivers/gpu/drm/etnaviv/etnaviv_gem.h | 1 +
> drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 25 +++++++++++++++++++-
> drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 9 +++++++
> include/uapi/drm/etnaviv_drm.h | 5 +++-
> 7 files changed, 43 insertions(+), 5 deletions(-)
>
[...]
> diff --git a/include/uapi/drm/etnaviv_drm.h b/include/uapi/drm/etnaviv_drm.h
> index 0d5c49dc478c..c5710485650c 100644
> --- a/include/uapi/drm/etnaviv_drm.h
> +++ b/include/uapi/drm/etnaviv_drm.h
> @@ -73,6 +73,7 @@ struct drm_etnaviv_timespec {
> #define ETNAVIV_PARAM_GPU_INSTRUCTION_COUNT 0x18
> #define ETNAVIV_PARAM_GPU_NUM_CONSTANTS 0x19
> #define ETNAVIV_PARAM_GPU_NUM_VARYINGS 0x1a
> +#define ETNAVIV_PARAM_SOFTPIN_START_ADDR 0x1b
>
> #define ETNA_MAX_PIPES 4
>
> @@ -177,9 +178,11 @@ struct drm_etnaviv_gem_submit_pmr {
> #define ETNA_SUBMIT_NO_IMPLICIT 0x0001
> #define ETNA_SUBMIT_FENCE_FD_IN 0x0002
> #define ETNA_SUBMIT_FENCE_FD_OUT 0x0004
> +#define ETNA_SUBMIT_SOFTPIN 0x0008
> #define ETNA_SUBMIT_FLAGS (ETNA_SUBMIT_NO_IMPLICIT | \
> ETNA_SUBMIT_FENCE_FD_IN | \
> - ETNA_SUBMIT_FENCE_FD_OUT)
> + ETNA_SUBMIT_FENCE_FD_OUT| \
> + ETNA_SUBMIT_SOFTPIN)
> #define ETNA_PIPE_3D 0x00
> #define ETNA_PIPE_2D 0x01
> #define ETNA_PIPE_VG 0x02
The presumed field of drm_etnaviv_gem_submit_bo has an elaborate comment
on its supposed pre-softpin use in etnaviv_drm.h, maybe that should be
updated.
Otherwise,
Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
regards
Philipp
More information about the dri-devel
mailing list