We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Xilinx Employee
Xilinx Employee
Registered: ‎10-22-2015

Passing pointers to sds_alloc'ed memory space

If my function takes sds_alloc'ed memory as inputs, for example:

void video_filter(unsigned char yc_in[NUMROWS*NUMCOLS*3],
unsigned char yc_out[NUMROWS*NUMCOLS*3]);


where yc_in and yc_out can be allocated using sds_alloc().


I also have a video buffer having a known address. Suppose the memory space associated with this address is a consecutive block, initialized by other functions.


What I should do to pass the video buffer address to this video_filter function? (I tried to pass the pointer as unsigned char*, but that failed).

0 Kudos
2 Replies
Xilinx Employee
Xilinx Employee
Registered: ‎08-01-2008

Re: Passing pointers to sds_alloc'ed memory space

check these XAPPs it may help you



Thanks and Regards
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.
0 Kudos
Xilinx Employee
Xilinx Employee
Registered: ‎05-23-2016

Re: Passing pointers to sds_alloc'ed memory space

Generally the way that we deal with things like this, particularly for the purpose of video processing, is to hook into a linux driver for the video in/out.  Part of this driver will be exposure of a DRM GEM [Direct Rendering Manager, Graphics Execution Manager] device that allows you to memmap the physical frame buffer address into a virtual memory region in user space.  An additional thing this layer gives you is a handle to a DRM buffer.  SDSoC supports registering this buffer as a uncacheable/physically contiguous resource with a call to sds_register_dmabuf, and enables it to be interacted with as if it had been allocated with sds_alloc_non_cacheable.


The plumbing for all this is a bit of a mess, because it involves interacting with linux video capture devices and output frame buffers, along with all their management.  If you want to see an example of this, check out the SDSoC zc706 HDMI sobel filter video reference design [http://www.xilinx.com/products/design-tools/software-zone/sdsoc.html#boardskits ].  Once you've got all the DRM boiler plate stuff bolted on, it works quite well.  It'll also require a bit of device tree manipulation, but chances are you can scrape the device tree, and the boiler plate code, out of the video sample design pretty easily.


Crack the design open, and find sds_register_dmabuf, and it'll lead you right to it.

Tags (1)
0 Kudos