目标: 用im2d函数实现从相机采集的dma fd用rga格式转换成其他各种格式 通过从内核申请drm的fd bo_t bo_src; RockchipRga& rkRga(RockchipRga::get()); bpp= get_bpp_from_format(pixel_fmt)*8; ret= rkRga.RkRgaGetAllocBuffer(&bo_src,width, height, bpp); rkRga.RkRgaGetMmap(&bo_src); 并将drmfd转换成dma fd int fd; rkRga.RkRgaGetBufferFd(&bo_src,&fd); 封装后,变成rga_buffer_t rga_buffer_t rgaBuffer; rgaBuffer =wrapbuffer_fd(fd, width, height, pixel_fmt); 即可通过Im2d调用各种 Imcopy,imcovert等函数。采用瑞芯微推荐fd方式进行rga调用。 同时,通过RkRgaGetMmap获取到rgaBuffer的virtual address,我也会同时对该图的虚拟地址直接读写。 不知这样对一块空间的fd和虚拟地址直接操作是否有问题。这一套方式我之前在3399上运行都是正常的。 3588上程序运行也能跑,但是十分不稳定 经常出现入下图的错误,此时程序还能正常运行 file:///C:/Users/QGJ-PC/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg 有时程序就直接卡住了,dmesg显示内核打印如下: [ 1564.383100] rga2 fdb80000.rga: swiotlbbuffer is full (sz: 364544 bytes), total 32768 (slots), used 226 (slots) [ 1564.384021] rga_dma_buf: Failed to mapsrc attachment [ 1564.384473] rga_mm:rga_mm_map_dma_buffer core[4] map dma buffer error! [ 1564.385059] rga_mm: rga_mm_map_buffermap dma_buf error! [ 1564.385529] rga_mm: job buffer mapfailed! [ 1564.385900] rga_mm: src channel map jobbuffer failed! [ 1564.385906] rga_job: rga_job_run: failedto map buffer [ 1564.386858] rga_job: some error onrga_job_run before hw start, rga_job_next(342) [ 1564.387526] rga_job: some error on job,rga_job_commit(664) [ 1564.388022] rga_job: failed to commitjob! [ 1564.388390] rga: rga_request_commitfailed [ 1564.582791] rga_dma_buf: Failed to mapsrc attachment [ 1564.583259] rga_mm:rga_mm_map_dma_buffer core[4] map dma buffer error! [ 1564.583890] rga_mm: rga_mm_map_buffermap dma_buf error! [ 1564.584366] rga_mm: job buffer mapfailed! [ 1564.584735] rga_mm: src channel map jobbuffer failed! [ 1564.584740] rga_job: rga_job_run: failedto map buffer [ 1564.585659] rga_job: some error onrga_job_run before hw start, rga_job_next(342) [ 1564.586319] rga_job: some error on job,rga_job_commit(664) [ 1564.586835] rga_job: failed to commitjob! [ 1564.587204] rga: rga_request_commitfailed [ 1564.782764] rga_dma_buf: Failed to mapsrc attachment [ 1564.783231] rga_mm:rga_mm_map_dma_buffer core[4] map dma buffer error! [ 1564.783865] rga_mm: rga_mm_map_buffermap dma_buf error! [ 1564.784337] rga_mm: job buffer mapfailed! [ 1564.784705] rga_mm: src channel map jobbuffer failed! [ 1564.784710] rga_job: rga_job_run: failedto map buffer [ 1564.785635] rga_job: some error onrga_job_run before hw start, rga_job_next(342) [ 1564.786300] rga_job: some error on job,rga_job_commit(664) [ 1564.786814] rga_job: failed to commitjob! [ 1564.787186] rga: rga_request_commitfailed [ 1565.182717] rga_dma_buf: Failed to mapsrc attachment [ 1565.183184] rga_mm:rga_mm_map_dma_buffer core[4] map dma buffer error! [ 1565.183813] rga_mm: rga_mm_map_buffermap dma_buf error! [ 1565.184285] rga_mm: job buffer mapfailed! [ 1565.184656] rga_mm: src channel map jobbuffer failed! [ 1565.184661] rga_job: rga_job_run: failedto map buffer [ 1565.185586] rga_job: some error onrga_job_run before hw start, rga_job_next(342) [ 1565.186253] rga_job: some error on job,rga_job_commit(664) [ 1565.186768] rga_job: failed to commitjob! [ 1565.187136] rga: rga_request_commitfailed [ 1565.299403] rga_dma_buf: Failed to mapsrc attachment [ 1565.299875] rga_mm:rga_mm_map_dma_buffer core[4] map dma buffer error! [ 1565.300503] rga_mm: rga_mm_map_buffermap dma_buf error! [ 1565.300977] rga_mm: job buffer mapfailed! [ 1565.301346] rga_mm: src channel map jobbuffer failed! [ 1565.301351] rga_job: rga_job_run: failedto map buffer [ 1565.302270] rga_job: some error onrga_job_run before hw start, rga_job_next(342) [ 1565.302929] rga_job: some error on job,rga_job_commit(664) [ 1565.303444] rga_job: failed to commitjob! [ 1565.303816] rga: rga_request_commitfailed [ 1565.499352] rga_dma_buf: Failed to mapsrc attachment [ 1565.499815] rga_mm:rga_mm_map_dma_buffer core[4] map dma buffer error! [ 1565.500437] rga_mm: rga_mm_map_buffermap dma_buf error! [ 1565.500908] rga_mm: job buffer mapfailed! [ 1565.501278] rga_mm: src channel map jobbuffer failed! 最好能给个用fd方式,通过im2d实现rga转换的例子
|