summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 473f405)
raw | patch | inline | side by side (parent: 473f405)
author | Sundar Raman <a0393242@ti.com> | |
Tue, 23 Apr 2013 22:39:34 +0000 (17:39 -0500) | ||
committer | Sundar Raman <a0393242@ti.com> | |
Fri, 26 Jul 2013 21:01:14 +0000 (16:01 -0500) |
Enhance ion_sync_for_device to take in cache direction
Change-Id: I78bef9c2b5cc461b5f49c6019d031a15ce1a36de
Signed-off-by: Sundar Raman <a0393242@ti.com>
Change-Id: I78bef9c2b5cc461b5f49c6019d031a15ce1a36de
Signed-off-by: Sundar Raman <a0393242@ti.com>
drivers/gpu/ion/ion.c | patch | blob | history | |
include/linux/ion.h | patch | blob | history |
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index 8f477880f040fe5985617acedd617bce7c988a7c..d7c780ff35b445d06a005f10472d268d5b2fd688 100644 (file)
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
}
EXPORT_SYMBOL(ion_import_dma_buf);
-static int ion_sync_for_device(struct ion_client *client, int fd)
+static int ion_sync_for_device(struct ion_client *client, int fd, enum ion_data_direction dir)
{
struct dma_buf *dmabuf;
struct ion_buffer *buffer;
}
buffer = dmabuf->priv;
- dma_sync_sg_for_device(NULL, buffer->sg_table->sgl,
- buffer->sg_table->nents, DMA_BIDIRECTIONAL);
+ if(dir == ION_FROM_DEVICE)
+ dma_sync_sg_for_device(NULL, buffer->sg_table->sgl,
+ buffer->sg_table->nents, DMA_FROM_DEVICE);
+ else if(dir == ION_TO_DEVICE)
+ dma_sync_sg_for_device(NULL, buffer->sg_table->sgl,
+ buffer->sg_table->nents, DMA_TO_DEVICE);
+ else if(dir == ION_BIDIRECTIONAL)
+ dma_sync_sg_for_device(NULL, buffer->sg_table->sgl,
+ buffer->sg_table->nents, DMA_BIDIRECTIONAL);
+
dma_buf_put(dmabuf);
return 0;
}
if (copy_from_user(&data, (void __user *)arg,
sizeof(struct ion_fd_data)))
return -EFAULT;
- ion_sync_for_device(client, data.fd);
+ ion_sync_for_device(client, data.fd, data.dir);
break;
}
case ION_IOC_CUSTOM:
diff --git a/include/linux/ion.h b/include/linux/ion.h
index a55d11fbcbd598d5cf73562fc9b03ede2ee2ed74..31045a150dc5c8ab22a6898dc3f8043838c66be6 100644 (file)
--- a/include/linux/ion.h
+++ b/include/linux/ion.h
ION_NUM_HEAPS = 16,
};
+/**
+ * enum ion_data_direction - sync operation arguments
+ * @ION_BIDIRECTIONAL: memory written to & read from device
+ * @ION_TO_DEVICE: memory going to be transferred to device
+ * @ION_FROM_DEVICE: memory populated by device
+ * @ION_NONE: None of the above
+ */
+enum ion_data_direction {
+ ION_BIDIRECTIONAL = 0,
+ ION_TO_DEVICE = 1,
+ ION_FROM_DEVICE = 2,
+ ION_NONE = 3,
+};
+
+
#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
struct ion_fd_data {
struct ion_handle *handle;
int fd;
+ enum ion_data_direction dir;
};
/**