pcbnew: slow starting in OpenGL mode

Bug #1685335 reported by Eldar Khayrullin
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Undecided
Unassigned

Bug Description

Start pcbnew without board ~56 sec in OpenGL mode.
Start pcbnew with simple board ~30 sec (less than without board. Why?) in OpenGL mode.

Application: kicad
Version: no-vcs-found-e53c3af~58~ubuntu17.04.1, release build
Libraries: wxWidgets 3.0.2
           libcurl/7.52.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) librtmp/2.3
Platform: Linux 4.10.0-19-generic x86_64, 64 bit, Little endian, wxGTK
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.62.0
Curl: 7.52.1
KiCad - Compiler: GCC 6.3.0 with C++ ABI 1010
        Settings: USE_WX_GRAPHICS_CONTEXT=OFF
                  USE_WX_OVERLAY=OFF
                  KICAD_SCRIPTING=ON
                  KICAD_SCRIPTING_MODULES=ON
                  KICAD_SCRIPTING_WXPYTHON=ON
                  KICAD_SCRIPTING_ACTION_MENU=ON
                  BUILD_GITHUB_PLUGIN=ON
                  KICAD_USE_OCE=ON

Revision history for this message
Eldar Khayrullin (eldar) wrote :

git bisect gave:
88eb648cbb5d5552fef4e9ffd5f57b2f61cfa8ff is the first bad commit

$ git bisect log
git bisect start
# good: [f3d4f7322b9ea9cff6c3b9c6f50ea65dd4f2846b] Simulator dialogs: Fix incorrect handling of Validate(), which was called for all widgets by the default wxID_OK button handler. It is now called only for the active page of these dialogs (as wanted in code), therefore only for used widgets. Note: strangely, this issue was noticed only on Windows, not on Linux.
git bisect good f3d4f7322b9ea9cff6c3b9c6f50ea65dd4f2846b
# bad: [70b39d27ae61e60f94bf1189562229079e4fd2a6] Fix a compil issue due to incorrect conversion.
git bisect bad 70b39d27ae61e60f94bf1189562229079e4fd2a6
# good: [6d7f0b45f4767fc15d6e3624d6e3006431aa73c0] dialog_export_step_base: cosmetic enhancements, add tool tips and better messages.
git bisect good 6d7f0b45f4767fc15d6e3624d6e3006431aa73c0
# good: [d04b3bdc27b25d568a524dd78f8c828e6761233a] Add Antialiasing option to dialog_display_options (Thank you Simon Richter)
git bisect good d04b3bdc27b25d568a524dd78f8c828e6761233a
# bad: [d51d53c6b9a42d218ecaa1bf6782b6f77aefb759] CONTEXT_TRACK_WIDTH_MENU EventHandler: better filtering of received events ID. This is mandatory because currently, on Windows, this handler is also called when clicking on an other menu with submenus like the grid menu.
git bisect bad d51d53c6b9a42d218ecaa1bf6782b6f77aefb759
# bad: [9c49dea7417f332db0c5ccd06c2e2d1c49a9ad66] Update complex hierarchy demo to use current kicad libraries.
git bisect bad 9c49dea7417f332db0c5ccd06c2e2d1c49a9ad66
# good: [9bc2bb26513dae023246e29ce62782de09140f74] Fixed a VIEW_ITEM memory leak
git bisect good 9bc2bb26513dae023246e29ce62782de09140f74
# bad: [7eacd1b15dc9f57dc549701d4a40165db12f4ef4] Restored cursor in OpenGL canvas (still an issue with subpixel AA)
git bisect bad 7eacd1b15dc9f57dc549701d4a40165db12f4ef4
# good: [ca085de6aa15f81b0a473c71ef4fd415340cd0d6] Initialize fields in COMPOSITOR
git bisect good ca085de6aa15f81b0a473c71ef4fd415340cd0d6
# bad: [7cf1cfedb37248fd0eb4b2c02b01dd29c640b3e3] Change exception message time from wxString to std::string
git bisect bad 7cf1cfedb37248fd0eb4b2c02b01dd29c640b3e3
# bad: [88eb648cbb5d5552fef4e9ffd5f57b2f61cfa8ff] Alternative way of handling OpenGL initialization & errors
git bisect bad 88eb648cbb5d5552fef4e9ffd5f57b2f61cfa8ff
# first bad commit: [88eb648cbb5d5552fef4e9ffd5f57b2f61cfa8ff] Alternative way of handling OpenGL initialization & errors

Revision history for this message
Eldar Khayrullin (eldar) wrote :

OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD RV770 (DRM 2.49.0 / 4.10.0-19-generic, LLVM 4.0.0)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 17.0.3
OpenGL core profile shading language version string: 3.30
Video card: ATI HD4870 512Mb

tags: added: ati
Revision history for this message
Maciej Suminski (orsonmmz) wrote :
Revision history for this message
Eldar Khayrullin (eldar) wrote :

Maciej, Good work. Now Kicad is usable again.
But I noticed that the Color Picker dialog in OpenGL mode opening is slow. (maybe another one bug)

Revision history for this message
Eldar Khayrullin (eldar) wrote :
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 262fcc91af10a11eb4caed2ff864e0cce17c868a
https://git.launchpad.net/kicad/patch/?id=262fcc91af10a11eb4caed2ff864e0cce17c868a

Changed in kicad:
status: New → Fix Committed
Revision history for this message
Eldar Khayrullin (eldar) wrote :

The bug appears again:
Application: kicad
Version: no-vcs-found-9485a4d~59~ubuntu17.04.1, release build
Libraries: wxWidgets 3.0.2
           libcurl/7.52.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) librtmp/2.3
Platform: Linux 4.10.0-30-generic x86_64, 64 bit, Little endian, wxGTK
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.62.0
Curl: 7.52.1
KiCad - Compiler: GCC 6.3.0 with C++ ABI 1010
        Settings: USE_WX_GRAPHICS_CONTEXT=OFF
                  USE_WX_OVERLAY=OFF
                  KICAD_SCRIPTING=ON
                  KICAD_SCRIPTING_MODULES=ON
                  KICAD_SCRIPTING_WXPYTHON=ON
                  KICAD_SCRIPTING_ACTION_MENU=ON
                  BUILD_GITHUB_PLUGIN=ON
                  KICAD_USE_OCE=ON

I compiled this one with your patch. Works fine:
Application: pcbnew
Version: (2017-08-04 revision aa3a1267e)-master, debug build
Libraries: wxWidgets 3.0.2
           libcurl/7.52.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) librtmp/2.3
Platform: Linux 4.10.0-30-generic x86_64, 64 bit, Little endian, wxGTK
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.62.0
Curl: 7.52.1
KiCad - Compiler: GCC 6.3.0 with C++ ABI 1010
        Settings: USE_WX_GRAPHICS_CONTEXT=OFF
                  USE_WX_OVERLAY=OFF
                  KICAD_SCRIPTING=ON
                  KICAD_SCRIPTING_MODULES=ON
                  KICAD_SCRIPTING_WXPYTHON=ON
                  KICAD_SCRIPTING_ACTION_MENU=ON
                  BUILD_GITHUB_PLUGIN=ON
                  KICAD_USE_OCE=ON

Changed in kicad:
status: Fix Committed → Confirmed
Revision history for this message
Eldar Khayrullin (eldar) wrote :

The log of 'git apply -3' show that your patch isn't the same. See my log.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

No, it is not the same patch, as I published here a quick and dirty solution to test an idea. After that, I had to clean up and document the code. There is also a method that recognizes AMD cards to apply the faster rendering method for them (at expense of RAM).

Clearly something went wrong, but I think I am close to finding the solution.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Eldar, what do you get after executing 'glewinfo | grep Running'?

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Maciej, after executing 'glewinfo | grep Running' I get:
Running on a Gallium 0.4 on AMD RV770 (DRM 2.49.0 / 4.10.0-32-generic, LLVM 4.0.0) from X.Org

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Eldar, please test https://pastebin.com/raw/KgAVSeJD and tell me whether it fixes the problem for you. Just to let you know - the patch is not an ultimate solution, but another data point for me. I do not want to fix AMD/ATI support at expense of other GPUs that come with well developed drivers.

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Maciej, this patch looks fine.
I don't know is the same bug but when I start to 'Route track', 'Change layer', 'Color picker' the pcbnew has timeout (5-7 seconds).

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Looks fine, meaning it fixes the problem for you?

What do you mean by 'timeout'? It takes a several seconds to perform an operation? Does it happen every time or only the first operation is slow? Was it broken before the recent changes or did it break after applying the patch?

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Ok, I have found a computer where I can reproduce the problem. It will make debugging much easier.
BTW. I think what you are describing is bug lp:#1701936.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 6ff065fa63af6dc1d3fc19e335321201792304ec
https://git.launchpad.net/kicad/patch/?id=6ff065fa63af6dc1d3fc19e335321201792304ec

Changed in kicad:
status: Confirmed → Fix Committed
Revision history for this message
Eldar Khayrullin (eldar) wrote :

Maciej, thank you. Yes, the bug lp:#1701936 seems what I talk.

Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.