Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349362
b: refs/heads/master
c: b8b5c13
h: refs/heads/master
v: v3
  • Loading branch information
Inki Dae committed Jan 25, 2013
1 parent ce9e293 commit faf0965
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 420ae1e2623af92e71437e403fd11de48e11551f
refs/heads/master: b8b5c139ba75cde517b3e5eb6e3e760c0824b238
25 changes: 11 additions & 14 deletions trunk/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
struct exynos_drm_dmabuf_attachment {
struct sg_table sgt;
enum dma_data_direction dir;
bool is_mapped;
};

static int exynos_gem_attach_dma_buf(struct dma_buf *dmabuf,
Expand Down Expand Up @@ -72,17 +73,10 @@ static struct sg_table *

DRM_DEBUG_PRIME("%s\n", __FILE__);

if (WARN_ON(dir == DMA_NONE))
return ERR_PTR(-EINVAL);

/* just return current sgt if already requested. */
if (exynos_attach->dir == dir)
if (exynos_attach->dir == dir && exynos_attach->is_mapped)
return &exynos_attach->sgt;

/* reattaching is not allowed. */
if (WARN_ON(exynos_attach->dir != DMA_NONE))
return ERR_PTR(-EBUSY);

buf = gem_obj->buffer;
if (!buf) {
DRM_ERROR("buffer is null.\n");
Expand All @@ -107,14 +101,17 @@ static struct sg_table *
wr = sg_next(wr);
}

nents = dma_map_sg(attach->dev, sgt->sgl, sgt->orig_nents, dir);
if (!nents) {
DRM_ERROR("failed to map sgl with iommu.\n");
sg_free_table(sgt);
sgt = ERR_PTR(-EIO);
goto err_unlock;
if (dir != DMA_NONE) {
nents = dma_map_sg(attach->dev, sgt->sgl, sgt->orig_nents, dir);
if (!nents) {
DRM_ERROR("failed to map sgl with iommu.\n");
sg_free_table(sgt);
sgt = ERR_PTR(-EIO);
goto err_unlock;
}
}

exynos_attach->is_mapped = true;
exynos_attach->dir = dir;
attach->priv = exynos_attach;

Expand Down

0 comments on commit faf0965

Please sign in to comment.