dma-buf: support partial sync under CONFIG_DMABUF_PARTIAL

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I1bf92c9bea5ae9506adb636f5d645bea434ade7c
This commit is contained in:
Jianqun Xu
2023-02-21 17:04:51 +08:00
committed by Tao Huang
parent 31c11a2896
commit 20153d54d3
3 changed files with 19 additions and 4 deletions

View File

@@ -24,6 +24,17 @@ config RK_DMABUF_DEBUG_ADVANCED
This option support to debug all the dmabuf on db_list, allows to attach
and map a dmabuf who has no attachment. If not sure, say N
config DMABUF_PARTIAL
bool "Support for partial cache maintenance"
default y
help
In order to improve performance, allow dma-buf clients to
apply cache maintenance to only a subset of a dma-buf.
Kernel clients will be able to use the dma_buf_begin_cpu_access_partial
and dma_buf_end_cpu_access_partial functions to only apply cache
maintenance to a range within the dma-buf.
config SYNC_FILE
bool "Explicit Synchronization Framework"
default n

View File

@@ -135,7 +135,7 @@ static void cma_heap_unmap_dma_buf(struct dma_buf_attachment *attachment,
dma_unmap_sgtable(attachment->dev, table, direction, attrs);
}
static int
static int __maybe_unused
cma_heap_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf,
enum dma_data_direction direction,
unsigned int offset,
@@ -160,7 +160,7 @@ cma_heap_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf,
return 0;
}
static int
static int __maybe_unused
cma_heap_dma_buf_end_cpu_access_partial(struct dma_buf *dmabuf,
enum dma_data_direction direction,
unsigned int offset,
@@ -334,8 +334,10 @@ static const struct dma_buf_ops cma_heap_buf_ops = {
.unmap_dma_buf = cma_heap_unmap_dma_buf,
.begin_cpu_access = cma_heap_dma_buf_begin_cpu_access,
.end_cpu_access = cma_heap_dma_buf_end_cpu_access,
#ifdef CONFIG_DMABUF_PARTIAL
.begin_cpu_access_partial = cma_heap_dma_buf_begin_cpu_access_partial,
.end_cpu_access_partial = cma_heap_dma_buf_end_cpu_access_partial,
#endif
.mmap = cma_heap_mmap,
.vmap = cma_heap_vmap,
.vunmap = cma_heap_vunmap,

View File

@@ -266,7 +266,7 @@ static int system_heap_sgl_sync_range(struct device *dev,
return 0;
}
static int
static int __maybe_unused
system_heap_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf,
enum dma_data_direction direction,
unsigned int offset,
@@ -296,7 +296,7 @@ system_heap_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf,
return ret;
}
static int
static int __maybe_unused
system_heap_dma_buf_end_cpu_access_partial(struct dma_buf *dmabuf,
enum dma_data_direction direction,
unsigned int offset,
@@ -479,8 +479,10 @@ static const struct dma_buf_ops system_heap_buf_ops = {
.unmap_dma_buf = system_heap_unmap_dma_buf,
.begin_cpu_access = system_heap_dma_buf_begin_cpu_access,
.end_cpu_access = system_heap_dma_buf_end_cpu_access,
#ifdef CONFIG_DMABUF_PARTIAL
.begin_cpu_access_partial = system_heap_dma_buf_begin_cpu_access_partial,
.end_cpu_access_partial = system_heap_dma_buf_end_cpu_access_partial,
#endif
.mmap = system_heap_mmap,
.vmap = system_heap_vmap,
.vunmap = system_heap_vunmap,