kernel icon indicating copy to clipboard operation
kernel copied to clipboard

Usage of /dev/rga2

Open MockbaTheBorg opened this issue 5 years ago • 0 comments

Hi there folks.

I am trying to access the rga2 on a rk3288 device I have running linux. The kernel exposes /dev/rga2. I then wrote this small program just to print the device's rga2 version:

#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>

#define RGA2_BLIT_SYNC	 0x6017
#define RGA2_BLIT_ASYNC  0x6018
#define RGA2_FLUSH       0x6019
#define RGA2_GET_RESULT  0x601a
#define RGA2_GET_VERSION 0x601b

int main() {
	int fd=-1;
	int ret;
	float mVersion;
	char buf[30] = {};

	printf("Opening /dev/rga2 ... ");
	fd = open("/dev/rga2", O_RDWR, 0);
	if(fd < 0) {
		printf("Error! (%d)\n", fd);
		exit(1);
	} else {
		printf("Ok! (%d)\n", fd);
	}

	printf("Getting version ... ");
	ret = ioctl(fd, RGA2_GET_VERSION, buf);
	printf("Ok! (%d)\n", ret);
	mVersion = atof(buf);
	printf("Version: %f\n", mVersion);
}

But when I run the call it returns -1 and gives me the version as 0.000. I was expecting 2.000 or higher. If I run the same code on a different box, a Radxa Rock pro, by changing the id to 0x501b and the device to /dev/rga it works fine and gives me the version 1.003 (or something like that). By looking at the video driver code it looks to me that the calls should be the same. I can't find out what I am missing here. This might not be the right place to ask for it, but I did a LOT of googling for any rga2 examples/clients and couldn't find anything. I am banging my head to the wall. Any help here will be immensely appreciated.

Thanks, Marcelo.

MockbaTheBorg avatar Oct 26 '20 21:10 MockbaTheBorg