G2D seems to break if a zero value of src_rect.w or src_rect.h is
provided to g2d_blit, g2d_fill or g2d_stretchblit.
para.src_rect.w == 0 or para.src_rect.h == 0 results in trying to write
-1 toG2D_DMA0_SIZE_REG register within the mixer_* functions, e.g. here
https://github.com/linux-sunxi/linux-sunxi/blob/sunxi-3.4/drivers/char/sunxi_g2d/g2d_bsp.c#L682
The following patch catches these zero value cases.
diff --git a/drivers/char/sunxi_g2d/g2d.c b/drivers/char/sunxi_g2d/g2d.c
index 7982a54..288685a 100644
--- a/drivers/char/sunxi_g2d/g2d.c
+++ b/drivers/char/sunxi_g2d/g2d.c
@@ -138,7 +138,8 @@ int g2d_blit(g2d_blt * para)
__s32 err = 0;
/* check the parameter valid */
- if(((para->src_rect.x < 0)&&((-para->src_rect.x) > para->src_rect.w)) ||
+ if(para->src_rect.w == 0 || para->src_rect.h == 0 ||
+ ((para->src_rect.x < 0)&&((-para->src_rect.x) > para->src_rect.w)) ||
((para->src_rect.y < 0)&&((-para->src_rect.y) > para->src_rect.h)) ||
((para->dst_x < 0)&&((-para->dst_x) > para->src_rect.w)) ||
((para->dst_y < 0)&&((-para->dst_y) > para->src_rect.h)) ||
@@ -204,7 +205,8 @@ int g2d_fill(g2d_fillrect * para)
__s32 err = 0;
/* check the parameter valid */
- if(((para->dst_rect.x < 0)&&((-para->dst_rect.x)>para->dst_rect.w)) ||
+ if(para->dst_rect.w == 0 || para->dst_rect.h == 0 ||
+ ((para->dst_rect.x < 0)&&((-para->dst_rect.x)>para->dst_rect.w)) ||
((para->dst_rect.y < 0)&&((-para->dst_rect.y)>para->dst_rect.h)) ||
((para->dst_rect.x > 0)&&(para->dst_rect.x > para->dst_image.w - 1))
||
((para->dst_rect.y > 0)&&(para->dst_rect.y > para->dst_image.h - 1)))
@@ -245,7 +247,9 @@ int g2d_stretchblit(g2d_stretchblt * para)
__s32 err = 0;
/* check the parameter valid */
- if(((para->src_rect.x < 0)&&((-para->src_rect.x) > para->src_rect.w)) ||
+ if(para->src_rect.w == 0 || para->src_rect.h == 0 ||
+ para->dst_rect.w == 0 || para->dst_rect.h == 0 ||
+ ((para->src_rect.x < 0)&&((-para->src_rect.x) > para->src_rect.w)) ||
((para->src_rect.y < 0)&&((-para->src_rect.y) > para->src_rect.h)) ||
((para->dst_rect.x < 0)&&((-para->dst_rect.x) > para->dst_rect.w)) ||
((para->dst_rect.y < 0)&&((-para->dst_rect.y) > para->dst_rect.h)) ||
Sorry for not posting it in the right patch format, i'll do that later.
Thanks jemk for the hint.
Regards
Am 20.03.2014 09:58, schrieb Andreas Baierl:
For testing purposes, setting timeout=500 has the effect, that OSD
stops flickering, but instead of the correct image, only a black area
with OSD dimensions is displayed.
"wait g2d irq pending flag timeout" still is there.
I also applied
https://github.com/amery/linux-sunxi/commit/7015bbb75ac57b , no
knowing, what it is doing due to lack of register documentation. Has
no positive effect, too.
So no positive feedback so far.
Regards
Andreas
Am 05.03.2014 20:32, schrieb Andreas Baierl:
Am 04.03.2014 11:56, schrieb Andreas Baierl:
Hi all,
it seems, that the G2D kernel driver has some issue:
libvdpau-sunxi uses G2D_CMD_BITBLT for creating surfaces, so at the
end of mixer_blt, there is g2d_wait_cmd_finish() called.
As soon as (timeout==0) gets TRUE in
https://github.com/linux-sunxi/linux-sunxi/blob/sunxi-3.4/drivers/char/sunxi_g2d/g2d.c#L120
, g2d stops working.
It's not possible to interact with /dev/g2d anymore until you reboot
(or possibly un-/reload the module).
I'm not sure how to exactly reproduce that. It mostly occurs the
second time i start VDR with libvdpau-sunxi and OSD.
Regards
rellla
I don't know if it's related to the above, but unloading the kernel
module g2d_23 after it stopped working with the "wait g2d irq pending
flag timeout" message shows me the following log:
[ 735.058259] [DISP] layer allocated: 0,102
[ 735.065332] [DISP] layer allocated: 0,103
[ 735.227857] wait g2d irq pending flag timeout
[ 783.215100] [DISP] layer released: 0,102
[ 783.222385] [DISP] layer released: 0,103
[ 792.500779] [DISP] layer released: 0,101
[ 792.541549] UMP<2>: Session closed
[ 795.070534] G2D: g2d_module_exit
[ 795.080032] G2D: Driver unloaded succesfully.
[ 795.092261] ------------[ cut here ]------------
[ 795.105471] WARNING: at drivers/base/core.c:196
device_release+0x78/0x84()
[ 795.122342] Device 'g2d' does not have a release() function, it is
broken and must be fixed.
[ 795.135209] Modules linked in: disp_ump mali_drm drm g2d_23(-)
sunxi_cedar_mod sw_ahci_platform mali ump
[ 795.162378] [<c0014a4c>] (unwind_backtrace+0x0/0x138) from
[<c0031e10>] (warn_slowpath_common+0x4c/0x64)
[ 795.183234] [<c0031e10>] (warn_slowpath_common+0x4c/0x64) from
[<c0031ebc>] (warn_slowpath_fmt+0x30/0x40)
[ 795.203586] [<c0031ebc>] (warn_slowpath_fmt+0x30/0x40) from
[<c0309ae0>] (device_release+0x78/0x84)
[ 795.223412] [<c0309ae0>] (device_release+0x78/0x84) from
[<c028ba3c>] (kobject_release+0x98/0x1bc)
[ 795.244079] [<c028ba3c>] (kobject_release+0x98/0x1bc) from
[<bf04f54c>] (g2d_module_exit+0x34/0x68 [g2d_23])
[ 795.266065] [<bf04f54c>] (g2d_module_exit+0x34/0x68 [g2d_23]) from
[<c006c00c>] (sys_delete_module+0x1ac/0x28c)
[ 795.287740] [<c006c00c>] (sys_delete_module+0x1ac/0x28c) from
[<c000ea80>] (ret_fast_syscall+0x0/0x30)
[ 795.304222] ---[ end trace ec0a564270cd7879 ]---
rellla
--
You received this message because you are subscribed to the Google Groups
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.