cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Xilinx Employee
Xilinx Employee
5,179 Views
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
Reply
2 Replies
Highlighted
Xilinx Employee
Xilinx Employee
5,161 Views
Registered: ‎08-01-2008

check these XAPPs it may help you
http://www.xilinx.com/support/documentation/application_notes/xapp933.pdf

http://www.xilinx.com/support/documentation/application_notes/xapp1159-partial-reconfig-hw-accelerator-zynq-7000.pdf

http://www.xilinx.com/support/documentation/application_notes/xapp890-zynq-sobel-vivado-hls.pdf

Thanks and Regards
Balkrishan
--------------------------------------------------------------------------------------------
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
Reply
Highlighted
Xilinx Employee
Xilinx Employee
5,142 Views
Registered: ‎05-23-2016

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
Reply