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 /memplugin_linux.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 'memplugin_linux.c')
-rw-r--r--memplugin_linux.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/memplugin_linux.c b/memplugin_linux.c
new file mode 100644
index 0000000..bb99d26
--- /dev/null
+++ b/memplugin_linux.c
@@ -0,0 +1,87 @@
1/*
2 * Copyright (c) 2013, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include "memplugin.h"
34#include "dce_priv.h"
35
36extern struct omap_device *dev;
37
38
39/* memplugin_alloc - allocates omap_bo buffer with a header above it.
40 * @sz: Size of the buffer requsted
41 * @height: this parameter is currently not used
42 * @memory_type : Currently dce_alloc is used on for parameter buffer
43 * Returns a virtual address pointer to omap_bo buffer or the param buffer
44 */
45void *memplugin_alloc(int sz, int height, mem_type memory_type)
46{
47 MemHeader *h;
48 struct omap_bo *bo = omap_bo_new(dev, sz + sizeof(MemHeader), OMAP_BO_WC);
49
50 if( !bo ) {
51 return (NULL);
52 }
53
54 h = omap_bo_map(bo);
55 memset(H2P(h), 0, sz);
56 h->size = sz;
57 h->ptr = (void *)bo;
58
59 return (H2P(h));
60
61}
62
63/*
64 * @ptr: pointer to omap_bo buffer, to be freed
65 * @memory_type: Currently dce_free is called on parameter buffers only
66 */
67void memplugin_free(void *ptr, mem_type memory_type)
68{
69 if( ptr ) {
70 MemHeader *h = P2H(ptr);
71 omap_bo_del((struct omap_bo *)h->ptr);
72 }
73}
74
75/* memplugin_share - converts the omap_bo buffer into dmabuf
76 * @ptr : pointer of omap_bo buffer, to be converted to fd
77 * Returns a file discriptor for the omap_bo buffer
78 */
79int memplugin_share(void *ptr)
80{
81 if( ptr ) {
82 MemHeader *h = P2H(ptr);
83 return (omap_bo_dmabuf((struct omap_bo *)h->ptr));
84 }
85 return (-1);
86}
87