diff options
authorPradeep Venkatasubbarao2014-03-24 02:48:35 -0500
committerPradeep Venkatasubbarao2014-03-25 23:04:42 -0500
commit1010fffb26ff3ee6e775b2f28d9016a88f26669a (patch)
tree68295d13b5bde5999fbe42cac00fdc95c7804171 /libdce_linux.c
parent0ab31239d479f6954ba56977cfd358b373b3f9ed (diff)
[LINUX] Manage Tiler Pinning for dce DRM buffers
Applications using dce_alloc/dce_free calls to manage memory, leaked memory because on non-closure of the created dmabuf fds. Additionally, all memory allocated from Tiler/DMM via DRM need to be explictly pinned to tiler using dce_buf_lock/dce_buf_unlock calls. Hence in the earlier implementation, every call to dce_alloc/free had to be followed by a lock/unlock call to pin/unpin it to tiler. In order, to insulate the applications from the internal details of DRM memory management and for ease of use of alloc and free calls, dce_alloc now takes care of creating the dmabuf and pinning it to tiler while dce_free takes care of tiler unpinning and closure of dmabuf fd. Applications can continue to use dce_alloc and dce_free calls as before thus maintiaining backward compatibility. On the other hand, since the same interfaces are used for multiple remote core targets, like IPU and DSP, MemHeader struture is upgraded to hold the core for which the block of memory belongs to, to keep track of the core. Hence all applications/Remote cores using this version of libdce should recompile with the new MemHeader for proper functioning. Dependent IPUMM patch: Change-Id: If09a1039b5b16f3cc5ff0e9c6c598932d8a2ce3e Signed-off-by: Pradeep Venkatasubbarao <> Signed-off-by: Amarinder Bindra <> Signed-off-by: Karthik Ramanan <>
Diffstat (limited to 'libdce_linux.c')
1 files changed, 17 insertions, 4 deletions
diff --git a/libdce_linux.c b/libdce_linux.c
index 6fc2124..0a86905 100644
--- a/libdce_linux.c
+++ b/libdce_linux.c
@@ -133,10 +133,23 @@ EXIT:
133 } 133 }
134 return (eError); 134 return (eError);
135} 135}
136/*These two are duplicate of above two functions 136
137 These have been added temporarily since there is no 137/*Memory Management mirror APIs for DSP remoteproc targets*/
138 other way to get the core index.These have been 138void *dsp_dce_alloc(int sz)
139 added to avoid modifying the current apis */ 139{
140 /*
141 Beware: The last argument is a bit field. As of now only core ID
142 is considered to be there in the last 4 bits of the word.
143 */
144 return (memplugin_alloc(sz, 1, MEM_TILER_1D, 0, DSP));
147void dsp_dce_free(void *ptr)
149 memplugin_free(ptr);
140int dsp_dce_buf_lock(int num, size_t *handle) 153int dsp_dce_buf_lock(int num, size_t *handle)
141{ 154{
142 int i; 155 int i;