我现在使用g2d_alloc的库函数自动分配内存地址如下:
struct g2d_buf *temp_buf=g2d_alloc(1834200,0);
这样可以得到该g2d 空间的物理地址和虚拟地址,temp_buf->buf_paddr和temp_buf->buf_vaddr,
我想给该地址写入一帧数据,但是在用memcpy时候出现了断错误,我是直接复制到虚拟地址temp_buf->buf_vaddr中的,memcpy(temp_buf->buf_vaddr,src_frame,1834200);我想问一下g2d_alloc分配的地址不能直接用memcpy直接赋值数据吗?如果我想给g2d_alloc分配的空间写入数据应该怎么做呢?除了用IPU的方式外?有没有直接把内存中的数据直接复制到g2d的空间中,类似memcpy操作。
you can try to use g2d_copy to copy the source buffer to the g2d allocated buffer
g2d_copy
Description:
G2d copy with specified size.
Syntax:
int g2d_copy(void *handle, struct g2d_buf *d, struct g2d_buf* s, int size);
Parameters:
handle g2d device handle
d destination buffer
s source buffer
size copy bytes
Limitations:
If the destination buffer is cacheable, it must be invalidated before g2d_copy
due to the alignment limitation of g2d driver.
Returns:
Success with 0, fail with -1