|
沙发
楼主 |
发表于 2020-9-28 10:40:22
|
只看该作者
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <rockchip/rockchip_drm.h>
#include <fcntl.h>
#define SIZE_1M (1 << 20)
int main(int arc, char **argv)
{
int fd, ret = 0;
CmaBuffer *cma = NULL;
DrmBuffer *drm = NULL;
const char* card;
card = "/dev/dri/card0";
/* open the DRM device */
fd = open(card, O_RDWR | O_CLOEXEC);
printf("return %d\n", fd);
//fd = RockchipDrmOpen();
if(fd < 0)
return fd;
cma = RockchipCmaAlloc(fd, SIZE_1M);
if(!cma) {
ret = -ENOMEM;
goto exit;
}
drm = RockchipDrmAlloc(fd, V4L2_PIX_FMT_BGR24, 1920, 1080);
if(!drm) {
ret = -ENOMEM;
goto exit;
}
printf("--------run---------\n");
/* TODO: cma and drm buffer operation */
exit:
if(drm)
RockchipDrmFree(fd, drm);
if(cma)
RockchipCmaFree(fd, cma);
RockchipDrmClose(fd);
return ret;
}
|
|