Friday, April 6, 2018

KiCad display update rate fix

I've been working with KiCad to start the schematic and layout for the printed circuit board I'm going build to replace the factory PCB in the Canon P170-DH calculator.

The stable release of KiCad is 4.0.7, but I'm using bleeding-edge 5.0.0-rc2-dev built from sources — literally last night's vintage. I don't recommend this for everyone (or anyone who isn't prepared for random failures and corruptions), but it seems to have reached a level of stability I'm willing to tolerate. I'm doing this largely because I have some modifications I'm developing, and I don't want to have to re-implement them when the 5.0 release comes out in a couple months.

The 5.0 release fixes some (but not all) of the complaints I have about KiCad (see my post KiCad stupidity). The coordinate origin is still wonky, but I'm working on fixes for that. The "Move Footprint Exactly" dialogue box now lets you specify the origin. And there is a dedicated "Add Via" button.

One new problem I've encountered, though, isn't even KiCad's fault. ATI has ended support for the proprietary "fglrx" driver for their older Radeon video cards. Thus I'm using the open-source "radeon" driver instead. KiCad seems to be triggering a bug in the X11 server and/or the radeon driver that results in a horrendously slow update doing things like zooming or panning the schematic or board view. And by "horrendously slow" I mean waiting 2 seconds for the change to be visible. Yes, I mean two whole seconds. And this with a Core i7 processor at 3.40 GHz, 8 GB DDR3 RAM, and nothing else running, so it's not underpowered by any means.

There is a workaround for this problem, though. Someone discovered that if you turn off the "EXAPixmaps" option, the problem goes away without noticeably affecting anything else. The documentation for this option reads:
"Under KMS, to avoid thrashing pixmaps in/out of VRAM on low memory cards, we use a heuristic based on VRAM amount to determine whether to allow EXA to use VRAM for non-essential pixmaps. This option allows us to override the heuristic. The default is on with > 32MB VRAM, off with < 32MB."
I'm not sure I really understand what that means (and I'm a senior software engineer), but my system has 1024MB of VRAM so the heuristic would default to "on".

To turn it off, you have to create a file the X11 server reads during startup that tells the radeon driver to turn off this option. Here are the commands that will create the proper file when executed as root:
# mkdir /etc/X11/xorg.conf.d
# cd /etc/X11/xorg.conf.d
# cat <<"--EOF--" >10-fixkicad.conf
Section "Device"
  Identifier "radeon1"
  Driver "radeon"
  Option "EXAPixmaps" "off"
EndSection
--EOF--
The X11 server then needs to be restarted. There are various ways to do this; I just rebooted the system. Wow! So much better!

No comments:

Post a Comment