aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaurabh Bipin Chandra2013-09-05 05:16:56 -0500
committerSaurabh Bipin Chandra2013-09-05 10:44:04 -0500
commita502de00cbe7e704379f6ddbdf6ee3cc2c4f4274 (patch)
treebf587610df3f43149016a713d59b1f19c8f73c25 /libdce.c
parent2cf99e4c810f3fe1eddd1e02469643384002079f (diff)
downloadrepo-libdce-a502de00cbe7e704379f6ddbdf6ee3cc2c4f4274.tar.gz
repo-libdce-a502de00cbe7e704379f6ddbdf6ee3cc2c4f4274.tar.xz
repo-libdce-a502de00cbe7e704379f6ddbdf6ee3cc2c4f4274.zip
[LINUX] Moving Linux specific functions to new c file
This patch moves Linux specific functions to libdce_linux.c. It also takes in the DRM Initialization cleanup changes in dce_init from: https://gerrit.ext.ti.com/gerrit/omap/#/c/12888 Change-Id: I570341c8dfbe1d120bc89071a86020b6ba5d4cac Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
Diffstat (limited to 'libdce.c')
-rw-r--r--libdce.c103
1 files changed, 0 insertions, 103 deletions
diff --git a/libdce.c b/libdce.c
index 1c4ecb1..cd10b71 100644
--- a/libdce.c
+++ b/libdce.c
@@ -71,12 +71,6 @@
71 71
72#include <xdc/std.h> 72#include <xdc/std.h>
73 73
74#if defined(BUILDOS_LINUX)
75#include <xf86drm.h>
76#include <omap_drm.h>
77#include <omap_drmif.h>
78#endif /* BUILDOS_LINUX */
79
80/* IPC Headers */ 74/* IPC Headers */
81#include <MmRpc.h> 75#include <MmRpc.h>
82 76
@@ -87,11 +81,6 @@
87#include "memplugin.h" 81#include "memplugin.h"
88 82
89 83
90#if defined(BUILDOS_LINUX)
91int fd = -1;
92#endif /* BUILDOS_LINUX */
93
94
95/********************* GLOBALS ***********************/ 84/********************* GLOBALS ***********************/
96/* Hande used for Remote Communication */ 85/* Hande used for Remote Communication */
97static MmRpc_Handle MmRpcHandle = NULL; 86static MmRpc_Handle MmRpcHandle = NULL;
@@ -156,98 +145,6 @@ void dce_free(void *ptr)
156 memplugin_free(ptr, TILER_1D_BUFFER); 145 memplugin_free(ptr, TILER_1D_BUFFER);
157} 146}
158 147
159/***************** FUNCTIONS SPECIFIC TO LINUX *******************/
160#if defined(BUILDOS_LINUX)
161void *dce_init(void)
162{
163 struct omap_device *OmapDev = NULL;
164 dce_error_status eError = DCE_EOK;
165
166 printf(" >> dce_init\n");
167
168 /* Open omapdrm device */
169 if( fd == -1 ) {
170 printf("Open omapdrm device \n");
171 fd = drmOpen("omapdrm", "platform:omapdrm:00");
172 }
173 if( fd >= 0 ) {
174 OmapDev = omap_device_new(fd);
175 } else {
176 printf("Error opening omapdrm : drmOpen failed");
177 goto EXIT;
178 }
179
180EXIT:
181 return ((void *)OmapDev);
182}
183
184void dce_deinit(void *dev)
185{
186 omap_device_del(dev);
187 dev = NULL;
188 close(fd);
189 fd = -1;
190
191 return;
192}
193
194int dce_buf_lock(int num, size_t *handle)
195{
196 int i;
197 MmRpc_BufDesc *desc = NULL;
198 dce_error_status eError = DCE_EOK;
199
200 _ASSERT(num > 0, DCE_EINVALID_INPUT);
201
202 desc = memplugin_alloc(num * sizeof(MmRpc_BufDesc), 0, TILER_1D_BUFFER);
203 _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY);
204
205 for( i = 0; i < num; i++ ) {
206 desc[i].handle = handle[i];
207 }
208
209 eError = MmRpc_use(MmRpcHandle, MmRpc_BufType_Handle, num, desc);
210
211 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
212EXIT:
213 return (eError);
214}
215
216int dce_buf_unlock(int num, size_t *handle)
217{
218 int i;
219 MmRpc_BufDesc *desc = NULL;
220 dce_error_status eError = DCE_EOK;
221
222 _ASSERT(num > 0, DCE_EINVALID_INPUT);
223
224 desc = memplugin_alloc(num * sizeof(MmRpc_BufDesc), 0, TILER_1D_BUFFER);
225 _ASSERT(desc != NULL, DCE_EOUT_OF_MEMORY);
226
227 for( i = 0; i < num; i++ ) {
228 desc[i].handle = handle[i];
229 }
230
231 eError = MmRpc_release(MmRpcHandle, MmRpc_BufType_Handle, num, desc);
232
233 _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL);
234EXIT:
235 return (eError);
236}
237
238/* Incase of X11 or Wayland the fd can be shared to libdce using this call */
239void dce_set_fd(int dce_fd)
240{
241 fd = dce_fd;
242}
243
244int dce_get_fd(void)
245{
246 return (fd);
247}
248
249#endif /* BUILDOS_LINUX */
250
251/*=====================================================================================*/ 148/*=====================================================================================*/
252/** dce_ipc_init : Initialize MmRpc. This function is called within Engine_open(). 149/** dce_ipc_init : Initialize MmRpc. This function is called within Engine_open().
253 * 150 *