summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaurabh Bipin Chandra2013-08-04 04:55:14 -0500
committerSaurabh Bipin Chandra2013-08-30 00:58:22 -0500
commit6163ea9eb894f3d88562e31ea442f848a6e8a568 (patch)
treea2092941c0ce83d28e9faeb0d112f245d225162d /memplugin_linux.c
parent060b6ab4d13c30af1062df055889f86ccca3c6b7 (diff)
downloadhardware-ti-libdce-6163ea9eb894f3d88562e31ea442f848a6e8a568.tar.gz
hardware-ti-libdce-6163ea9eb894f3d88562e31ea442f848a6e8a568.tar.xz
hardware-ti-libdce-6163ea9eb894f3d88562e31ea442f848a6e8a568.zip
[GLP] Enable DMA Buf Handle
This patch converts all MmRpc_Pointer_Param call to MmRpc_OffsetPointer_Param to take care of MemHeader. This is not needed from a QNX perspective but is needed from a Linux perspective. There should no added latency is QNX due to this change as the rpmsg_rpc kernel path is still the same. This patch invokes memplugin_share() for the buffers allocated through DCE to get the corresponding DMA Buf Handles for GLP. For QNX, the return value is expected to be 0. For linux, the patch adds the logic for Single vs Multiplanar buffers. For linux, the memplugin_share() logic is modified to store and retireve the same dma_buf_fd rather than getting a dup() each time. These changes makes the following assumptions: 1. All the parameter buffers are allocated through DCE/MemPlugin. 2. The CLient passes Virtual pointers, rather than DMA Buf Handles to libdce for parameter buffers. 3. For IO Buffers, the client passes DMA Buf Handles and are not allocated using DCE/MemPlugin. This patch assumes MmRpc is exposing translation[i].base. Change-Id: I7d13f4a4d69fbe8b6dd0317e2a860f0df2061ef9 Signed-off-by: Sunita Nadampalli <sunitan@ti.com> Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
Diffstat (limited to 'memplugin_linux.c')
-rw-r--r--memplugin_linux.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/memplugin_linux.c b/memplugin_linux.c
index bb99d26..47f03fc 100644
--- a/memplugin_linux.c
+++ b/memplugin_linux.c
@@ -45,7 +45,7 @@ extern struct omap_device *dev;
45void *memplugin_alloc(int sz, int height, mem_type memory_type) 45void *memplugin_alloc(int sz, int height, mem_type memory_type)
46{ 46{
47 MemHeader *h; 47 MemHeader *h;
48 struct omap_bo *bo = omap_bo_new(dev, sz + sizeof(MemHeader), OMAP_BO_WC); 48 struct omap_bo *bo = omap_bo_new(dev, sz + sizeof(MemHeader), OMAP_BO_CACHED);
49 49
50 if( !bo ) { 50 if( !bo ) {
51 return (NULL); 51 return (NULL);
@@ -55,6 +55,7 @@ void *memplugin_alloc(int sz, int height, mem_type memory_type)
55 memset(H2P(h), 0, sz); 55 memset(H2P(h), 0, sz);
56 h->size = sz; 56 h->size = sz;
57 h->ptr = (void *)bo; 57 h->ptr = (void *)bo;
58 h->dma_buf_fd = 0;
58 59
59 return (H2P(h)); 60 return (H2P(h));
60 61
@@ -80,7 +81,10 @@ int memplugin_share(void *ptr)
80{ 81{
81 if( ptr ) { 82 if( ptr ) {
82 MemHeader *h = P2H(ptr); 83 MemHeader *h = P2H(ptr);
83 return (omap_bo_dmabuf((struct omap_bo *)h->ptr)); 84 if( !h->dma_buf_fd ) {
85 h->dma_buf_fd = omap_bo_dmabuf((struct omap_bo *)h->ptr);
86 }
87 return (h->dma_buf_fd);
84 } 88 }
85 return (-1); 89 return (-1);
86} 90}