Toybrick

标题: RGA使用问题 [打印本页]

作者: 雁南飞    时间: 2023-9-8 09:53
标题: RGA使用问题
本帖最后由 雁南飞 于 2023-9-8 10:33 编辑

板子是rk 3568,在https://github.com/airockchip/librga 下载了librga以及参考了sample中rag_copy_demo.cpp,实现了以下代码:
  1. rga_buffer_t g_src_img;
  2. rga_buffer_t g_dst_img;
  3. rga_buffer_handle_t g_src_handle;
  4. rga_buffer_handle_t g_dst_handle;

  5. g_src_handle = 0;
  6. g_dst_handle = 0;
  7. memset(&g_src_img, 0, sizeof(g_src_img));
  8. memset(&g_dst_img, 0, sizeof(g_dst_img));
  9. memset(g_dst_buf, 0x80, width*height*3);
  10.   
  11. g_src_handle = importbuffer_virtualaddr((char*)mpp_buffer_get_ptr(buffer),  width*height*3);
  12. g_dst_handle = importbuffer_virtualaddr(g_dst_buf,  width*height*3);
  13. if (g_src_handle == 0 || g_dst_handle == 0)
  14. {
  15.       printf("importbuffer failed!\n");
  16.       return ;
  17. }

  18. g_src_img = wrapbuffer_handle(g_src_handle, width, height, RK_FORMAT_RGB_888);
  19. g_dst_img = wrapbuffer_handle(g_dst_handle, width, height, RK_FORMAT_RGB_888);

  20. IM_STATUS checkRet = imcheck(g_src_img, g_dst_img, {}, {});
  21. if (IM_STATUS_NOERROR != checkRet)
  22. {
  23.       printf("%d, check error! %s", __LINE__, imStrError((IM_STATUS)checkRet));
  24.       return;
  25. }

  26. printf("dest handle:%d handle:%d fd:%d vir:%x phy:%x\n", g_dst_handle, g_dst_img.handle, g_dst_img.fd, g_dst_img.vir_addr, g_dst_img.phy_addr);
  27. printf("src handle:%d handle:%d fd:%d vir:%x phy:%x\n", g_src_handle, g_src_img.handle, g_src_img.fd, g_src_img.vir_addr, g_src_img.phy_addr);
  28. IM_STATUS retStatus = imcopy(g_src_img, g_dst_img);
  29. if (retStatus == IM_STATUS_SUCCESS)
  30. {
  31.            printf("imcopy running success!\n");
  32. }
  33. else
  34. {
  35.            printf("imcopy running failed, %s\n", imStrError((IM_STATUS)retStatus));
  36. }

  37. //这里对g_dst_buf进行操作,写文件之类
  38. //......

  39. if (g_src_handle)
  40.             releasebuffer_handle(g_src_handle);
  41. if (g_dst_handle)
  42.             releasebuffer_handle(g_dst_handle);
复制代码
其中,printf打印的g_dst_handle、g_src_handle均为-1,fd,vir__addr, phy_addr这些值均为0,看着是不正常的。请问流程哪里出错了,或者还需要安装其他什么库?


其中,初始化的日志出现
  1. librga fail to get driver version! Compatibility mode will be enabled.

  2. 334 im2d_rga_impl rga_version_below_minimun_range_user_driver(304): The driver may be compatible, but it is best to update the driver to version 1.2.4. You can try to update the SDK or update the <SDK>/kernel/drivers/video/rockchip/rga3 directory individually. current version: librga 1.9.1, driver .
  3. rga_api version 1.9.1_[4]
复制代码







欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3