summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorInki Dae <inki.dae@samsung.com>2014-11-20 22:29:39 +0900
committerChanho Park <chanho61.park@samsung.com>2014-11-21 19:13:44 +0900
commitfdba906c052b853cc3fd792d4f45f904247c2a4a (patch)
treec174bf68104ae50d817d9c4eea9f847eb054767d /drivers/gpu/drm
parent2fc9531a488deb9dce86dd7259b46b603fe99d37 (diff)
downloadlinux-3.10-fdba906c052b853cc3fd792d4f45f904247c2a4a.tar.gz
linux-3.10-fdba906c052b853cc3fd792d4f45f904247c2a4a.tar.bz2
linux-3.10-fdba906c052b853cc3fd792d4f45f904247c2a4a.zip
dma-buf/dmabuf-sync: add dmabuf sync framework
The DMA Buffer synchronization API provides buffer synchronization mechanism based on DMA buffer sharing machanism[1], dmafence and reservation frameworks[2]; i.e., buffer access control to CPU and DMA, and easy-to-use interfaces for device drivers and user application. And this API can be used for all dma devices using system memory as dma buffer, especially for most ARM based SoCs. For more details, please refer to Documentation/dma-buf-syc.txt [1] http://lwn.net/Articles/470339/ [2] https://lkml.org/lkml/2014/2/24/824 Change-Id: I3b2084a3c331fc06992fa8d2a4c71378e88b10b5 Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c12
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fb.c4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_g2d.c11
3 files changed, 13 insertions, 14 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 22a8d1b8f64..e4f187d6285 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -315,21 +315,17 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
}
obj = &exynos_fb->exynos_gem_obj[i]->base;
- if (!obj->export_dma_buf)
+ if (!obj->dma_buf)
continue;
- /*
- * set dmabuf to fence and registers reservation
- * object to reservation entry.
- */
ret = dmabuf_sync_get(sync,
- obj->export_dma_buf,
+ obj->dma_buf, (unsigned int)crtc,
DMA_BUF_ACCESS_DMA_R);
if (WARN_ON(ret < 0))
continue;
}
- ret = dmabuf_sync_lock(sync);
+ ret = dmabuf_sync_wait_all(sync);
if (ret < 0) {
dmabuf_sync_put_all(sync);
dmabuf_sync_fini(sync);
@@ -525,7 +521,7 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe)
sync = list_first_entry(&exynos_crtc->sync_committed,
struct dmabuf_sync, list);
- if (!dmabuf_sync_unlock(sync)) {
+ if (!dmabuf_sync_signal_all(sync)) {
list_del_init(&sync->list);
dmabuf_sync_put_all(sync);
dmabuf_sync_fini(sync);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 78c6ee902ad..305f76d4de7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -198,7 +198,7 @@ void *exynos_drm_dmabuf_sync_work(struct drm_framebuffer *fb)
}
- ret = dmabuf_sync_lock(sync);
+ ret = dmabuf_sync_wait_all(sync);
if (ret < 0) {
dmabuf_sync_put_all(sync);
dmabuf_sync_fini(sync);
@@ -207,7 +207,7 @@ void *exynos_drm_dmabuf_sync_work(struct drm_framebuffer *fb)
}
/* buffer synchronization is done by wait_for_vblank so just signal. */
- dmabuf_sync_unlock(sync);
+ dmabuf_sync_signal_all(sync);
dmabuf_sync_put_all(sync);
dmabuf_sync_fini(sync);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 90432d3ff77..0232a724ab2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -696,11 +696,12 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d,
{
struct g2d_cmdlist *cmdlist = node->cmdlist;
struct g2d_buf_info *buf_info = &node->buf_info;
+ struct drm_exynos_file_private *file_priv = file->driver_priv;
int offset;
int ret;
int i;
- if (is_dmabuf_sync_supported()) {
+ if (dmabuf_sync_is_supported()) {
node->sync = dmabuf_sync_init("g2d", &dmabuf_sync_ops, node);
if (IS_ERR(node->sync))
node->sync = NULL;
@@ -745,7 +746,9 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d,
else
type = DMA_BUF_ACCESS_DMA_R;
- ret = dmabuf_sync_get(node->sync, dma_buf, type);
+ ret = dmabuf_sync_get(node->sync, dma_buf,
+ (unsigned int)file_priv->g2d_priv,
+ type);
if (ret < 0) {
WARN_ON(1);
dmabuf_sync_put_all(node->sync);
@@ -863,7 +866,7 @@ static void g2d_dma_start(struct g2d_data *g2d,
if (node->sync) {
int ret;
- ret = dmabuf_sync_lock(node->sync);
+ ret = dmabuf_sync_wait_all(node->sync);
if (ret < 0) {
WARN_ON(1);
dmabuf_sync_put_all(node->sync);
@@ -909,7 +912,7 @@ static void g2d_free_runqueue_node(struct g2d_data *g2d,
if (node->sync) {
int ret;
- ret = dmabuf_sync_unlock(node->sync);
+ ret = dmabuf_sync_signal_all(node->sync);
if (ret < 0) {
WARN_ON(1);
/* TODO */