aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2017-01-16 17:29:57 +0100
committerLucas Stach <l.stach@pengutronix.de>2017-02-02 10:30:37 +0100
commite66774dd6f6a3d44559599e4eeb785734c28d034 (patch)
treee87ff31d2685fae6e2a5009d426f63abe3c3af85 /drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h
parentdrm/etnaviv: get cmdbuf physical address through the cmdbuf abstraction (diff)
downloadlinux-dev-e66774dd6f6a3d44559599e4eeb785734c28d034.tar.xz
linux-dev-e66774dd6f6a3d44559599e4eeb785734c28d034.zip
drm/etnaviv: add cmdbuf suballocator
There are 3 big benefits to suballocating a single big DMA buffer for command submission: 1. Avoid hammering CMA. The old way of allocating and freeing a DMA buffer for each submission was hitting some of the real slow pathes in CMA, as this allocator was not designed for a concurrent small buffers load. 2. Less TLB flushes on IOMMUv2. If a new command buffer is mapped into the GPU address space the MMU TLBs need to be flushed. By having one big buffer statically mapped to the GPU, a lot of those flushes can be avoided. 3. No funky workarounds for GC3000. The FE TLB flush on GC3000 isn't reliable. To work around that we tried to lay out the cmdbufs in the GPU address space in a way to avoid this issue. This hasn't always worked if the address space is crowded. A single statically mapped buffer avoids the erratum completely. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h b/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h
index 244358778407..80d78076c679 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h
@@ -17,21 +17,21 @@
#ifndef __ETNAVIV_CMDBUF_H__
#define __ETNAVIV_CMDBUF_H__
-#include <drm/drm_mm.h>
#include <linux/types.h>
+struct etnaviv_gpu;
+struct etnaviv_cmdbuf_suballoc;
+
struct etnaviv_cmdbuf {
- /* device this cmdbuf is allocated for */
- struct etnaviv_gpu *gpu;
+ /* suballocator this cmdbuf is allocated from */
+ struct etnaviv_cmdbuf_suballoc *suballoc;
/* user context key, must be unique between all active users */
struct etnaviv_file_private *ctx;
/* cmdbuf properties */
+ int suballoc_offset;
void *vaddr;
- dma_addr_t paddr;
u32 size;
u32 user_size;
- /* vram node used if the cmdbuf is mapped through the MMUv2 */
- struct drm_mm_node vram_node;
/* fence after which this buffer is to be disposed */
struct dma_fence *fence;
/* target exec state */
@@ -43,6 +43,15 @@ struct etnaviv_cmdbuf {
struct etnaviv_vram_mapping *bo_map[0];
};
+struct etnaviv_cmdbuf_suballoc *
+etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu);
+void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc);
+
+struct etnaviv_cmdbuf *
+etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
+ size_t nr_bos);
+void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf);
+
u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf);
dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf);