使用g2d进行图像旋转,应用代码大致如下。
int g2dFd = open("/dev/g2d", O_RDWR);
static int rotate_hdmi_270(int srcFbFd, uint32_t dstFbFd, int w, int h)
{
printf("rotate_hdmi_270 : %d %d\n", srcFbFd, dstFbFd);
OSS_Sleep(1000);
if ( g2dFd < 0 )
{
return -1;
}
g2d_blt_h param;
param.flag_h = G2D_ROT_270;
param.src_image_h.fd = srcFbFd;
param.src_image_h.use_phy_addr = 0;
param.src_image_h.format = G2D_FORMAT_ARGB8888;
param.src_image_h.mode = G2D_GLOBAL_ALPHA;
param.src_image_h.clip_rect.x = 0;
param.src_image_h.clip_rect.y = 0;
param.src_image_h.clip_rect.w = w/2;
param.src_image_h.clip_rect.h = h/2;
param.src_image_h.width = w/2;
param.src_image_h.height = h/2;
param.src_image_h.alpha = 0xff;
param.dst_image_h.fd = dstFbFd;
param.dst_image_h.use_phy_addr = 0;
param.dst_image_h.format = G2D_FORMAT_ARGB8888;
param.dst_image_h.mode = G2D_GLOBAL_ALPHA;
param.dst_image_h.clip_rect.x = 0;
param.dst_image_h.clip_rect.y = 0;
param.dst_image_h.clip_rect.w = w/2;
param.dst_image_h.clip_rect.h = h/2;
param.dst_image_h.alpha = 0xff;
param.dst_image_h.width = w/2;
param.dst_image_h.height = h/2;
int ret = ioctl(g2dFd, G2D_CMD_BITBLT_H, (unsigned long)¶m);
if ( ret < 0 )
{
close(s_g2dFd);
return -1;
}
return 0;
}
在执行到内核驱动个g2d_rcq - g2d_rotate.c - g2d_rotate_set_para函数的write_wvalue写入操作时,系统抛出异常:
[ 206.605831] 8<--- cut here ---
[ 206.605845] Unable to handle kernel paging request at virtual address f0086000
[ 206.605858] pgd = 8a47d1fb
[ 206.605868] [f0086000] *pgd=41c0a811, *pte=00000000, *ppte=00000000
[ 206.605896] Internal error: Oops: 807 [#1] PREEMPT SMP ARM
[ 206.605907] Modules linked in: mali(O)
[ 206.605923] CPU: 2 PID: 1883 Comm: HdmiDispTask Tainted: G
dts的配置是这样的:
g2d: g2d@1e80000 {
compatible = "allwinner,sunxi-g2d";
reg = <0x0 0x01e80000 0x0 0x8000>;
interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_MP>, <&ccu CLK_DE_MP>, <&ccu CLK_MP_GATE>;
clock-names = "bus", "g2d", "mbus_g2d";
resets = <&ccu RST_BUS_MP>;
reset-names = "rst_bus_mp";
assigned-clocks = <&ccu CLK_DE_MP>;
assigned-clock-parents = <&ccu CLK_PLL_DE>;
assigned-clock-rates = <297000000>;
status = "okay";
};
dts reg属性改成:reg = <0x0 0x01e80000 0x0 0x40000>; 后内核不再抛出异常。
但是在:g2d_rotate_set_para-->g2d_wait_cmd_finish(unsigned int timeout) 时返回-1.
看上去中断有点问题。
请问: a40i g2d_rcq支持旋转吗? datasheet中并没有旋转相关的寄存器介绍。如果支持的话,是哪里出了问题? dts配置有问题吗?