[TRACE] Debug Log levels enabled This patch adds debug log levels to libdce. To enable traces, set the DCE_DEBUG_ENABLE. The trace level can be changed by setting DCE_DEBUG_LEVEL= [1/2/3] during compile time. Change-Id: I4bed53cc6e3af938c02221376662318e3a1b8ec4 Signed-off-by: Sathishkumar <x0203598@ti.com>
[LINUX] Fix for make install This patch fixes make install. All the required headers are copied to $(includedir)/dce on make install. Unused variables(X11 and WAYLAND) are removed in Makefile.am and pkg-config on libmmrpc is removed as no libmmrpc.pc is available. xdc_target_types__=gnu/targets/std.h is added to libdce.h, so that applications need not do it when using libdce.h. Change-Id: I8cc70aa2102becdbdc4c6b1e38e2aaa91739c4cc Signed-off-by: Sathishkumar <x0203598@ti.com>
[LIBDCE] Add function descriptor in libdce header file This patch adds function descriptors in the libdce.h. The xdc/std.h inclusion is shifted from libdce.c to libdce.h to remove the need of client application including xdc/std.h. Change-Id: I4b9e6f12643b130a2cf1d317c4fed595008c7812 Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
[LIBDCE] Mutual exclusion of Engine_open and Engine_close This patch uses semaphores to mutually exclude: 1. dce_init() and Engine_open() IPU call. This solves a hang on IPU side during multiple instances. pthread mutex used within dce_init is replaced with semaphores as mutex is valid only across threads and not processes. 2. dce_deinit() and Engine_close(). This solves a hang on IPU side during multiple instances. Change-Id: Ia4d31582ebf0536142dee389e9601eae0169fb22 Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
[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>
[LINUX] Expose dce_init and dce_deinit calls to user This patch changes the declaration of dce_init() and dce_deinit() to what is expected by Gstreamer for GLP and exposes it. This involves returning a struct omap_device pointer as void * during dce_init() and receiving a struct omap_device during dce_deinit(). The IPC initialization/deinitialization has been separated out of dce_init()/dce_deinit() into two static functions dce_ipc_init(), dce_ipc_deinit(). These functions are now included within Engine_open(), Engine_close() for all OSs. Change-Id: I86f4778cbd80f0a83aa3c39d8183bb3155a2a391 Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
[LINUX] Expose API to lock and Unlock IO Buffers This patch exposes APIs: dce_buf_lock(int num, size_t *handle) dce_buf_unlock(int num, size_t *handle) to lock and unlock the Input/Output Buffers respectively. The change is specific to GLP. The DRM driver pins and unpins tiler address for the IO Buffers whenever the rpmsg_rpc driver calls map_attachment and unmap_attachment() respectively. As the rpmsg_rpc driver invokes these calls during every process call, the reference buffer addresses (address of past locked buffers) held by the codec gets invalidated. That is, these addresses will not continue to map to the same memory region (YUV reference buffer) as before. Most often, these virtual addresses may point to the next YUV Buffer translated from the MPU. These APIs put a condition on the map and unmap() within rpmsg_rpc. The expectation from the application is to call dce_buf_lock() for the inArgs.inputID buffer and dce_buf_unlock() for the outArgs.freeBufID buffer. Change-Id: Ic749c6b18385f9052a2eeb4e16959063c5efab5e Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
[DCE] Align MmRpc offset setting with GLP Rpmsg_rpc This patch aligns setting translation[i].offset field of MmRpc Translation Array (XltAry) with the understanding of rpmsg_rpc of GLP. Rpmsg_rpc of GLP calculates: primary_offset as mmrpc_params.addr - mmprc_params.base and secondary_offset as translation[i].offset and sums both to get to the location of the address to be translated. Whereas in QNX rpmsg_rpc, the primary offset was subtracted from the secondary offset. This logic has now been modified in IPC_03_10_00_07_eng to align with the rpmsg_rpc of GLP. Change-Id: Ied11e78891119312f35162e336cd3dded9e8997a Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
[GLP] Enable DMA Buf Handle This patch converts all MmRpc_Pointer_Param call to MmRpc_OffsetPointer_Param to take care of MemHeader. This is not needed from a QNX perspective but is needed from a Linux perspective. There should no added latency is QNX due to this change as the rpmsg_rpc kernel path is still the same. This patch invokes memplugin_share() for the buffers allocated through DCE to get the corresponding DMA Buf Handles for GLP. For QNX, the return value is expected to be 0. For linux, the patch adds the logic for Single vs Multiplanar buffers. For linux, the memplugin_share() logic is modified to store and retireve the same dma_buf_fd rather than getting a dup() each time. These changes makes the following assumptions: 1. All the parameter buffers are allocated through DCE/MemPlugin. 2. The CLient passes Virtual pointers, rather than DMA Buf Handles to libdce for parameter buffers. 3. For IO Buffers, the client passes DMA Buf Handles and are not allocated using DCE/MemPlugin. This patch assumes MmRpc is exposing translation[i].base. Change-Id: I7d13f4a4d69fbe8b6dd0317e2a860f0df2061ef9 Signed-off-by: Sunita Nadampalli <sunitan@ti.com> Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
[LINUX] X11 and Wayland Support removed X11 and wayland support is removed from libdce. Defaults to omapdrm device. Change-Id: I0def0c872cc2658edd12a3e69dec6016eab3f1c9 Signed-off-by: Sathishkumar <x0203598@ti.com>
[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>
[DCE] Modify approach to pass parameters to IPC Three approaches were followed for IPC MmRpc calls. 1. All the parameters which need to be sent and received to/from IPU are coupled in a struct allocated from Shared/Tiler Memory. Only the adrress of the struct is passed to MmRpc as a pointer argument. This approach is useful as MmRpc in some cases to avoid multiple translations. This approach is followed for : Engine_open(), Engine_close(), create(), control(), delete() 2. All the parameters which need to be sent are given as separate arguments to MmRpc. This approach is needed when you need to translate an address which is ofsetted from a pointer which in itself needs to be translated. This apporach is followed for : process() For understanding, take the example of inbufs argument in process call(). Inbufs allocated in Shared memory and needs to be translated, has the address of Input buffer (allocated from Tiler). It is not possible to give the Input buffer as an argument to Mmrpc for translation until inbufs is given as a parameter to Mmrpc. Therefore inbuf can't be populated inside another Shared/Tiler memory struct. 3. This approach is a workaround to use approach [1] by solving the issue posed by [2]. This approach is followed for : get_version() Taking the example of inbufs to explain, the Input buffer address will be one of the parameters of the struct (explained in [1]) along with inbufs address. Therefore the Input buffer address will get translated here. At the IPU, this address needs to be copied back to inbufs. This patch aligns all DCE calls except Engine_Open to use Approach [2]. Engine_open still follows Approach [1] because: 1. Engine open takes in pointers to Engine_attrs and Error_code structures. The client may set both, none or either one of them to NULL (as allowed by CE). So that implies either I'll have to pass NULL as param_pointer to IPU or decide not to pass them at all. In the second case, I'll have to pass extra arguments to inform IPU that I have not passed Attrs or ErrorCode or both. I tried passing NULL but mmrpc_write failed. Dependent on ipumm patch: https://gerrit.ext.ti.com/gerrit/omap/#/c/12773 Change-Id: Ic770aaa99a56ea559efe9446e6e98d70726cc7c5 Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
[LIBDCE] Remove MmRpc translation param base The "base" field is no longer exposed by MmRpc from IPC 03.00.01.23 release as it can be calculated internally using the "offset" field. Hence this patch removes setting the field. Change-Id: I08df16e08042ae27bb2fa550b7126b3f7cae8fa6 Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
Fix to pass right translation param to IPC. The base field of the MmRpc_Xlt translation structure needs to be value of the address to be translated. The code was wrongly setting base to the location of the address. This has been corrected. This didn't create issues because the IPC doesnot use the base field for address translation. IPC uses offset to find the address to be translated. Change-Id: I404c7dc61cf3f4b5b584008b13336441420149d8 Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
[LIBDCE] Remove check for error_code in Engine_open This patch removes check for error_code in Engine_open because the Codec Engine doesnot expect a valid address. Change-Id: Id3286a101e290f6d987017741a0c194f53c19f94 Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>
[libDCE] Add IPC 3.x Adapted code to Repository This patch adds libdce code to the repository. LibDCE has been adapted to use the MmRpc layer of IPC 3.x. This version of LibDCE is expected to work on QNX. Patchset 2 adds/modifies: 1. Removes Tiler 2D allocation/free for now. 2. Corrects memplugin_free() for Tiler 1D. 3. Modifies dce_test app to dump output till 30 frames. 4. Renamed dce.h to libdce.h. 5. Corrected header files across all files. 6. Build configuration for QNX 7. Removes build warnings. 8. Add README for Build instructions 9. Takes care of comments of Buddy and Pradeep. Patchset 3 adds/modifies: 1. Reduced Stack usage of each function. 2. Add ptr check in memplugin and remove from libdce. 3. Add DCE_Assert macros. 4. Add DCE_error_status enum. 5. Comments Cleanup 6. Make some functions static. 7. process() cleanup including removing reply_buf. 8. Add else if (for codec_type == Encoder type) 9. Converted Macros to Inline functions. 10.Converted init and deinit to dce_init and dce_deinit functions. 11. Removed dce_init() and dce_deinit() declarations Patchset 4 adds/modifies: 1. Assert Input function arguments. 2. Correct copyright year. 3. Correct memplugin_free for Shared memory. 4. Create dce_priv.h and move trace and assert macros to the header. 5. Redeclare mem_type enum and add mem_error_status enum in memplugin.h and make corresponding changes. 6. Add asserts in memplugin. Intention of some of the changes above is to move towards delinking Libdce and Memplugin. Patchset 5: 1. Missed to add dce_priv.h file. Patchset 6: 1. Take care Pradeep's comment. Change-Id: I6e5e37b7088362e7bad66200fc3454bb828e0eff Signed-off-by: Saurabh Bipin Chandra <a0131926@ti.com>