- /dev/rga
复制代码
- sudo apt install rockchip-rga-dev
复制代码
- https://github.com/rockchip-linux/linux-rga
- https://github.com/airockchip/librga
复制代码
- https://github.com/Jerzha/samples-toybrick-rga.git
复制代码
新RGA教学sample在rga自带目录的sample目录下- RockchipRga *mRga;
- if (!mRga) {
- printf("create rga failed !\n");
- abort();
- }
- mRga->ops->initCtx(mRga);
复制代码
- mRga->ops->setSrcFormat(mRga, V4L2_PIX_FMT_ABGR32, BUFFER_WIDTH, BUFFER_HEIGHT);
- mRga->ops->setDstFormat(mRga, V4L2_PIX_FMT_ABGR32, BUFFER_WIDTH, BUFFER_HEIGHT);
复制代码
- mRga->ops->setSrcBufferPtr(mRga, srcBuffer);
- mRga->ops->setDstBufferPtr(mRga, dstBuffer);
复制代码
- mRga->ops->setSrcBufferFd(mRga, srcFd);
- mRga->ops->setDstBufferFd(mRga, dstFd);
复制代码
- mRga->ops->setRotate(mRga, RGA_ROTATE_90); // RGA_ROTATE_180, RGA_ROTATE_270
复制代码
- mRga->ops->setSrcCrop(mRga, crop_x, crop_y, crop_w, crop_h);
复制代码
- mRga->ops->go(mRga);
复制代码
hjf515 发表于 2019-4-18 15:38
跑了例程 rga_cpy,发现 checkData 函数中打印出很多dst和src 不一致的数据,这是不是说用 rga copy 有点不 ...
盗骊_l 发表于 2019-7-8 16:15
您好,请问我在Android平台上应该怎么使用 RGA,头文件从哪里来?需要编译什么源码吗? ...
jefferyzhang 发表于 2019-7-9 16:10
android rga查看 device/rockchip/librga
用法不太一样
- //格式转换 NV12->ABGR
- void rga_convert()
- {
- RockchipRga *rga = RgaCreate();
- if (!rga) {
- printf("create rga failed !\n");
- abort();
- }
- rga->ops->initCtx(rga);
- //V4L2_PIX_FMT_NV12 V4L2_PIX_FMT_ABGR32
- rga->ops->setSrcFormat(rga, V4L2_PIX_FMT_NV12, BUFFER_WIDTH, BUFFER_HEIGHT);
- rga->ops->setDstFormat(rga, V4L2_PIX_FMT_ABGR32, BUFFER_WIDTH, BUFFER_HEIGHT);
- rga->ops->setSrcBufferPtr(rga, srcBuffer);
- rga->ops->setDstBufferPtr(rga, dstBuffer);
- rga->ops->go(rga);
- }
复制代码
盗骊_l 发表于 2019-7-9 19:15
啊?上面不是说 Android和Linux一致吗?
https://github.com/Jerzha/samples-toybrick-rga上面的demo, ...
15992605143 发表于 2019-9-6 22:31
rga可以按比例缩放吗?
- RockchipRga *rga = RgaCreate();
复制代码
,初始化一个rga的上下文,一路视频解码后使用RGA转换输出都正常,2路视频解码RGA转换一段时间后,设备重启,3路视频解码,10分钟左右就会造成,设备重启,请问这是什么原因?解码、格式转换结果都正常,就是多路多线程中,一段时间后会造成设备重启。盗骊_l 发表于 2019-9-9 13:59
请问,多线程使用的时候需要注意什么?
我现在遇到的问题:
1>.每个线程里,mpp解码后使用RGA进行格式转换,, ...
shopping 发表于 2019-9-17 17:15
老哥,最近抽时间看了下你发的一些资料,问一句:
1.目前我除了用 opencv 调取摄像头,将视频数据裁剪缩放 ...
jefferyzhang 发表于 2019-9-17 18:03
所以要问啥呢?我看了半天不知道你问题是啥
shopping 发表于 2019-9-18 09:45
老哥,我想问的是,现在我想不用opencv库,因为它占用内存较大。所以替代方案就是:
GStreamer/MPP 来调 ...
shopping 发表于 2019-9-18 11:22
千头万绪,理不清楚,现在感觉脑子一片混沌。再追问一下:Debian系统下,MPP OpenGL GStreamer RGA我都 ...
jefferyzhang 发表于 2019-9-18 14:15
请自行看wiki,全部都是dnf安装就可以。
当然除了opengl以外都有源码,愿意自己编译安装也行 ...
shopping 发表于 2019-9-20 14:45
呃,请问 OpenGL 要怎么安装?还有我测试RGA时报了这样的问题,请问我这个RGA是安装好了? ...
jefferyzhang 发表于 2019-9-20 16:30
rga不需要装,他是硬件的一个设备,挂载在/dev/rga下。
封装的rga库只是方便大家访问这个外设而已 ...
shopping 发表于 2019-9-20 17:07
难怪编译的时候是把它目录下的 cpp 文件给编译了,那 OpenGl 呢,老哥。
jefferyzhang 发表于 2019-9-20 18:09
ogl请用dnf安装 ocl 包。 mali的 cl和gl是同一个so。
目前我们暂时只能放cl里,系统自带的gl依赖太多,我 ...
shopping 发表于 2019-10-8 15:44
老哥,关于这个OpenGL库,如果我直接用 FrameBuffer 显示图片/视频,这样是否可行?即 V4L2+ FrameBuffer ...
jefferyzhang 发表于 2019-10-9 10:35
Linux 4.x以后就改用DRM框架了,没有FB设备了
shopping 发表于 2019-10-9 10:42
好吧,这几天的FB白看了,看样子最后还是得用 OpenGL 来做显示?还有老哥,V4L2它有解码功能这与MPP功能是 ...
jefferyzhang 发表于 2019-10-9 17:36
v4l2没有解码,openGL只是GPU接口,最终绘制还是要走到DRM。
shopping 发表于 2019-10-9 19:31
老哥,我刚刚又看了一遍代码,V4L2框架调用摄像头输出格式已经是 yuv422 格式了,可以直接保存成 yuv文件 ...
jefferyzhang 发表于 2019-10-10 08:33
那是因为你的usb相机出来的格式就是yuv422
- // rga start
- srcBuffer = (unsigned char*)malloc(sizeof(unsigned char) * BUFFER_SIZE_src); // yuyv BUFFER_SIZE_src = MAGE_WIDTH*IMAGE_HEIGHT*2
- dstBuffer = (unsigned char*)malloc(sizeof(unsigned char) * BUFFER_SIZE_det); // RGB BUFFER_SIZE_det = MAGE_WIDTH*IMAGE_HEIGHT*3
- RockchipRga *mRga = RgaCreate();
- if (!mRga) {
- printf("create rga failed !\n");
- abort();
- }
- mRga->ops->initCtx(mRga);
- mRga->ops->setSrcFormat(mRga, V4L2_PIX_FMT_YUYV, IMAGE_WIDTH, IMAGE_HEIGHT);
- mRga->ops->setDstFormat(mRga, V4L2_PIX_FMT_BGR24, IMAGE_WIDTH, IMAGE_HEIGHT);
- struct v4l2_buffer enqueue,dequeue ;
- memset(&enqueue, 0, sizeof(enqueue));
- memset(&dequeue, 0, sizeof(dequeue));
- enqueue.type = V4L2_BUF_TYPE_VIDEO_CAPTURE ;
- enqueue.memory = V4L2_MEMORY_MMAP ;
- dequeue.type = V4L2_BUF_TYPE_VIDEO_CAPTURE ;
- dequeue.memory = V4L2_MEMORY_MMAP ;
- while (1)
- {
- // loop start
- // dequeue
- ioctl(fd, VIDIOC_DQBUF, &dequeue) ; // get frame v4l2取缓存帧
- //memcpy((void*)srcBuffer , buffers[dequeue.index].start , dequeue.length);
- srcBuffer = (unsigned char *)buffers[dequeue.index].start; // 将取出来的缓存帧起始地址赋给 srcBuffer
- mRga->ops->setSrcBufferPtr(mRga, srcBuffer);
- mRga->ops->setDstBufferPtr(mRga, dstBuffer);
- mRga->ops->go(mRga);
- unchar_to_Mat(dstBuffer); // 将 unsigned char BGR格式转换为 Mat BGR格式
- cv::imshow("image",img);
- cv::waitKey(20);
- //enqueue
- enqueue.index = dequeue.index ;
- ioctl(fd, VIDIOC_QBUF, &enqueue) ; // enqueue
- }
- ioctl(fd, VIDIOC_STREAMOFF, &type);
- free(srcBuffer);
- free(dstBuffer);
- for(int i=0;i<req.count;i++)
- {
- munmap(buffers[i].start,buffers[i].length);
- }
- return(TRUE);
- }
复制代码
shopping 发表于 2019-10-11 11:17
老哥,用RGA转换格式出现花屏重影的问题。我自己写了个 yuv422 转 BGR 的函数,结果显示正常,RGA sample ...
jefferyzhang 发表于 2019-10-11 14:28
RGA不支持BGR和422,422也是软转的
shopping 发表于 2019-10-11 14:46
刚刚回去看了下官方文档,果然不支持 BGR 和 YUV422,又走了弯路。
will92 发表于 2019-10-21 16:31
请问rga的官方文档在哪里可以找到呢?
heyunteng251314 发表于 2019-10-29 16:01
版主你好!对于RGA模块,我有个疑问的是mRga->ops->go(mRga)这个函数的程序代码是跑在RGA模块上嘛?
我下这 ...
jefferyzhang 发表于 2019-10-29 16:20
安卓linux是通用的,并且安卓有自己单独一套接口。
Linux你用这个就可以了。
RGA是一个IP核,不会执行cpu ...
shopping 发表于 2019-10-21 17:00
官方给的固件包里附带的,docs目录下。
时光丶 发表于 2019-12-2 10:27
我找到了一个RKDocs文件夹,请问rga的文档叫啥?
shopping 发表于 2019-12-2 10:39
具体什么名字忘了,反正名字里面有RGA,记得docs目录下叫RGA的就一个,你直接搜RGA就行了
...
puresoy 发表于 2020-1-6 16:51
试了试 rga本身是能使的
但是在没有drm的情况下 rga_copy的速度甚至比memcpy的速度慢一半
可是ubuntu系统(D ...
cjlongfei 发表于 2020-3-11 09:38
直接下载GITHUB上的源码,在板子上编译生成,rag_cpy,运行被Aborted了,是什么原因?好像是崩在RgaCreate这 ...
cjlongfei 发表于 2020-3-11 10:01
RK3399P的,我加SUDO和卸载之前安装的RGA库以后搞定了。现在可以了。
顺便问另外一个问题,在RTSP推流那 ...
cjlongfei 发表于 2020-3-11 09:38
直接下载GITHUB上的源码,在板子上编译生成,rag_cpy,运行被Aborted了,是什么原因?好像是崩在RgaCreate这 ...
panziwen86 发表于 2020-4-7 15:46
我在RK3399Pro上使用samples-toybrick-rga进行格式转换,程序刚开始没有问题,图片格式转换也正常,但总是 ...
cjlongfei 发表于 2020-3-11 10:01
RK3399P的,我加SUDO和卸载之前安装的RGA库以后搞定了。现在可以了。
顺便问另外一个问题,在RTSP推流那 ...
- rga->ops->setSrcFormat(rga, V4L2_PIX_FMT_NV12, BUFFER_WIDTH, BUFFER_HEIGHT);
- rga->ops->setDstFormat(rga, V4L2_PIX_FMT_BGR24, BUFFER_WIDTH, BUFFER_HEIGHT);
复制代码
ddcat1991 发表于 2020-4-13 18:20
弱弱的问一下, 这个RGA设备 支持 NV12->BGR24的图像转换吗?, 我转出来花屏了, (也可能是opencv使用方法不 ...
leonardo 发表于 2020-7-20 17:31
你好,
我们过去在其他平台上做视频图像相关的处理开发。目前想把所有开发移植到3399平台上来。我先描述 ...
jefferyzhang 发表于 2020-7-20 18:01
你发个帖子问不好么。。。发这只有我看得到。。
1. 支持
2. 支持
jefferyzhang 发表于 2019-10-10 08:33
那是因为你的usb相机出来的格式就是yuv422
JackXu9527 发表于 2020-7-23 22:54
你好!请问对于网络摄像头的RTSP视频流如何在RK3399Pro上在android平台下如何读取并送SDK识别呢? ...
JackXu9527 发表于 2020-7-24 08:50
你好,我没看明白你说的意思。我已经从RTSP视频流中获取了单帧图像,我该如何处理转换为imagebuffer格式 ...
JackXu9527 发表于 2020-7-24 10:28
你好!请问Bitmap不能转为imagebuffer吗?
jefferyzhang 发表于 2020-7-24 11:09
代码自己写,baidu、google。android又不是我们发明的,你不能不会写代码也跑来问我们吧 ...
JackXu9527 发表于 2020-7-25 17:13
我只是请教一下思路,你又是发省略号又是质问我,我不知道你哪来的那么大的火气?要是谷歌百度能找到我还 ...
cjlongfei 发表于 2020-3-11 10:01
RK3399P的,我加SUDO和卸载之前安装的RGA库以后搞定了。现在可以了。
顺便问另外一个问题,在RTSP推流那 ...
jefferyzhang 发表于 2019-10-29 16:20
安卓linux是通用的,并且安卓有自己单独一套接口。
Linux你用这个就可以了。
RGA是一个IP核,不会执行cpu ...
lily393 发表于 2020-11-23 17:11
也就是上面那个源码也适用于firefly的板子么?
jefferyzhang 发表于 2019-4-18 16:59
rga其实就是一个ioctl,填下结构体就可以了,建议你看库源码自己实现一个,或者用android写好的librga库 ...
lily393 发表于 2020-11-25 16:52
想问下 RGA加速 测试demo 跑出来rgb转nv12 要5ms 1280*720 resize 到720*480 后
要10ms 这个算正常 ...
jefferyzhang 发表于 2020-11-25 16:54
使用DMA内存的话,这速度不正常;
如果使用的是虚拟内存的话,那很正常。 ...
seanx 发表于 2020-11-27 10:00
请问一下:
1. 如果送入 RGA 的图像是通过 imread 等方式获取的,无法确保宽高 16 对齐,这种情况要怎么处 ...
xyyangkun 发表于 2021-3-16 09:50
你好,我想使用rga模块做两个视频的合成叠加,就是把一个视频叠加到另外一个视频中,视频是yuv422,如果视频 ...
xinzhiling111 发表于 2021-5-24 18:33
rga进行图像缩放的时候,宽度和高度必须同时都是放大或者缩小吗?是否可以宽度缩小,高度放大?实际测试中 ...
- <div style="color: #d4d4d4;background-color: #1e1e1e;font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 18px;line-height: 24px;white-space: pre;">
- <div><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">createDrmMap</span><span style="color: #d4d4d4;">(</span><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">drm_fd</span><span style="color: #d4d4d4;">, </span><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">bpp</span><span style="color: #d4d4d4;">, </span><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">width</span><span style="color: #d4d4d4;">, </span><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">height</span><span style="color: #d4d4d4;">, </span><span style="color: #569cd6;">struct</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">fdmmap_s</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">*</span><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;">{</span></div><div><span style="color: #569cd6;">struct</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">drm_mode_create_dumb</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #569cd6;">struct</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">drm_mode_map_dumb</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">map_arg</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> ret;</span></div><div><span style="color: #dcdcaa;">memset</span><span style="color: #d4d4d4;">(&arg, </span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">, </span><span style="color: #569cd6;">sizeof</span><span style="color: #d4d4d4;">(arg));</span></div><div><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">bpp</span><span style="color: #d4d4d4;"> = bpp;</span></div><div><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">width</span><span style="color: #d4d4d4;"> = width;</span></div><div><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">height</span><span style="color: #d4d4d4;"> = height;</span></div><div><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"bpp=%d, width=%d, height=%d</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">bpp</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">width</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">height</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;">ret = </span><span style="color: #dcdcaa;">drmIoctl</span><span style="color: #d4d4d4;">(drm_fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg);</span></div><div><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (ret) {</span></div><div><span style="color: #dcdcaa;">perror</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"failed to create dumb buffer"</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> ret;</span></div><div><span style="color: #d4d4d4;">}</span></div><div><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">handle</span><span style="color: #d4d4d4;"> = </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">handle</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">size</span><span style="color: #d4d4d4;"> = </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">size</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">pitch</span><span style="color: #d4d4d4;"> = </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">pitch</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"bpp=%d, width=%d, height=%d, size=%d, pitch=%d</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">bpp</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">width</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">height</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">size</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">pitch</span><span style="color: #d4d4d4;">);</span></div>
- <div><span style="color: #dcdcaa;">memset</span><span style="color: #d4d4d4;">(&map_arg, </span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">, </span><span style="color: #569cd6;">sizeof</span><span style="color: #d4d4d4;">(map_arg));</span></div><div><span style="color: #9cdcfe;">map_arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">handle</span><span style="color: #d4d4d4;"> = </span><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">handle</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;">ret = </span><span style="color: #dcdcaa;">drmIoctl</span><span style="color: #d4d4d4;">(drm_fd, DRM_IOCTL_MODE_MAP_DUMB, &map_arg);</span></div><div><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (ret)</span></div><div><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> ret;</span></div><div><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">buf</span><span style="color: #d4d4d4;"> = (</span><span style="color: #569cd6;">char</span><span style="color: #d4d4d4;"> *)</span><span style="color: #dcdcaa;">mmap</span><span style="color: #d4d4d4;">(</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">size</span><span style="color: #d4d4d4;">, PROT_READ | PROT_WRITE, MAP_SHARED, drm_fd, </span><span style="color: #9cdcfe;">map_arg</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">offset</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (</span><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">buf</span><span style="color: #d4d4d4;"> == MAP_FAILED)</span></div><div><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> -</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #dcdcaa;">drmPrimeHandleToFD</span><span style="color: #d4d4d4;">(drm_fd, </span><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">handle</span><span style="color: #d4d4d4;">, </span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">, &</span><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">fd</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"drm_fd=%d, map->fd=%d</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">, drm_fd, </span><span style="color: #9cdcfe;">map</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">fd</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> </span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;">}</span></div><div><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">main</span><span style="color: #d4d4d4;">(</span><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">argc</span><span style="color: #d4d4d4;">, </span><span style="color: #569cd6;">char</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">argv</span><span style="color: #d4d4d4;">[])</span></div><div><span style="color: #d4d4d4;">{</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> drm_fd, ret;</span></div><div><span style="color: #d4d4d4;"> drm_fd = </span><span style="color: #dcdcaa;">open</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"/dev/dri/card0"</span><span style="color: #d4d4d4;">, O_RDWR, </span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;">( drm_fd <=</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> {</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">perror</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"open dri card0"</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> -</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> }</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;">( </span><span style="color: #dcdcaa;">createDrmMap</span><span style="color: #d4d4d4;">(drm_fd, </span><span style="color: #dcdcaa;">get_bpp_from_format</span><span style="color: #d4d4d4;">(SRC_FORMAT), SRC_WIDTH, SRC_HEIGHT, &map_src)<</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> {</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"createDrmMap map_src error</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> -</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> }</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"map_src.size=%d</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">map_src</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">size</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;">( </span><span style="color: #dcdcaa;">createDrmMap</span><span style="color: #d4d4d4;">(drm_fd, </span><span style="color: #dcdcaa;">get_bpp_from_format</span><span style="color: #d4d4d4;">(DST_FORMAT), DST_WIDTH, DST_HEIGHT, &map_dst)<</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> {</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"createDrmMap map_dst error</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> -</span><span style="color: #b5cea8;">2</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> }</span></div><div><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"createDrmMap map_src/map_dst ok</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">);</span></div>
- <div><span style="color: #d4d4d4;"> ret = </span><span style="color: #dcdcaa;">get_buf_from_file</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">map_src</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">buf</span><span style="color: #d4d4d4;">, SRC_FORMAT, SRC_WIDTH, SRC_HEIGHT, </span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (!ret)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"open src file ok</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;"> (</span><span style="color: #ce9178;">"can not open file</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;">(MODE == MODE_BLEND || MODE == MODE_FILL) {</span></div><div><span style="color: #d4d4d4;"> ret = </span><span style="color: #dcdcaa;">get_buf_from_file</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">map_dst</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">buf</span><span style="color: #d4d4d4;">, DST_FORMAT, DST_WIDTH, DST_HEIGHT, </span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (!ret)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"open dst file</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;"> (</span><span style="color: #ce9178;">"can not open file</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> } </span><span style="color: #c586c0;">else</span><span style="color: #d4d4d4;"> {</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"map_dst.size=%d, get_bpp_from_format(DST_FORMAT)=%d</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">map_dst</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">size</span><span style="color: #d4d4d4;">, </span><span style="color: #dcdcaa;">get_bpp_from_format</span><span style="color: #d4d4d4;">(DST_FORMAT));</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">memset</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">map_dst</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">buf</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">0x00</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">map_dst</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">size</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #6a9955;"> // memset(map_dst.buf,0x00,DST_WIDTH*DST_HEIGHT*get_bpp_from_format(DST_FORMAT));</span></div><div><span style="color: #d4d4d4;"> }</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printf</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"get_buf_from_file ok</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> src = </span><span style="color: #dcdcaa;">wrapbuffer_fd</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">map_src</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">fd</span><span style="color: #d4d4d4;">, SRC_WIDTH, SRC_HEIGHT, SRC_FORMAT);</span></div><div><span style="color: #d4d4d4;"> dst = </span><span style="color: #dcdcaa;">wrapbuffer_fd</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">map_dst</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">fd</span><span style="color: #d4d4d4;">, DST_WIDTH, DST_HEIGHT, DST_FORMAT);</span></div><div><span style="color: #d4d4d4;"> ......</span></div><div><span style="color: #d4d4d4;">}</span></div></div>
复制代码
会飞的大白菜 发表于 2021-9-29 18:30
大佬,你好,我现在做的是一个人脸识别的项目,为了减少cpu的负担,就需要拷贝每一帧的图像进行旋转处理, ...
Ainux 发表于 2022-1-11 15:27
版主:
你好!
此篇文档中的“基础使用流程”中的WIKI教程连接失效,无法打开,可否修改一 ...
Ainux 发表于 2022-1-11 15:31
DEBIAN10 librockchip_rga-devel源里无此包?
btxc_cyy 发表于 2022-4-8 16:36
链接失效了啊,还有没有人维护这个库?
jefferyzhang 发表于 2022-4-8 16:55
下架审查,toybrick用户直接apt install rockchip-rga即可,其他客户请自行联系代理商或者业务获取 ...
848451399 发表于 2022-6-16 15:48
请问有rga的源码吗,我的是3399pro板子,但是使用rga库的时候会报"/lib/aarch64-linux-gnu/libm.so.6: vers ...
848451399 发表于 2022-6-17 10:31
我用的就是这里面的库.开发的时候用这个库会提示librga.so: undefined reference to `' ...
richard 发表于 2023-2-3 11:25
请问rga->go这套接口和imcvtcolor这两套接口有什么区别呢
欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |