History

drm/etnaviv: implement softpin

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.

Lucas Stach committed 7 years ago

Commit 088880d1 parent 17eae238 files · +51 −5Browse files

Showing the changes to include/uapi (1 of 8 files). Show all

Unified · Split

include/uapi/drm/etnaviv_drm.h+9−1
@@ -73,6 +73,7 @@ struct drm_etnaviv_timespec { · 72 unmodified lines
73#define ETNAVIV_PARAM_GPU_INSTRUCTION_COUNT 0x1873#define ETNAVIV_PARAM_GPU_INSTRUCTION_COUNT 0x18
74#define ETNAVIV_PARAM_GPU_NUM_CONSTANTS 0x1974#define ETNAVIV_PARAM_GPU_NUM_CONSTANTS 0x19
75#define ETNAVIV_PARAM_GPU_NUM_VARYINGS 0x1a75#define ETNAVIV_PARAM_GPU_NUM_VARYINGS 0x1a
76#define ETNAVIV_PARAM_SOFTPIN_START_ADDR 0x1b
76 77
77#define ETNA_MAX_PIPES 478#define ETNA_MAX_PIPES 4
78 79
@@ -148,6 +149,11 @@ struct drm_etnaviv_gem_submit_reloc { · 69 unmodified lines
148 * then patching the cmdstream for this entry is skipped. This can149 * then patching the cmdstream for this entry is skipped. This can
149 * avoid kernel needing to map/access the cmdstream bo in the common150 * avoid kernel needing to map/access the cmdstream bo in the common
150 * case.151 * case.
152 * If the submit is a softpin submit (ETNA_SUBMIT_SOFTPIN) the 'presumed'
153 * field is interpreted as the fixed location to map the bo into the gpu
154 * virtual address space. If the kernel is unable to map the buffer at
155 * this location the submit will fail. This means userspace is responsible
156 * for the whole gpu virtual address management.
151 */157 */
152#define ETNA_SUBMIT_BO_READ 0x0001158#define ETNA_SUBMIT_BO_READ 0x0001
153#define ETNA_SUBMIT_BO_WRITE 0x0002159#define ETNA_SUBMIT_BO_WRITE 0x0002
@@ -177,9 +183,11 @@ struct drm_etnaviv_gem_submit_pmr { · 23 unmodified lines
177#define ETNA_SUBMIT_NO_IMPLICIT 0x0001183#define ETNA_SUBMIT_NO_IMPLICIT 0x0001
178#define ETNA_SUBMIT_FENCE_FD_IN 0x0002184#define ETNA_SUBMIT_FENCE_FD_IN 0x0002
179#define ETNA_SUBMIT_FENCE_FD_OUT 0x0004185#define ETNA_SUBMIT_FENCE_FD_OUT 0x0004
186#define ETNA_SUBMIT_SOFTPIN 0x0008
180#define ETNA_SUBMIT_FLAGS (ETNA_SUBMIT_NO_IMPLICIT | \187#define ETNA_SUBMIT_FLAGS (ETNA_SUBMIT_NO_IMPLICIT | \
181 ETNA_SUBMIT_FENCE_FD_IN | \188 ETNA_SUBMIT_FENCE_FD_IN | \
182 ETNA_SUBMIT_FENCE_FD_OUT)189 ETNA_SUBMIT_FENCE_FD_OUT| \
190 ETNA_SUBMIT_SOFTPIN)
183#define ETNA_PIPE_3D 0x00191#define ETNA_PIPE_3D 0x00
184#define ETNA_PIPE_2D 0x01192#define ETNA_PIPE_2D 0x01
185#define ETNA_PIPE_VG 0x02193#define ETNA_PIPE_VG 0x02