summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunita Nadampalli2014-11-25 11:49:01 -0600
committerSunita Nadampalli2014-11-25 11:55:18 -0600
commit4715ea56d8a266e66bc6cef982410c602a19be43 (patch)
treece6c90a8ce747265e889f2dc75fc239a2f585464 /memplugin_android.c
parent3b9d689f23e54ddf8c157643e50dd45709890fbd (diff)
downloadhardware-ti-libdce-4715ea56d8a266e66bc6cef982410c602a19be43.tar.gz
hardware-ti-libdce-4715ea56d8a266e66bc6cef982410c602a19be43.tar.xz
hardware-ti-libdce-4715ea56d8a266e66bc6cef982410c602a19be43.zip
libdce[ANDROID] - add drmsetmaster/dropmaster calls
Added setdrmmaster and dropdrmmaster calls for every drm ioctl. Change-Id: I9319e5927374e677480a18f937d2bbd12e561462 Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
Diffstat (limited to 'memplugin_android.c')
-rw-r--r--memplugin_android.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/memplugin_android.c b/memplugin_android.c
index 154ae7c..c3c6cb1 100644
--- a/memplugin_android.c
+++ b/memplugin_android.c
@@ -103,6 +103,9 @@ int memplugin_close()
103void *memplugin_alloc(int sz, int height, MemRegion region, int align, int flags) 103void *memplugin_alloc(int sz, int height, MemRegion region, int align, int flags)
104{ 104{
105 MemHeader *h = NULL; 105 MemHeader *h = NULL;
106
107 drmSetMaster(OmapDrm_FD);
108
106 struct omap_bo *bo = omap_bo_new(OmapDev, sz + sizeof(MemHeader), OMAP_BO_WC); 109 struct omap_bo *bo = omap_bo_new(OmapDev, sz + sizeof(MemHeader), OMAP_BO_WC);
107 110
108 if( !bo ) { 111 if( !bo ) {
@@ -120,6 +123,8 @@ void *memplugin_alloc(int sz, int height, MemRegion region, int align, int flags
120 h->handle = (void*)bo; 123 h->handle = (void*)bo;
121 h->offset = 0; 124 h->offset = 0;
122 125
126 drmDropMaster(OmapDrm_FD);
127
123 dce_buf_lock(1, (size_t *)&(h->dma_buf_fd)); 128 dce_buf_lock(1, (size_t *)&(h->dma_buf_fd));
124 129
125 return (H2P(h)); 130 return (H2P(h));
@@ -135,8 +140,10 @@ void memplugin_free(void *ptr)
135 /* close the file descriptor */ 140 /* close the file descriptor */
136 close(h->dma_buf_fd); 141 close(h->dma_buf_fd);
137 } 142 }
143 drmSetMaster(OmapDrm_FD);
138 /*Finally, Delete the buffer object*/ 144 /*Finally, Delete the buffer object*/
139 omap_bo_del((struct omap_bo *)h->handle); 145 omap_bo_del((struct omap_bo *)h->handle);
146 drmDropMaster(OmapDrm_FD);
140 ptr = NULL; 147 ptr = NULL;
141 } 148 }
142 149
@@ -159,6 +166,8 @@ void *memplugin_alloc_noheader(MemHeader *memHdr, int sz, int height, MemRegion
159 if (!memHdr) 166 if (!memHdr)
160 return NULL; 167 return NULL;
161 168
169 drmSetMaster(OmapDrm_FD);
170
162 struct omap_bo *bo = omap_bo_new(OmapDev, sz, OMAP_BO_WC); 171 struct omap_bo *bo = omap_bo_new(OmapDev, sz, OMAP_BO_WC);
163 172
164 if( !bo ) { 173 if( !bo ) {
@@ -176,6 +185,7 @@ void *memplugin_alloc_noheader(MemHeader *memHdr, int sz, int height, MemRegion
176 h->region = region; 185 h->region = region;
177 h->flags = flags;/*Beware: This is a bit field.*/ 186 h->flags = flags;/*Beware: This is a bit field.*/
178 h->offset = 0; 187 h->offset = 0;
188 drmDropMaster(OmapDrm_FD);
179 189
180 dce_buf_lock(1, (size_t *)&(h->dma_buf_fd)); 190 dce_buf_lock(1, (size_t *)&(h->dma_buf_fd));
181 191
@@ -195,8 +205,10 @@ void memplugin_free_noheader(MemHeader *memHdr)
195 close(h->dma_buf_fd); 205 close(h->dma_buf_fd);
196 } 206 }
197 207
208 drmSetMaster(OmapDrm_FD);
198 /*Finally, Delete the buffer object*/ 209 /*Finally, Delete the buffer object*/
199 omap_bo_del((struct omap_bo *)h->ptr); 210 omap_bo_del((struct omap_bo *)h->ptr);
211 drmDropMaster(OmapDrm_FD);
200 212
201 return; 213 return;
202} 214}