This repository has been archived by the owner. It is now read-only.

[i9100] Touching with short delays makes it unresponsive to further key presses #46

Open
ollieparanoid opened this Issue Sep 9, 2017 · 23 comments

Comments

Projects
None yet
4 participants
@ollieparanoid
Member

ollieparanoid commented Sep 9, 2017

Device: samsung-i9100

I've experienced that when I touch the screen a few times with only short delays in-between, the screen does not respond anymore to the presses (also not output for presses on stdout with -v). Until I give it a second or so without key presses, then it works again.

It does not always happen that way, but I can reproduce it easily with a few tries.

Log from starting:

commandline read: osk-sdl
commandline read: -d
commandline read: a
commandline read: -n
commandline read: a
commandline read: -c
commandline read: /etc/osk.conf
commandline read: -v
(*) Direct/Thread: Started 'SigHandler' (2881) [CRITICAL - OTHER/0] <85316>...

   ~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.7.7 |~~~~~~~~~~~~~~~~~~~~~~~~~~
        (c) 2012-2015  DirectFB integrated media GmbH
        (c) 2001-2015  The world wide DirectFB Open Source Community
        (c) 2000-2004  Convergence (integrated media) GmbH
      ----------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2017-09-08 22:49)
(*) Direct/Memcpy: Using armasm_memcpy()
(*) Direct/Thread: Started 'Fusion Dispatch' (2882) [MESSAGING - OTHER/0] <85316>...
(*) Direct/Thread: Started 'VT Switcher' (2883) [CRITICAL - OTHER/0] <85316>...
(*) Direct/Thread: Started 'VT Flusher' (2884) [DEFAULT - OTHER/0] <85316>...
(*) DirectFB/FBDev: Found 's3cfb' (ID 0) with frame buffer at 0x7143c000, 3000k (MMIO 0x00000000, 0k)
(*) Direct/Thread: Started 'Linux Input' (2885) [INPUT - OTHER/0] <85316>...
(*) DirectFB/Input: gpio-keys (1) 0.1 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (2886) [INPUT - OTHER/0] <85316>...
(*) DirectFB/Input: sii9234_rcp (2) 0.1 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (2887) [INPUT - OTHER/0] <85316>...
(*) DirectFB/Input: gyro_sensor (3) 0.1 (directfb.org)
(*) Direct/Thread: Started 'Hotplug with Linux Input' (2888) [INPUT - OTHER/0] <85316>...
(*) DirectFB/Input: Hot-plug detection enabled with Linux Input Driver
(*) DirectFB/Input: Hot-plug detection enabled with Input Hub Driver
(*) Direct/Thread: Started 'tslib Input' (2889) [INPUT - OTHER/0] <85316>...
(*) DirectFB/Input: tslib touchscreen 0 0.1 (tslib)
(*) Direct/Thread: Started 'Keyboard Input' (2890) [INPUT - OTHER/0] <85316>...
(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
(*) DirectFB/Graphics: TI OMAP 0.1 (Ville Syrjala)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
(*) Direct/Thread: Started 'Genefx' (2891) [DEFAULT - OTHER/0] <85316>...
(*) FBDev/Mode: Setting 480x800 RGB32
(*) FBDev/Mode: Switched to 480x800 (virtual 480x800) at 32 bit (RGB32), pitch 1920
(*) FBDev/Mode: Setting 480x800 RGB32
(*) FBDev/Mode: Switched to 480x800 (virtual 480x800) at 32 bit (RGB32), pitch 1920
INFO: DirectFB Device Information
INFO: ===========================
INFO: Name:           OMAP
INFO: Vendor:         TI
INFO: Driver Name:    TI OMAP Driver
INFO: Driver Vendor:  Ville Syrjala
INFO: Driver Version: 0.1
INFO: Video memoory:  3072000
INFO: Blitting flags:
INFO: Drawing flags:
INFO: Acceleration flags:
INFO: Keyboard 17 - Keyboard
INFO: Mode 480 x 800 Added
INFO: Mode 480 x 800 Added
INFO: Mode 480 x 800 Added
INFO: Mode 480 x 800 Added
INFO: Mode 480 x 800 Added
 (!!!)  *** UNIMPLEMENTED [fusion_get_fusionee_pid] *** [fusion.c:4147]
(*) FBDev/Mode: Setting 480x800 RGB32
(*) FBDev/Mode: Switched to 480x800 (virtual 480x800) at 32 bit (RGB32), pitch 1920
INFO: /home/user/build/src/SDL2-2.0.5/src/video/directfb/SDL_DirectFB_opengl.c (188):The specified file has not been found
INFO: /home/user/build/src/SDL2-2.0.5/src/video/directfb/SDL_DirectFB_opengl.c (188):The specified file has not been found
INFO: /home/user/build/src/SDL2-2.0.5/src/video/directfb/SDL_DirectFB_opengl.c (188):The specified file has not been found
INFO: Created renderer: directfb
INFO: Created renderer: software

Example key press logs:

xMouse: 198     yMouse: 626
xMouse: 200     yMouse: 625
xMouse: 203     yMouse: 624
# major outage, key presses don't get recognized for 2 seconds or so
# then the key presses work again (see below)
xMouse: 188     yMouse: 616
xMouse: 186     yMouse: 615
xMouse: 185     yMouse: 610
xMouse: 185     yMouse: 609
xMouse: 187     yMouse: 609
xMouse: 185     yMouse: 608

@ollieparanoid ollieparanoid added the bug label Sep 9, 2017

@MartijnBraam

This comment has been minimized.

Show comment
Hide comment
@MartijnBraam

MartijnBraam Sep 9, 2017

Member

Maybe we should log a warning when time_left(SDL_GetTicks(), next_time) is < 1. That means we have a late frame (and maybe a lockup somewhere)

Member

MartijnBraam commented Sep 9, 2017

Maybe we should log a warning when time_left(SDL_GetTicks(), next_time) is < 1. That means we have a late frame (and maybe a lockup somewhere)

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Sep 9, 2017

Member

Ok, I ended up moving the rendering to a timer (triggering at TICK_INTERVAL). This makes the input (taps, phys keyboard presses, etc) VERY responsive now. (918ba01)

On another note, CPU utilization is nearly 100% on my N900 even though this commit uses a blocking call to check for events in SDL. All of this cpu utilization is in the rendering, not the detection/handling of input events. We could increase TICK_INTERVAL, but then the animations are slow/choppy. This is attributed to software rendering.

I will bump the osk-sdl version and get this update into pmbootstrap aports, please test it out when you get a chance!

Member

craftyguy commented Sep 9, 2017

Ok, I ended up moving the rendering to a timer (triggering at TICK_INTERVAL). This makes the input (taps, phys keyboard presses, etc) VERY responsive now. (918ba01)

On another note, CPU utilization is nearly 100% on my N900 even though this commit uses a blocking call to check for events in SDL. All of this cpu utilization is in the rendering, not the detection/handling of input events. We could increase TICK_INTERVAL, but then the animations are slow/choppy. This is attributed to software rendering.

I will bump the osk-sdl version and get this update into pmbootstrap aports, please test it out when you get a chance!

@ollieparanoid ollieparanoid changed the title from Touching with short delays makes it unresponsive to further key presses to [i9100] Touching with short delays makes it unresponsive to further key presses Sep 16, 2017

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Sep 16, 2017

Member

Thanks for making the changes! Unfortunately it did not resolve the problem for me. I'm investigating this with gprof as you suggested. I have tried to run it on Arch so I understand how it works (haven't used gprof before), but it produces an empty output file. Further testing shows, that this is also the case for a simple hello world c++ program, so this is not a osk-sdl related problem, but a problem with my setup. Anyway, here are my current steps.

  1. Clone the osk-sdl source
  2. Adjust the Makefile, add -pg to the CXXFLAGS
  3. Run make
  4. Run osk-sdl: ./osk-sdl -d a -n a -c ./osk.conf.arch -v (adjusted the font path in the config)
  5. gprof ./osk-sdl gmon.out > analysis.txt

My analysis.txt only contains informative headers on how to read the data, but no actual data. I'll try to figure out why that happens (maybe someone has a clue for me?).

Member

ollieparanoid commented Sep 16, 2017

Thanks for making the changes! Unfortunately it did not resolve the problem for me. I'm investigating this with gprof as you suggested. I have tried to run it on Arch so I understand how it works (haven't used gprof before), but it produces an empty output file. Further testing shows, that this is also the case for a simple hello world c++ program, so this is not a osk-sdl related problem, but a problem with my setup. Anyway, here are my current steps.

  1. Clone the osk-sdl source
  2. Adjust the Makefile, add -pg to the CXXFLAGS
  3. Run make
  4. Run osk-sdl: ./osk-sdl -d a -n a -c ./osk.conf.arch -v (adjusted the font path in the config)
  5. gprof ./osk-sdl gmon.out > analysis.txt

My analysis.txt only contains informative headers on how to read the data, but no actual data. I'll try to figure out why that happens (maybe someone has a clue for me?).

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Sep 16, 2017

Member

@ollieparanoid

Looks like there's a bug in gprof with newer GCC versions, you have to add -no-pie to CXXFLAGS. I confirmed that this produced output on my host system.

Member

craftyguy commented Sep 16, 2017

@ollieparanoid

Looks like there's a bug in gprof with newer GCC versions, you have to add -no-pie to CXXFLAGS. I confirmed that this produced output on my host system.

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Sep 16, 2017

Member

After looking at the analysis from running this on X11, you should try setting these in osk.conf:

key-radius = 0
inputbox-radius = 0

It seems that rounding corners for buttons/input boxes is VERY expensive (this is what was keeping CPU utilization on my N900 at > 90%!). Took running this through gprof for me to realize that.

Actually it seems that most of this performance hit is with rounding of the input box. @MartijnBraam or @IanS5 : do either of you have any suggestions on how to minimize the (fairly significant) performance hit when rounding corners on these objects?

Note: the time analysis doesn't seem to be working right in gprof, so ignore the time being '0' below...

Radius at default setting:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
  0.00      0.00     0.00  3891954     0.00     0.00  int&& std::forward<int>(std::remove_reference<int>::type&)
  0.00      0.00     0.00   972990     0.00     0.00  std::function<void (int, int)>::operator()(int, int) const
  0.00      0.00     0.00   972986     0.00     0.00  std::_Function_base::_M_empty() const
  0.00      0.00     0.00   972981     0.00     0.00  std::_Any_data::_M_access() const
  0.00      0.00     0.00   858078     0.00     0.00  std::_Function_handler<void (int, int), smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_invoke(std::_Any_data const&, int&&, std::_Any_data const&)
  0.00      0.00     0.00   858077     0.00     0.00  smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1} const& std::_Any_data::_M_access<smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1}>() const
  0.00      0.00     0.00   858073     0.00     0.00  std::_Function_base::_Base_manager<smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_get_pointer(std::_Any_data const&)
  0.00      0.00     0.00   858073     0.00     0.00  smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1} const* std::__addressof<smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1} const>(smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1} const&)
  0.00      0.00     0.00   858073     0.00     0.00  smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1}::operator()(int, int) const
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const& std::_Any_data::_M_access<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>() const
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_base::_Base_manager<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_get_pointer(std::_Any_data const&)
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_handler<void (int, int), smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_invoke(std::_Any_data const&, int&&, std::_Any_data const&)
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const* std::__addressof<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const>(smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const&)
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}::operator()(int, int) const
  0.00      0.00     0.00     1348     0.00     0.00  bezier_corner(SDL_Point*, SDL_Point*, SDL_Point*, SDL_Point*)
  0.00      0.00     0.00     1194     0.00     0.00  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const& std::forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::remove_reference<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::type&)
  0.00      0.00     0.00     1144     0.00     0.00  std::_List_iterator<KeyboardLayer>::_List_iterator(std::__detail::_List_node_base*)
  0.00      0.00     0.00     1077     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_addr()
  0.00      0.00     0.00     1075     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_ptr()
  0.00      0.00     0.00     1072     0.00     0.00  std::_List_node<KeyboardLayer>::_M_valptr()
  0.00      0.00     0.00     1068     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator*() const

Radius set to '0' for inputbox-radius:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
  0.00      0.00     0.00   459648     0.00     0.00  int&& std::forward<int>(std::remove_reference<int>::type&)
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_base::_M_empty() const
  0.00      0.00     0.00   114912     0.00     0.00  std::function<void (int, int)>::operator()(int, int) const
  0.00      0.00     0.00   114912     0.00     0.00  std::_Any_data::_M_access() const
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const& std::_Any_data::_M_access<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>() const
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_base::_Base_manager<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_get_pointer(std::_Any_data const&)
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_handler<void (int, int), smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_invoke(std::_Any_data const&, int&&, std::_Any_data const&)
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const* std::__addressof<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const>(smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const&)
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}::operator()(int, int) const
  0.00      0.00     0.00     1192     0.00     0.00  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const& std::forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::remove_reference<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::type&)
  0.00      0.00     0.00      943     0.00     0.00  std::_List_iterator<KeyboardLayer>::_List_iterator(std::__detail::_List_node_base*)
  0.00      0.00     0.00      913     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_ptr()
  0.00      0.00     0.00      913     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_addr()
  0.00      0.00     0.00      913     0.00     0.00  std::_List_node<KeyboardLayer>::_M_valptr()
  0.00      0.00     0.00      907     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator*() const

Radius set to '0' for both:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
  0.00      0.00     0.00     1192     0.00     0.00  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const& std::forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::remove_reference<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::type&)
  0.00      0.00     0.00      888     0.00     0.00  std::_List_iterator<KeyboardLayer>::_List_iterator(std::__detail::_List_node_base*)
  0.00      0.00     0.00      869     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_ptr()
  0.00      0.00     0.00      869     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_addr()
  0.00      0.00     0.00      869     0.00     0.00  std::_List_node<KeyboardLayer>::_M_valptr()
  0.00      0.00     0.00      863     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator*() const
  0.00      0.00     0.00      705     0.00     0.00  std::__cxx11::list<KeyboardLayer, std::allocator<KeyboardLayer> >::end()
  0.00      0.00     0.00      702     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator!=(std::_List_iterator<KeyboardLayer> const&) const
  0.00      0.00     0.00      579     0.00     0.00  touchArea&& std::forward<touchArea>(std::remove_reference<touchArea>::type&)
  0.00      0.00     0.00      569     0.00     0.00  draw_circle(SDL_Renderer*, SDL_Point, int)
  0.00      0.00     0.00      565     0.00     0.00  operator new(unsigned long, void*)
  0.00      0.00     0.00      526     0.00     0.00  LuksDevice::unlockRunning()
  0.00      0.00     0.00      519     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator++()
  0.00      0.00     0.00      462     0.00     0.00  std::move_iterator<touchArea*>::base() const
Member

craftyguy commented Sep 16, 2017

After looking at the analysis from running this on X11, you should try setting these in osk.conf:

key-radius = 0
inputbox-radius = 0

It seems that rounding corners for buttons/input boxes is VERY expensive (this is what was keeping CPU utilization on my N900 at > 90%!). Took running this through gprof for me to realize that.

Actually it seems that most of this performance hit is with rounding of the input box. @MartijnBraam or @IanS5 : do either of you have any suggestions on how to minimize the (fairly significant) performance hit when rounding corners on these objects?

Note: the time analysis doesn't seem to be working right in gprof, so ignore the time being '0' below...

Radius at default setting:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
  0.00      0.00     0.00  3891954     0.00     0.00  int&& std::forward<int>(std::remove_reference<int>::type&)
  0.00      0.00     0.00   972990     0.00     0.00  std::function<void (int, int)>::operator()(int, int) const
  0.00      0.00     0.00   972986     0.00     0.00  std::_Function_base::_M_empty() const
  0.00      0.00     0.00   972981     0.00     0.00  std::_Any_data::_M_access() const
  0.00      0.00     0.00   858078     0.00     0.00  std::_Function_handler<void (int, int), smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_invoke(std::_Any_data const&, int&&, std::_Any_data const&)
  0.00      0.00     0.00   858077     0.00     0.00  smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1} const& std::_Any_data::_M_access<smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1}>() const
  0.00      0.00     0.00   858073     0.00     0.00  std::_Function_base::_Base_manager<smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_get_pointer(std::_Any_data const&)
  0.00      0.00     0.00   858073     0.00     0.00  smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1} const* std::__addressof<smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1} const>(smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1} const&)
  0.00      0.00     0.00   858073     0.00     0.00  smooth_corners_renderer(SDL_Renderer*, argb*, SDL_Rect*, int)::{lambda(int, int)#1}::operator()(int, int) const
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const& std::_Any_data::_M_access<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>() const
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_base::_Base_manager<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_get_pointer(std::_Any_data const&)
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_handler<void (int, int), smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_invoke(std::_Any_data const&, int&&, std::_Any_data const&)
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const* std::__addressof<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const>(smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const&)
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}::operator()(int, int) const
  0.00      0.00     0.00     1348     0.00     0.00  bezier_corner(SDL_Point*, SDL_Point*, SDL_Point*, SDL_Point*)
  0.00      0.00     0.00     1194     0.00     0.00  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const& std::forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::remove_reference<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::type&)
  0.00      0.00     0.00     1144     0.00     0.00  std::_List_iterator<KeyboardLayer>::_List_iterator(std::__detail::_List_node_base*)
  0.00      0.00     0.00     1077     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_addr()
  0.00      0.00     0.00     1075     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_ptr()
  0.00      0.00     0.00     1072     0.00     0.00  std::_List_node<KeyboardLayer>::_M_valptr()
  0.00      0.00     0.00     1068     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator*() const

Radius set to '0' for inputbox-radius:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
  0.00      0.00     0.00   459648     0.00     0.00  int&& std::forward<int>(std::remove_reference<int>::type&)
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_base::_M_empty() const
  0.00      0.00     0.00   114912     0.00     0.00  std::function<void (int, int)>::operator()(int, int) const
  0.00      0.00     0.00   114912     0.00     0.00  std::_Any_data::_M_access() const
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const& std::_Any_data::_M_access<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>() const
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_base::_Base_manager<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_get_pointer(std::_Any_data const&)
  0.00      0.00     0.00   114912     0.00     0.00  std::_Function_handler<void (int, int), smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}>::_M_invoke(std::_Any_data const&, int&&, std::_Any_data const&)
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const* std::__addressof<smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const>(smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1} const&)
  0.00      0.00     0.00   114912     0.00     0.00  smooth_corners_surface(SDL_Surface*, unsigned int, SDL_Rect*, int)::{lambda(int, int)#1}::operator()(int, int) const
  0.00      0.00     0.00     1192     0.00     0.00  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const& std::forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::remove_reference<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::type&)
  0.00      0.00     0.00      943     0.00     0.00  std::_List_iterator<KeyboardLayer>::_List_iterator(std::__detail::_List_node_base*)
  0.00      0.00     0.00      913     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_ptr()
  0.00      0.00     0.00      913     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_addr()
  0.00      0.00     0.00      913     0.00     0.00  std::_List_node<KeyboardLayer>::_M_valptr()
  0.00      0.00     0.00      907     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator*() const

Radius set to '0' for both:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
  0.00      0.00     0.00     1192     0.00     0.00  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const& std::forward<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::remove_reference<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::type&)
  0.00      0.00     0.00      888     0.00     0.00  std::_List_iterator<KeyboardLayer>::_List_iterator(std::__detail::_List_node_base*)
  0.00      0.00     0.00      869     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_ptr()
  0.00      0.00     0.00      869     0.00     0.00  __gnu_cxx::__aligned_membuf<KeyboardLayer>::_M_addr()
  0.00      0.00     0.00      869     0.00     0.00  std::_List_node<KeyboardLayer>::_M_valptr()
  0.00      0.00     0.00      863     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator*() const
  0.00      0.00     0.00      705     0.00     0.00  std::__cxx11::list<KeyboardLayer, std::allocator<KeyboardLayer> >::end()
  0.00      0.00     0.00      702     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator!=(std::_List_iterator<KeyboardLayer> const&) const
  0.00      0.00     0.00      579     0.00     0.00  touchArea&& std::forward<touchArea>(std::remove_reference<touchArea>::type&)
  0.00      0.00     0.00      569     0.00     0.00  draw_circle(SDL_Renderer*, SDL_Point, int)
  0.00      0.00     0.00      565     0.00     0.00  operator new(unsigned long, void*)
  0.00      0.00     0.00      526     0.00     0.00  LuksDevice::unlockRunning()
  0.00      0.00     0.00      519     0.00     0.00  std::_List_iterator<KeyboardLayer>::operator++()
  0.00      0.00     0.00      462     0.00     0.00  std::move_iterator<touchArea*>::base() const
@MartijnBraam

This comment has been minimized.

Show comment
Hide comment
@MartijnBraam

MartijnBraam Sep 16, 2017

Member

The easiest performance fix is render the password box with rounded corners once to a texture on startup instead of creating rounded corners on every frame. In that case we can also have more points in the smooth corner surface thing (or use the draw_circle function to draw the 4 corners)

Member

MartijnBraam commented Sep 16, 2017

The easiest performance fix is render the password box with rounded corners once to a texture on startup instead of creating rounded corners on every frame. In that case we can also have more points in the smooth corner surface thing (or use the draw_circle function to draw the 4 corners)

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Sep 16, 2017

Member

Um, so for now, since that will require a bit of restructuring/refactoring, I'm just going to set the default radii to 0 for keys and input boxes to see if this helps resolve @ollieparanoid's issue.

Member

craftyguy commented Sep 16, 2017

Um, so for now, since that will require a bit of restructuring/refactoring, I'm just going to set the default radii to 0 for keys and input boxes to see if this helps resolve @ollieparanoid's issue.

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Sep 16, 2017

Member

Please test again, 4171c42 disables corner smoothing.

Member

craftyguy commented Sep 16, 2017

Please test again, 4171c42 disables corner smoothing.

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Sep 19, 2017

Member

Thanks for the profiling and possible fix! I've tested it just now, and unfortunately this does not fix it either.

@montvid: you mentioned, that you also have the i9100 and want to help with testing. Here we have a i9100 specific bug, where debugging would be very much appreciated. You could try the following:

  • try to reproduce the bug (just tap all the time on a key, for me it stops responding after a few second, then works again after another second or so)
  • try to profile the code like @craftyguy did above (but on the device)
  • maybe try to change the code and see if you can fix it that way.

For best results, please join the chat and talk to @craftyguy there :)

Member

ollieparanoid commented Sep 19, 2017

Thanks for the profiling and possible fix! I've tested it just now, and unfortunately this does not fix it either.

@montvid: you mentioned, that you also have the i9100 and want to help with testing. Here we have a i9100 specific bug, where debugging would be very much appreciated. You could try the following:

  • try to reproduce the bug (just tap all the time on a key, for me it stops responding after a few second, then works again after another second or so)
  • try to profile the code like @craftyguy did above (but on the device)
  • maybe try to change the code and see if you can fix it that way.

For best results, please join the chat and talk to @craftyguy there :)

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Sep 19, 2017

Member
Member

craftyguy commented Sep 19, 2017

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Oct 1, 2017

Member

WIP efforts in getting that gprof dump from the device. I'm trying to compile the package with grpof support:

  1. Create cxxflags.patch:
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ SDL2_CFLAGS := $(shell sdl2-config --cflags)
 SDL2_LIBS  := $(shell sdl2-config --libs)

 CXX        := g++
-CXXFLAGS   := -std=c++14 -Wall -g $(SDL2_CFLAGS)
+CXXFLAGS   := -std=c++14 -Wall -g $(SDL2_CFLAGS) -no-pie -pg

 LIBS       := -lcryptsetup $(SDL2_LIBS) -lSDL2_ttf
  1. Adjust APKBUILD
  • new makedepend: pcc-libs-dev
  • new source: cxxflags.patch
  1. pmbootstrap checksum osk-sdl
  2. pmbootstrap build --force osk-sdl (building native just to test if it builds at all)

Fails with:

/usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find gcrt1.o: No such file or directory
collect2: error: ld returned 1 exit status

...although that is supposed to be in pcc-libs-dev.

I'll need to look into this more. Does anyone spot why it doesn't work?

Member

ollieparanoid commented Oct 1, 2017

WIP efforts in getting that gprof dump from the device. I'm trying to compile the package with grpof support:

  1. Create cxxflags.patch:
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ SDL2_CFLAGS := $(shell sdl2-config --cflags)
 SDL2_LIBS  := $(shell sdl2-config --libs)

 CXX        := g++
-CXXFLAGS   := -std=c++14 -Wall -g $(SDL2_CFLAGS)
+CXXFLAGS   := -std=c++14 -Wall -g $(SDL2_CFLAGS) -no-pie -pg

 LIBS       := -lcryptsetup $(SDL2_LIBS) -lSDL2_ttf
  1. Adjust APKBUILD
  • new makedepend: pcc-libs-dev
  • new source: cxxflags.patch
  1. pmbootstrap checksum osk-sdl
  2. pmbootstrap build --force osk-sdl (building native just to test if it builds at all)

Fails with:

/usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find gcrt1.o: No such file or directory
collect2: error: ld returned 1 exit status

...although that is supposed to be in pcc-libs-dev.

I'll need to look into this more. Does anyone spot why it doesn't work?

@montvid

This comment has been minimized.

Show comment
Hide comment
@montvid

montvid Oct 3, 2017

@ollieparanoid I do reproduce the bug. After 4 or 3 characters it stops responding - even the delete button stops responding. I found another problem with S2 - htop/nproc shows only one cpu core but S2 has Dual-core 1.2 GHz Cortex-A9! lscpu shows 2 cores. After running osk-sdl I can see htop 2 cpus - 1 at 100% the other at 2%. Maybe osk-sdl uses only one cpu and that is why it lags? I get some errors are they ok?
(!!!) *** UNIMPLEMENTED [fusion_get_fusionee_pid] *** [fusion.c:4147] (*) FBDev/Mode: Setting 480x800 RGB32 (*) FBDev/Mode: Switched to 480x800 (virtual 480x800) at 32 bit (RGB32), pitch 1920 INFO: /home/user/build/src/SDL2-2.0.5/src/video/directfb/SDL_DirectFB_opengl.c (188):The specified file has not been found INFO: /home/user/build/src/SDL2-2.0.5/src/video/directfb/SDL_DirectFB_opengl.c (188):The specified file has not been found INFO: /home/user/build/src/SDL2-2.0.5/src/video/directfb/SDL_DirectFB_opengl.c (188):The specified file has not been found INFO: Created renderer: directfb INFO: Created renderer: software

montvid commented Oct 3, 2017

@ollieparanoid I do reproduce the bug. After 4 or 3 characters it stops responding - even the delete button stops responding. I found another problem with S2 - htop/nproc shows only one cpu core but S2 has Dual-core 1.2 GHz Cortex-A9! lscpu shows 2 cores. After running osk-sdl I can see htop 2 cpus - 1 at 100% the other at 2%. Maybe osk-sdl uses only one cpu and that is why it lags? I get some errors are they ok?
(!!!) *** UNIMPLEMENTED [fusion_get_fusionee_pid] *** [fusion.c:4147] (*) FBDev/Mode: Setting 480x800 RGB32 (*) FBDev/Mode: Switched to 480x800 (virtual 480x800) at 32 bit (RGB32), pitch 1920 INFO: /home/user/build/src/SDL2-2.0.5/src/video/directfb/SDL_DirectFB_opengl.c (188):The specified file has not been found INFO: /home/user/build/src/SDL2-2.0.5/src/video/directfb/SDL_DirectFB_opengl.c (188):The specified file has not been found INFO: /home/user/build/src/SDL2-2.0.5/src/video/directfb/SDL_DirectFB_opengl.c (188):The specified file has not been found INFO: Created renderer: directfb INFO: Created renderer: software

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Oct 3, 2017

Member
Member

craftyguy commented Oct 3, 2017

@montvid

This comment has been minimized.

Show comment
Hide comment
@montvid

montvid Oct 3, 2017

key-radius = 0
inputbox-radius = 0
Does not help, a bit less laggy keyboard but still 1 cpu at 90%, the 2 at 2%. Why does it not use both cpu's? How can I help to debug? Run gprof?

montvid commented Oct 3, 2017

key-radius = 0
inputbox-radius = 0
Does not help, a bit less laggy keyboard but still 1 cpu at 90%, the 2 at 2%. Why does it not use both cpu's? How can I help to debug? Run gprof?

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Oct 3, 2017

Member
Member

craftyguy commented Oct 3, 2017

@montvid

This comment has been minimized.

Show comment
Hide comment
@montvid

montvid Oct 3, 2017

key-radius = 0
inputbox-radius = 0
What radii? The above radii? What other radii should I set to 0? It is 90% now.

montvid commented Oct 3, 2017

key-radius = 0
inputbox-radius = 0
What radii? The above radii? What other radii should I set to 0? It is 90% now.

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Oct 9, 2017

Member

Regarding profilers that work with musl, @craftyguy asked in #alpine-devel and got the following from foxkit:

try 'perf' or 'oprofile' [...] oprofile needs two or three patches for musl, [...] perf is a kernel thing

Member

ollieparanoid commented Oct 9, 2017

Regarding profilers that work with musl, @craftyguy asked in #alpine-devel and got the following from foxkit:

try 'perf' or 'oprofile' [...] oprofile needs two or three patches for musl, [...] perf is a kernel thing

@montvid

This comment has been minimized.

Show comment
Hide comment
@montvid

montvid Oct 11, 2017

@craftyguy Nexus 7 flo has 100% utilization on 1/4 cpu's while running osk-sdl. The lag is almost not visible while typing so it should not be a problem but I guess it shows that the lag depends on the cpu used in a device.

montvid commented Oct 11, 2017

@craftyguy Nexus 7 flo has 100% utilization on 1/4 cpu's while running osk-sdl. The lag is almost not visible while typing so it should not be a problem but I guess it shows that the lag depends on the cpu used in a device.

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Oct 11, 2017

Member

@montvid I don't believe that is causing the lag that @ollieparanoid is seeing, we discussed this earlier in this thread and he still sees this lag even when disabling the rounded corner rendering, which leads me to believe it is something else.

I cannot reproduce the lag in this ticket even on an N900 with a single core 600MHz CPU, even when rendering the rounded corners (so CPU usage is >90% all the time).

Member

craftyguy commented Oct 11, 2017

@montvid I don't believe that is causing the lag that @ollieparanoid is seeing, we discussed this earlier in this thread and he still sees this lag even when disabling the rounded corner rendering, which leads me to believe it is something else.

I cannot reproduce the lag in this ticket even on an N900 with a single core 600MHz CPU, even when rendering the rounded corners (so CPU usage is >90% all the time).

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Oct 17, 2017

Member

@ollieparanoid

If you have time, could you try the latest in master branch? You can use this APKBUILD example in the wiki to build from the latest commit there: https://wiki.postmarketos.org/wiki/Osk-sdl#Building_osk-sdl_from_repo

There have been some big changes to the way rendering is handled now, and I'm curious if it helps your issue.

Member

craftyguy commented Oct 17, 2017

@ollieparanoid

If you have time, could you try the latest in master branch? You can use this APKBUILD example in the wiki to build from the latest commit there: https://wiki.postmarketos.org/wiki/Osk-sdl#Building_osk-sdl_from_repo

There have been some big changes to the way rendering is handled now, and I'm curious if it helps your issue.

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Oct 17, 2017

Member

I wrote in the chat:

tapping issue isn't resolved it seems - but I am not sure. it feels like being a bit better. so I want to check the log. instealled the usb-shell hook and everything, but this is odd: the new coordinates do not get written to the log anymore
it only wrote this once: xMouse: 422 yMouse: 507
and I have noted that it now hangs after "doing the wave" for like a second until it shows "incorrect passphrase"

@craftyguy wrote:

no something weird is going on there. i'll try to get oprofile going to establish a baseline for comparing a profile from your device

Member

ollieparanoid commented Oct 17, 2017

I wrote in the chat:

tapping issue isn't resolved it seems - but I am not sure. it feels like being a bit better. so I want to check the log. instealled the usb-shell hook and everything, but this is odd: the new coordinates do not get written to the log anymore
it only wrote this once: xMouse: 422 yMouse: 507
and I have noted that it now hangs after "doing the wave" for like a second until it shows "incorrect passphrase"

@craftyguy wrote:

no something weird is going on there. i'll try to get oprofile going to establish a baseline for comparing a profile from your device

@craftyguy

This comment has been minimized.

Show comment
Hide comment
@craftyguy

craftyguy Oct 18, 2017

Member

@ollieparanoid I hope you don't mind me pushing a commit to pmbootstrap/feature/oprofile, adding a new package 'oprofile-legacy'. Apparently operf in the latest oprofile doesn't work with the armv7 in my N900, so I've patched/packaged the last version of oprofile to support 'older processors'.

Alas, it doesn't work for me, it quits with some 'out of memory' error when running opcontrol (the legacy profiler daemon). Are you able to successfully run operf on your device?

Member

craftyguy commented Oct 18, 2017

@ollieparanoid I hope you don't mind me pushing a commit to pmbootstrap/feature/oprofile, adding a new package 'oprofile-legacy'. Apparently operf in the latest oprofile doesn't work with the armv7 in my N900, so I've patched/packaged the last version of oprofile to support 'older processors'.

Alas, it doesn't work for me, it quits with some 'out of memory' error when running opcontrol (the legacy profiler daemon). Are you able to successfully run operf on your device?

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Oct 18, 2017

Member

I don't mind at all, thanks for doing that!
Just to make sure: you really mean operf instead of oprofile there? I did not try operf yet, and it is not packaged for Alpine. It seemed to be harder to use from skimming through the docs, but then again it seems to be more recent, so we could try that one.

(I also didn't try oprofile yet, but I could do that.)

Member

ollieparanoid commented Oct 18, 2017

I don't mind at all, thanks for doing that!
Just to make sure: you really mean operf instead of oprofile there? I did not try operf yet, and it is not packaged for Alpine. It seemed to be harder to use from skimming through the docs, but then again it seems to be more recent, so we could try that one.

(I also didn't try oprofile yet, but I could do that.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.