Inquire about issues when playing video and request code review
Hi, I'm currently playing videos with a video player operated on weston13 on custom embedded device.
I am inquiring about the issue of Weston dying during playing videos. If I continuously click the next button on the video player with the pointer after connecting the mouse, Weston suddenly dies (Click the next button continuously when sending out the black screen before the next video screen is updated). for reference, no issue occurs if I tested through a touch rather than a mouse.
Below is the backtrace log via gdb, after weston dies.
(gdb) bt
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1 0x0000007fbb5a2bc4 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2 0x0000007fbb55c020 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x0000007fbb547e58 in __GI_abort () at abort.c:79
#4 0x0000007fbb555528 in __assert_fail_base (fmt=0x7fbb66dff8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7fbb4dde80 "!view->transform.dirty", file=file@entry=0x7fbb4dda68 "../weston-13.0.1/libweston/compositor.c", line=line@entry=893, ////.
function=function@entry=0x7fbb4e3230 <__PRETTY_FUNCTION__.84> "weston_coord_global_to_surface") at assert.c:94
#5 0x0000007fbb55559c in __assert_fail (assertion=assertion@entry=0x7fbb4dde80 "!view->transform.dirty", file=file@entry=0x7fbb4dda68 "../weston-13.0.1/libweston/compositor.c", line=line@entry=893,
function=function@entry=0x7fbb4e3230 <__PRETTY_FUNCTION__.84> "weston_coord_global_to_surface") at assert.c:103
#6 0x0000007fbb4adeb8 in weston_coord_global_to_surface (view=0x55af9859c0, coord=...) at ../weston-13.0.1/libweston/compositor.c:893
#7 weston_coord_global_to_surface (view=view@entry=0x55af9859c0, coord=...) at ../weston-13.0.1/libweston/compositor.c:888
#8 0x0000007fbb4c4960 in weston_pointer_set_focus (pointer=0x55af8f5cc0, view=0x55af9859c0) at ../weston-13.0.1/libweston/input.c:1940
#9 0x0000007fbb4b906c in weston_compositor_repick (compositor=0x55aef6ee30) at ../weston-13.0.1/libweston/compositor.c:2362
#10 weston_output_repaint (output=0x55af7a6580) at ../weston-13.0.1/libweston/compositor.c:3493
#11 weston_output_maybe_repaint (now=0x7ff7502188, output=0x55af7a6580) at ../weston-13.0.1/libweston/compositor.c:3556
#12 output_repaint_timer_handler (data=0x55aef6ee30) at ../weston-13.0.1/libweston/compositor.c:3640
#13 0x0000007fbb42bd9c in wl_timer_heap_dispatch (timers=0x55aef6c1a8) at ../wayland-1.22.0/src/event-loop.c:526
#14 wl_event_loop_dispatch (loop=0x55aef6c160, timeout=timeout@entry=-1) at ../wayland-1.22.0/src/event-loop.c:1020
#15 0x0000007fbb4290e0 in wl_display_run (display=display@entry=0x55aef6c070) at ../wayland-1.22.0/src/wayland-server.c:1493
#16 0x0000007fbb6de314 in wet_main (argc=<optimized out>, argv=<optimized out>, test_data=0x0) at ../weston-13.0.1/compositor/main.c:4372
#17 0x0000007fbb548484 in __libc_start_call_main (main=main@entry=0x5575740740 <main>, argc=argc@entry=4, argv=argv@entry=0x7ff7502f18) at ../sysdeps/nptl/libc_start_call_main.h:58
#18 0x0000007fbb54855c in __libc_start_main_impl (main=0x5575740740 <main>, argc=4, argv=0x7ff7502f18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>) at ../csu/libc-start.c:360
#19 0x00000055757407b0 in _start () at ../sysdeps/aarch64/start.S:98
As shown above, in the weston_coord_global_to_surface function, an assert function occurs as !view->transform.dirty becomes true. (An assert function occurs when the view->transform.dirty value comes in 1 when Weston dies)
weston_coord_global_to_surface function of the weston code is as follows.
WL_EXPORT struct weston_coord_surface
weston_coord_global_to_surface(const struct weston_view *view,
struct weston_coord_global coord)
{
struct weston_coord_surface out;
~ assert(!view->transform.dirty); // weston dies
out.c = weston_matrix_transform_coord(&view->transform.inverse,
coord.c);
out.coordinate_space_id = view->surface;
return out;
}
So I solved it as below.
diff --git a/libweston/input.c b/libweston/input.c
index c72c24b..3606fa7 100644
--- a/libweston/input.c
+++ b/libweston/input.c
@@ -1918,6 +1918,7 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
if (view) {
struct weston_coord_surface surf_pos;
+ weston_view_update_transform(view);
surf_pos = weston_coord_global_to_surface(view, pointer->pos);
sx = wl_fixed_from_double(surf_pos.c.x);
sy = wl_fixed_from_double(surf_pos.c.y);
I modified the weston_pointer_set_focus function to call weston_view_update_transform, a function that makes the view->transform.dirty value zero, before calling the weston_coord_global_to_surface function.
When I applied the code as above, I confirmed that the Weston did not die and the videos are played normally even if I clicked the next button continuously.
The above issue does not occur in weston10, so I compared the code Weston13 and Weston10. Weston10 does not use the weston_coord_global_to_surface function to transform coordinates.
Could you confirm whether the modification as above is correct and review the code ?
Thank you.