← Back to team overview

kicad-developers team mailing list archive

Re: Zone filling & display speed improvements

 

On 2 December 2017 at 10:11, Henner Zeller <h.zeller@xxxxxxx> wrote:
> On 1 December 2017 at 08:12, Tomasz Wlostowski
> <tomasz.wlostowski@xxxxxxx> wrote:
>> On 29/11/17 16:10, jp charras wrote:
>>> I am using a few board in Kicad demos: interf_u, video, pic_programmer.
>>>
>>> Also, filled areas are no shown in OpenGL, but are shown in Cairo canvas.
>>
>> Hi all,
>>
>> The branch [1] contains a set of improvements in the zone filling
>> algorithm. It's several times faster than in the current master branch.
>>
>> I'd like to merge it soon and move on to fixing P&S issues pending for
>> the V5 - I'll greatly appreciate testing and feedback!
>
> Hi Tom,
>
> I'll compile your branch hopefully later this weekend for testing.
> If you need another board for testing, I am currently having a board
> that takes annoying several seconds to fill the zones in head KiCad,
> which hence might be interesting test case:
>
> https://github.com/hzeller/quadrigotion.git
> path tmc2660/tmc2660-quad.kicad_pcb

So I tested your branch with the board above and it seems to work
quickly iff it does not crash; but it crashes
often. Sometimes the first time, sometimes the second time doing a
zone-recalculation (Tested under Cairo)

I have not debugged the full reason, but it seems to happen when
deleting a SHAPE_POLY_SET, somewhere around

ZONE_CONTAINER::BuildFilledSolidAreasPolygons () at
pcbnew/zone_filling_algorithm.cpp:138

Even if it is made sure that m_smoothedPoly has a defined value at
construction time with e.g.

---------------------------------------------------
--- a/pcbnew/class_zone.h
+++ b/pcbnew/class_zone.h
@@ -739,7 +739,7 @@ private:
    void buildFeatureHoleList( BOARD* aPcb, SHAPE_POLY_SET& aFeatures );

    SHAPE_POLY_SET*       m_Poly;                ///< Outline of the zone.
-    SHAPE_POLY_SET*       m_smoothedPoly;        // Corner-smoothed
version of m_Poly
+    SHAPE_POLY_SET*       m_smoothedPoly = nullptr;        //
Corner-smoothed version of m_Poly
    int                   m_cornerSmoothingType;
    unsigned int          m_cornerRadius;
------------------------------------------------------

it still crashes, possibly because the recursive deleting it might
attempt to delete some shared SHAPE_LINE_CHAIN in it ?
Running it with valgrind indicates some double-delete issue.

Making this explicitly leak in pcbnew/zone_filling_algorithm.cpp:138
by removing the 'delete' it does not crash, so there is definitely
some double-delete stuff going on.

( there is also a lot of
../src/generic/progdlgg.cpp(435): assert "value <= m_maximum" failed
in Update(): invalid progress valu
e [in thread 20c55700]
../src/gtk/gauge.cpp(95): assert "pos <= m_rangeMax" failed in
SetValue(): invalid value in wxGauge::SetValue() [in thread 20c55700]

going on when compiling in debug mode, but I don't know if that is
related/relevant
)

Then when that is 'worked around', there are other crashes later when
selecting ranom zones, this is a typical stack trace.

#8  0x00007fffe886e539 in PROGRESS_REPORTER::SetMaxProgress
(this=0x55555843f800, aMaxProgress=193)
   at common/widgets/progress_reporter.cpp:62
#9  0x00007fffe870700d in CN_CONNECTIVITY_ALGO::searchConnections
(this=0x5555572bfd00,
   aIncludeZones=true) at pcbnew/connectivity_algo.cpp:520
#10 0x00007fffe87076db in CN_CONNECTIVITY_ALGO::SearchClusters
(this=0x5555572bfd00,
   aMode=CN_CONNECTIVITY_ALGO::CSM_RATSNEST, aTypes=0x555557ce68e0,
aSingleNet=-1)
   at pcbnew/connectivity_algo.cpp:632
#11 0x00007fffe8707480 in CN_CONNECTIVITY_ALGO::SearchClusters
(this=0x5555572bfd00,
   aMode=CN_CONNECTIVITY_ALGO::CSM_RATSNEST)
   at pcbnew/connectivity_algo.cpp:616
#12 0x00007fffe8709243 in CN_CONNECTIVITY_ALGO::GetClusters
(this=0x5555572bfd00)
   at pcbnew/connectivity_algo.cpp:906
#13 0x00007fffe86f77f5 in CONNECTIVITY_DATA::RecalculateRatsnest
(this=0x555558052e70)
   at pcbnew/connectivity_data.cpp:147
#14 0x00007fffe86a0f20 in BOARD_COMMIT::Push (this=0x555557ce6c40,
aMessage=...,
   aCreateUndoEntry=false) at pcbnew/board_commit.cpp:281
#15 0x00007fffe851ad18 in PCB_EDIT_FRAME::Fill_Zone
(this=0x555556e0a4d0, aZone=0x55555811f300)
   at pcbnew/zones_by_polygon_fill_functions.cpp:123
#16 0x00007fffe8546577 in POINT_EDITOR::finishItem (this=0x5555587035f0)
   at pcbnew/tools/point_editor.cpp:575
#17 0x00007fffe854535c in POINT_EDITOR::OnSelectionChange
(this=0x5555587035f0, aEvent=...)
   at pcbnew/tools/point_editor.cpp:379

Hope this is some useful input,
Henner.


Follow ups

References