aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSathishkumar2013-07-30 00:50:14 -0500
committerSaurabh Bipin Chandra2013-08-27 16:12:42 -0500
commitf71e00630af23f1dd7d2a0df87d9b5b524c823a8 (patch)
tree956d57896e212423862da2031aabaa50ba2d7f01 /libdce.c
parent17668bcb5a1f7f9db2ba225b1825bc55365c3e66 (diff)
downloadrepo-libdce-f71e00630af23f1dd7d2a0df87d9b5b524c823a8.tar.gz
repo-libdce-f71e00630af23f1dd7d2a0df87d9b5b524c823a8.tar.xz
repo-libdce-f71e00630af23f1dd7d2a0df87d9b5b524c823a8.zip
[GLP] Libdce linux implementation
make install & libdce.c issue fix 1. make install has been fixed. libdce.h will be installed in /usr/include, libdce.so files in /usr/lib and libdce.pc in /usr/lib/pkgconfig on using --prefix=/usr. By default the prefix is /usr/local. 2. init and deinit calls are removed from libdce.h 3. dce_set_fd and dce_get_fd calls are implemented in libdce.c 4. configure.ac checks for libmmrpc and makefile.am modified to link with libmmrpc. configure.ac and makefile.am modified 1. Codec_engine,xdctolls,framework_components,ipc,xdctools and xdaias paths needs to be exported. Configure.ac checks for the exported paths. 2. Makefile.am is modified to have the exported paths in the include directories list for the compiler. Modifications done after review 1. Comments added in memplugin_linux.c. White spaces removed manually and cleaned up libdce.c, memplugin.h. dce_priv.h is modified to have File and line number in the logs. linux/dce.h file is removed. Libdce modifications for linux Linux Specific libdce functionality added. 1. memplugin calls specific to linux are added in memplugin_linux.c 2. Error and debug logs implementation for linux in dce_priv.h 3. xll and wayland specific files are moved to linux folder Change-Id: Ib41e6a52d902376cdabbb939dee7585944720d92 Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com> Signed-off-by: Sathishkumar <x0203598@ti.com>
Diffstat (limited to 'libdce.c')
-rw-r--r--libdce.c90
1 files changed, 73 insertions, 17 deletions
diff --git a/libdce.c b/libdce.c
index ed02fcf..fc507c6 100644
--- a/libdce.c
+++ b/libdce.c
@@ -71,12 +71,11 @@
71 71
72#include <xdc/std.h> 72#include <xdc/std.h>
73 73
74#if defined(BUILDOS_GLP) 74#if defined(BUILDOS_LINUX)
75#include <xf86drm.h> 75#include <xf86drm.h>
76#include <omap_drm.h> 76#include <omap_drm.h>
77#include <omap_dce.h>
78#include <omap_drmif.h> 77#include <omap_drmif.h>
79#endif /* BUILDOS_GLP */ 78#endif /* BUILDOS_LINUX */
80 79
81/* IPC Headers */ 80/* IPC Headers */
82#include <MmRpc.h> 81#include <MmRpc.h>
@@ -88,21 +87,19 @@
88#include "memplugin.h" 87#include "memplugin.h"
89 88
90 89
91#if defined(BUILDOS_GLP) 90#if defined(BUILDOS_LINUX)
92#ifdef GLP_X11 91#ifdef HAVE_X11
93int dce_auth_x11(int *fd); 92// Defined from configure.ac
94#endif /* GLP_X11 */ 93extern int dce_auth_x11(int *fd);
95#ifdef GLP_WAYLAND 94#endif /* HAVE_X11 */
96int dce_auth_wayland(int *fd); 95#ifdef HAVE_WAYLAND // Defined from configure.ac
97#endif /* GLP_WAYLAND */ 96extern int dce_auth_wayland(int *fd);
97#endif /* HAVE_WAYLAND */
98 98
99static int fd = -1; 99int fd = -1;
100static struct omap_device *dev; 100struct omap_device *dev = 0;
101static int ioctl_base; 101uint32_t dce_debug = 3;
102#define CMD(name) (ioctl_base + DRM_OMAP_DCE_##name) 102#endif /* BUILDOS_LINUX */
103
104uint32_t dce_debug = 3;
105#endif /* BUILDOS_GLP */
106 103
107 104
108/********************* GLOBALS ***********************/ 105/********************* GLOBALS ***********************/
@@ -181,6 +178,42 @@ static int dce_init(void)
181 _ASSERT_AND_EXECUTE(eError == DCE_EOK, DCE_EIPC_CREATE_FAIL, count--); 178 _ASSERT_AND_EXECUTE(eError == DCE_EOK, DCE_EIPC_CREATE_FAIL, count--);
182 179
183 printf("open(/dev/" DCE_DEVICE_NAME ") -> 0x%x\n", (int)MmRpcHandle); 180 printf("open(/dev/" DCE_DEVICE_NAME ") -> 0x%x\n", (int)MmRpcHandle);
181
182#if defined(BUILDOS_LINUX)
183 /* Open omapdrm device */
184 int authenticated = 0;
185
186#ifdef HAVE_X11
187 /*If X11 server is running*/
188 if( !authenticated ) {
189 int ret = dce_auth_x11(&fd);
190 if( !ret ) {
191 authenticated = 1;
192 }
193 }
194#endif
195#ifdef HAVE_WAYLAND
196 /*If Wayland windowing is supported*/
197 if( !authenticated ) {
198 int ret = dce_auth_wayland(&fd);
199 if( !ret ) {
200 authenticated = 1;
201 }
202 }
203#endif
204 if((fd == -1) && !authenticated ) {
205 printf("no X11/wayland, fallback to opening DRM device directly\n");
206 fd = drmOpen("omapdrm", "platform:omapdrm:00");
207 }
208 if( fd >= 0 ) {
209 dev = omap_device_new(fd);
210 } else {
211 printf("Error opening omapdrm : drmOpen failed");
212 goto EXIT;
213 }
214#endif /* BUILDOS_LINUX */
215
216
184EXIT: 217EXIT:
185 pthread_mutex_unlock(&mutex); 218 pthread_mutex_unlock(&mutex);
186 return (eError); 219 return (eError);
@@ -199,11 +232,34 @@ static void dce_deinit(void)
199 MmRpc_delete(&MmRpcHandle); 232 MmRpc_delete(&MmRpcHandle);
200 } 233 }
201 MmRpcHandle = NULL; 234 MmRpcHandle = NULL;
235
236#if defined(BUILDOS_LINUX)
237 omap_device_del(dev);
238 dev = NULL;
239 close(fd);
240 fd = -1;
241#endif /* BUILDOS_LINUX */
242
243
202EXIT: 244EXIT:
203 pthread_mutex_unlock(&mutex); 245 pthread_mutex_unlock(&mutex);
204 return; 246 return;
205} 247}
206 248
249/* Incase of X11 or Wayland the fd can be shared to libdce using this call */
250#if defined(BUILDOS_LINUX)
251void dce_set_fd(int dce_fd)
252{
253 fd = dce_fd;
254}
255
256int dce_get_fd(void)
257{
258 return (fd);
259}
260
261#endif /* BUILDOS_LINUX */
262
207/*===============================================================*/ 263/*===============================================================*/
208/** Engine_open : Open Codec Engine. 264/** Engine_open : Open Codec Engine.
209 * 265 *