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
7373 #define ETNAVIV_PARAM_GPU_INSTRUCTION_COUNT 0x18
7474 #define ETNAVIV_PARAM_GPU_NUM_CONSTANTS 0x19
7575 #define ETNAVIV_PARAM_GPU_NUM_VARYINGS 0x1a
76+#define ETNAVIV_PARAM_SOFTPIN_START_ADDR 0x1b
7677
7778 #define ETNA_MAX_PIPES 4
7879
@@ -148,6 +149,11 @@ struct drm_etnaviv_gem_submit_reloc { · 69 unmodified lines
148149 * then patching the cmdstream for this entry is skipped. This can
149150 * avoid kernel needing to map/access the cmdstream bo in the common
150151 * 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.
151157 */
152158 #define ETNA_SUBMIT_BO_READ 0x0001
153159 #define ETNA_SUBMIT_BO_WRITE 0x0002
@@ -177,9 +183,11 @@ struct drm_etnaviv_gem_submit_pmr { · 23 unmodified lines
177183 #define ETNA_SUBMIT_NO_IMPLICIT 0x0001
178184 #define ETNA_SUBMIT_FENCE_FD_IN 0x0002
179185 #define ETNA_SUBMIT_FENCE_FD_OUT 0x0004
186+#define ETNA_SUBMIT_SOFTPIN 0x0008
180187 #define ETNA_SUBMIT_FLAGS (ETNA_SUBMIT_NO_IMPLICIT | \
181188 ETNA_SUBMIT_FENCE_FD_IN | \
182− ETNA_SUBMIT_FENCE_FD_OUT)
189+ ETNA_SUBMIT_FENCE_FD_OUT| \
190+ ETNA_SUBMIT_SOFTPIN)
183191 #define ETNA_PIPE_3D 0x00
184192 #define ETNA_PIPE_2D 0x01
185193 #define ETNA_PIPE_VG 0x02