More fix for the slow display in CellViewer.

* Change: In Hurricane::QuadTree_GosUnder::Locator::progress(), directly
    prune the elements which sizes are under the threshold. This allows
    the too small Instances to be directly skipped. This was the key
    point slowing the walktrough. We were systematically going through
    all the instances (that is consistent with the perf traces).
* Change: In Hurricane::Cell_OccurrencesUnder, add a threshold parameter
    to pass on the QuadTree (through getInstancesUnder()).
      Needed for the CellWidget selection to have the same problem as
    the display itself (select only what is displayed).
* New: In Hurricane::CellView, add two new parameters:
    1. "viewer.minimumSize" set the original size of the window, in pixels.
       (doubled for HiDPI).
    2. "viewer.pixelThreshold", the size, in pixels, under which
       components/instances will not be displayeds.
* New: In CRL/etc/cmos.misc.py, added parameters "viewer.minimumSize"
    and "viewer.pixelsThreshold".
This commit is contained in:
Jean-Paul Chaput 2020-12-02 20:02:55 +01:00
parent 7feb39d056
commit 642579b444
8 changed files with 110 additions and 58 deletions

View File

@ -31,6 +31,9 @@ param = Cfg.getParamInt( 'misc.maxTraceLevel' )
param.setInt( 0 )
param.setMin( 0 )
Cfg.getParamInt( 'viewer.minimumSize' ).setInt( 500 )
Cfg.getParamInt( 'viewer.pixelThreshold').setInt( 20 )
param = Cfg.getParamInt( 'viewer.printer.DPI' )
param.setInt( 150 )
param.setMin( 100 )

View File

@ -937,6 +937,7 @@ class Cell_OccurrencesUnder : public Collection<Occurrence> {
private: const Cell* _cell;
private: Box _area;
private: unsigned _searchDepth;
private: DbU::Unit _threshold;
private: unsigned _state;
private: ComponentLocator _componentLocator;
private: RubberLocator _rubberLocator;
@ -946,7 +947,7 @@ class Cell_OccurrencesUnder : public Collection<Occurrence> {
private: OccurrenceLocator _occurrenceLocator;
public: Locator();
public: Locator(const Cell* cell, const Box& area, unsigned searchDepth = (unsigned)-1);
public: Locator(const Cell* cell, const Box& area, unsigned searchDepth = (unsigned)-1, DbU::Unit threshold=0);
public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator);
@ -968,12 +969,13 @@ class Cell_OccurrencesUnder : public Collection<Occurrence> {
private: const Cell* _cell;
private: Box _area;
private: unsigned _searchDepth;
private: DbU::Unit _threshold;
// Constructors
// ************
public: Cell_OccurrencesUnder();
public: Cell_OccurrencesUnder(const Cell* cell, const Box& area, unsigned searchDepth = (unsigned)-1);
public: Cell_OccurrencesUnder(const Cell* cell, const Box& area, unsigned searchDepth = (unsigned)-1, DbU::Unit threshold=0);
public: Cell_OccurrencesUnder(const Cell_OccurrencesUnder& occurrences);
// Operators
@ -1957,10 +1959,10 @@ Occurrences Cell::getOccurrences(unsigned searchDepth) const
return Cell_Occurrences(this, searchDepth);
}
Occurrences Cell::getOccurrencesUnder(const Box& area, unsigned searchDepth) const
// *****************************************************************************
Occurrences Cell::getOccurrencesUnder(const Box& area, unsigned searchDepth, DbU::Unit threshold) const
// ****************************************************************************************************
{
return Cell_OccurrencesUnder(this, area, searchDepth);
return Cell_OccurrencesUnder(this, area, searchDepth, threshold);
}
Occurrences Cell::getTerminalInstanceOccurrences() const
@ -2840,38 +2842,42 @@ string Cell_Occurrences::Locator::_getString() const
// ****************************************************************************************************
Cell_OccurrencesUnder::Cell_OccurrencesUnder()
// *****************************************
// *******************************************
: Inherit(),
_cell(NULL),
_area(),
_searchDepth(0)
_searchDepth(0),
_threshold(0)
{
}
Cell_OccurrencesUnder::Cell_OccurrencesUnder(const Cell* cell, const Box& area, unsigned searchDepth)
// ************************************************************************************************
Cell_OccurrencesUnder::Cell_OccurrencesUnder(const Cell* cell, const Box& area, unsigned searchDepth, DbU::Unit threshold)
// ***********************************************************************************************************************
: Inherit(),
_cell(cell),
_area(area),
_searchDepth(searchDepth)
_searchDepth(searchDepth),
_threshold(threshold)
{
}
Cell_OccurrencesUnder::Cell_OccurrencesUnder(const Cell_OccurrencesUnder& occurrences)
// *******************************************************************************
// ***********************************************************************************
: Inherit(),
_cell(occurrences._cell),
_area(occurrences._area),
_searchDepth(occurrences._searchDepth)
_searchDepth(occurrences._searchDepth),
_threshold(occurrences._threshold)
{
}
Cell_OccurrencesUnder& Cell_OccurrencesUnder::operator=(const Cell_OccurrencesUnder& occurrences)
// ******************************************************************************************
// **********************************************************************************************
{
_cell = occurrences._cell;
_area = occurrences._area;
_searchDepth = occurrences._searchDepth;
_threshold = occurrences._threshold;
return *this;
}
@ -2884,7 +2890,7 @@ Collection<Occurrence>* Cell_OccurrencesUnder::getClone() const
Locator<Occurrence>* Cell_OccurrencesUnder::getLocator() const
// *********************************************************
{
return new Locator(_cell, _area, _searchDepth);
return new Locator(_cell, _area, _searchDepth, _threshold);
}
string Cell_OccurrencesUnder::_getString() const
@ -2894,7 +2900,8 @@ string Cell_OccurrencesUnder::_getString() const
if (_cell) {
s += " " + getString(_cell);
s += " " + getString(_area);
if (_searchDepth != ((unsigned)-1)) s += " " + getString(_searchDepth);
if (_searchDepth != ((unsigned)-1)) s += " depth:" + getString(_searchDepth);
if (_threshold > 0) s += " threshold:" + DbU::getValueString(_threshold);
}
s += ">";
return s;
@ -2912,6 +2919,7 @@ Cell_OccurrencesUnder::Locator::Locator()
_cell(NULL),
_area(),
_searchDepth(0),
_threshold(0),
_state(0),
_componentLocator(),
_rubberLocator(),
@ -2922,12 +2930,13 @@ Cell_OccurrencesUnder::Locator::Locator()
{
}
Cell_OccurrencesUnder::Locator::Locator(const Cell* cell, const Box& area, unsigned searchDepth)
// ********************************************************************************************
Cell_OccurrencesUnder::Locator::Locator(const Cell* cell, const Box& area, unsigned searchDepth, DbU::Unit threshold)
// ******************************************************************************************************************
: Inherit(),
_cell(cell),
_area(area),
_searchDepth(searchDepth),
_threshold(threshold),
_state(0),
_componentLocator(),
_rubberLocator(),
@ -2969,6 +2978,7 @@ Cell_OccurrencesUnder::Locator::Locator(const Locator& locator)
_cell(locator._cell),
_area(locator._area),
_searchDepth(locator._searchDepth),
_threshold(locator._threshold),
_state(locator._state),
_componentLocator(locator._componentLocator),
_rubberLocator(locator._rubberLocator),
@ -2985,6 +2995,7 @@ Cell_OccurrencesUnder::Locator& Cell_OccurrencesUnder::Locator::operator=(const
_cell = locator._cell;
_area = locator._area;
_searchDepth = locator._searchDepth;
_threshold = locator._threshold;
_state = locator._state;
_componentLocator = locator._componentLocator;
_rubberLocator = locator._rubberLocator;
@ -3048,7 +3059,7 @@ void Cell_OccurrencesUnder::Locator::progress()
if (_extensionGoLocator.isValid())
_state = 4;
else {
_instanceLocator = _cell->getInstancesUnder(_area).getLocator();
_instanceLocator = _cell->getInstancesUnder(_area,_threshold).getLocator();
if (_instanceLocator.isValid())
_state = 5;
else
@ -3069,7 +3080,7 @@ void Cell_OccurrencesUnder::Locator::progress()
if (_extensionGoLocator.isValid())
_state = 4;
else {
_instanceLocator = _cell->getInstancesUnder(_area).getLocator();
_instanceLocator = _cell->getInstancesUnder(_area,_threshold).getLocator();
if (_instanceLocator.isValid())
_state = 5;
else
@ -3085,7 +3096,7 @@ void Cell_OccurrencesUnder::Locator::progress()
if (_extensionGoLocator.isValid())
_state = 4;
else {
_instanceLocator = _cell->getInstancesUnder(_area).getLocator();
_instanceLocator = _cell->getInstancesUnder(_area,_threshold).getLocator();
if (_instanceLocator.isValid())
_state = 5;
else
@ -3096,7 +3107,7 @@ void Cell_OccurrencesUnder::Locator::progress()
case 4 :
_extensionGoLocator.progress();
if (!_extensionGoLocator.isValid()) {
_instanceLocator = _cell->getInstancesUnder(_area).getLocator();
_instanceLocator = _cell->getInstancesUnder(_area,_threshold).getLocator();
if (_instanceLocator.isValid())
_state = 5;
else
@ -3119,7 +3130,7 @@ void Cell_OccurrencesUnder::Locator::progress()
instance->getTransformation().getInvert().applyOn(masterArea);
Cell* masterCell = instance->getMasterCell();
_occurrenceLocator =
masterCell->getOccurrencesUnder(masterArea, _searchDepth - 1).getLocator();
masterCell->getOccurrencesUnder(masterArea, _searchDepth - 1,_threshold).getLocator();
if (_occurrenceLocator.isValid())
_state = 6;
else {

View File

@ -19,6 +19,7 @@
#include "hurricane/QuadTree.h"
#include "hurricane/Go.h"
#include "hurricane/Instance.h"
#include "hurricane/Error.h"
#include "hurricane/Warning.h"
@ -861,8 +862,21 @@ void QuadTree_GosUnder::Locator::progress()
if (_currentQuadTree)
_goLocator = _currentQuadTree->_getGoSet().getElements().getLocator();
}
} while (isValid() and not getElement()->getBoundingBox().intersect(_area));
// if (isValid()) {
// if (( (getElement()->getBoundingBox().getWidth () < _threshold)
// and (getElement()->getBoundingBox().getHeight() < _threshold)) )
// cerr << " goUnders: pruning " << getElement() << endl;
// else
// cerr << " goUnders: display " << getElement() << endl;
// }
} while ( isValid()
and ( not getElement()->getBoundingBox().intersect(_area)
or ( (getElement()->getBoundingBox().getWidth () < _threshold)
and (getElement()->getBoundingBox().getHeight() < _threshold))) );
}
// if (isValid()) {
// cerr << " goUnders: accept " << getElement() << endl;
// }
}
string QuadTree_GosUnder::Locator::_getString() const

View File

@ -51,6 +51,7 @@ namespace Hurricane {
, _topTransformation ()
, _startLevel (0)
, _stopLevel (std::numeric_limits<unsigned int>::max())
, _instanceCount (0)
{ }
@ -110,6 +111,7 @@ namespace Hurricane {
// << endl;
_stack.init();
//cerr << "doQuery() start:" << _stack.getInstanceCount() << " " << _basicLayer << endl;
while ( not _stack.empty() ) {
// Process the Components of the current instance.
@ -164,6 +166,8 @@ namespace Hurricane {
_stack.progress ();
} // End of while.
//cerr << "doQuery() count:" << _stack.getInstanceCount() << endl;
}

View File

@ -459,7 +459,7 @@ class Cell : public Entity {
public: Components getComponents(const Layer::Mask& mask = ~0) const;
public: Components getComponentsUnder(const Box& area, const Layer::Mask& mask = ~0) const;
public: Occurrences getOccurrences(unsigned searchDepth = std::numeric_limits<unsigned int>::max()) const;
public: Occurrences getOccurrencesUnder(const Box& area, unsigned searchDepth = std::numeric_limits<unsigned int>::max()) const;
public: Occurrences getOccurrencesUnder(const Box& area, unsigned searchDepth = std::numeric_limits<unsigned int>::max(), DbU::Unit threshold=0) const;
public: Occurrences getTerminalInstanceOccurrences() const;
public: Occurrences getTerminalInstanceOccurrencesUnder(const Box& area) const;
public: Occurrences getTerminalNetlistInstanceOccurrences( const Instance* topInstance=NULL ) const;

View File

@ -31,6 +31,7 @@
#pragma once
#include <vector>
#include <iomanip>
#include "hurricane/Commons.h"
#include "hurricane/Box.h"
#include "hurricane/Transformation.h"
@ -134,6 +135,7 @@ namespace Hurricane {
inline void levelProgress ();
inline bool levelCompleted ();
inline void progress ( bool init=false );
inline size_t getInstanceCount () const;
protected:
// Internal: Attributes.
@ -144,6 +146,7 @@ namespace Hurricane {
Transformation _topTransformation;
unsigned int _startLevel;
unsigned int _stopLevel;
size_t _instanceCount;
private:
// Internal: Constructors.
@ -165,6 +168,7 @@ namespace Hurricane {
inline const Transformation& QueryStack::getTransformation () const { return back()->_transformation; }
inline const Path& QueryStack::getPath () const { return back()->_path; }
//inline const Tabulation& QueryStack::getTab () const { return _tab; }
inline size_t QueryStack::getInstanceCount () const { return _instanceCount; }
inline Instance* QueryStack::getInstance ()
@ -192,12 +196,13 @@ namespace Hurricane {
inline void QueryStack::init ()
{
while ( !empty() ) levelUp();
_instanceCount = 0;
while (not empty()) levelUp();
push_back ( new QueryState(NULL,_topArea,_topTransformation,Path()) );
push_back( new QueryState(NULL,_topArea,_topTransformation,Path()) );
//_tab++;
progress ( true );
progress( true );
}
@ -260,33 +265,35 @@ namespace Hurricane {
inline void QueryStack::levelProgress ()
{
if ( levelCompleted() ) return;
if (levelCompleted()) return;
back()->_locator->progress ();
if ( !back()->_locator->isValid() ) return;
back()->_locator->progress();
if (not back()->_locator->isValid()) return;
updateTransformation ();
//cerr << " stack:" << std::setw(3) << _instanceCount << ":" << getPath() << endl;
++_instanceCount;
updateTransformation();
}
inline void QueryStack::progress ( bool init )
{
if ( !init ) levelProgress ();
if (not init) levelProgress ();
else {
if ( !levelDown() && ( size() > _startLevel ) )
if (not levelDown() and (size() > _startLevel))
return;
}
while ( !empty() ) {
if ( levelCompleted() ) {
while (not empty()) {
if (levelCompleted()) {
levelUp ();
} else {
if ( levelDown() ) continue;
if (levelDown()) continue;
}
if ( size() > _startLevel ) return;
if ( empty() ) break;
levelProgress ();
if (size() > _startLevel) return;
if (empty()) break;
levelProgress();
}
}

View File

@ -1,14 +1,14 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2018, All Rights Reserved
// Copyright (c) UPMC 2008-2020, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./CellWidget.cpp" |
// +-----------------------------------------------------------------+
@ -27,6 +27,7 @@
#include <QBitmap>
#include <QLabel>
#include "vlsisapd/configuration/Configuration.h"
#include "hurricane/SharedName.h"
#include "hurricane/DataBase.h"
#include "hurricane/Technology.h"
@ -869,9 +870,12 @@ namespace Hurricane {
void CellWidget::TextDrawingQuery::masterCellCallback ()
{
Box bbox = getTransformation().getBox(getMasterCell()->getAbutmentBox());
if ( getDepth() == 2 )
_cellWidget->drawText ( Point(bbox.getXMin(),bbox.getYMin())
Box bb = getTransformation().getBox( getMasterCell()->getAbutmentBox() );
QRect rectangle = _cellWidget->dbuToScreenRect( bb );
if ( (getDepth() == 2)
and (rectangle.width () > _cellWidget->getPixelThreshold())
and (rectangle.height() > 15*_cellWidget->getPixelThreshold()))
_cellWidget->drawText ( Point(bb.getXMin(),bb.getYMin())
, getString(getInstance()->getName()).c_str()
, Reverse|Top
, -90
@ -1079,16 +1083,16 @@ namespace Hurricane {
// Class : "Hurricane::CellWidget".
int CellWidget::_initialSide = 350;
CellWidget::CellWidget ( QWidget* parent )
: QWidget (parent)
, _technology (NULL)
, _palette (NULL)
, _screenArea (0,0,_initialSide,_initialSide)
, _screenArea ( 0, 0
, Cfg::getParamInt("viewer.minimumSize",350)->asInt()
, Cfg::getParamInt("viewer.minimumSize",350)->asInt() )
, _redrawManager (this)
, _drawingPlanes (QSize(_initialSide,_initialSide),this)
, _drawingPlanes (QSize(Cfg::getParamInt("viewer.minimumSize",350)->asInt()
,Cfg::getParamInt("viewer.minimumSize",350)->asInt()),this)
, _drawingQuery (this)
, _textDrawingQuery (this)
, _darkening (DisplayStyle::HSVr())
@ -1106,6 +1110,7 @@ namespace Hurricane {
, _commands ()
, _redrawRectCount (0)
, _textFontHeight (20)
, _pixelThreshold (Cfg::getParamInt("viewer.pixelThreshold",50)->asInt())
{
//setBackgroundRole ( QPalette::Dark );
//setAutoFillBackground ( false );
@ -1123,8 +1128,8 @@ namespace Hurricane {
_textFontHeight = QFontMetrics(font).ascent();
if (Graphics::isHighDpi()) {
resize( Graphics::toHighDpi(_initialSide)
, Graphics::toHighDpi(_initialSide) );
resize( Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt())
, Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt()) );
}
}
@ -1243,7 +1248,8 @@ namespace Hurricane {
QSize CellWidget::minimumSizeHint () const
{
return QSize(Graphics::toHighDpi(_initialSide),Graphics::toHighDpi(_initialSide));
return QSize(Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt())
,Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt()));
}
@ -1351,7 +1357,7 @@ namespace Hurricane {
Box redrawBox = screenToDbuBox( redrawArea );
//cerr << "redrawBox:" << redrawBox << endl;
//cerr << "Threshold:" << DbU::getValueString(screenToDbuLength(20)) << endl;
//cerr << "Threshold:" << DbU::getValueString(screenToDbuLength(_pixelThreshold)) << endl;
_drawingQuery.resetGoCount ();
_drawingQuery.resetExtensionGoCount();
@ -1359,7 +1365,7 @@ namespace Hurricane {
_drawingQuery.setExtensionMask ( 0 );
_drawingQuery.setArea ( redrawBox );
_drawingQuery.setTransformation ( Transformation() );
_drawingQuery.setThreshold ( screenToDbuLength(20) );
_drawingQuery.setThreshold ( screenToDbuLength(_pixelThreshold) );
for ( BasicLayer* layer : _technology->getBasicLayers() ) {
_drawingPlanes.setPen ( Graphics::getPen (layer->getName(),getDarkening()) );
@ -1395,6 +1401,7 @@ namespace Hurricane {
}
}
_drawingQuery.setStopLevel( _state->getStartLevel() + 1 );
if ( /*not timeout("redraw [markers]",timer,10.0,timedout) and*/ (not _redrawManager.interrupted()) ) {
if ( isDrawable("text.reference") ) {
_drawingPlanes.setPen ( Graphics::getPen ("text.reference",getDarkening()) );
@ -1452,6 +1459,7 @@ namespace Hurricane {
_drawingQuery.doQuery ();
}
}
_drawingQuery.setStopLevel( _state->getStopLevel() );
}
_drawingPlanes.end();
@ -1610,7 +1618,7 @@ namespace Hurricane {
DbU::Unit unity = DbU::lambda(1.0);
if (not item) return false;
return item->isItemVisible() and (Graphics::getThreshold(name) < getScale()*unity);
return item->isItemVisible(); //and (Graphics::getThreshold(name) < getScale()*unity);
}
@ -1629,7 +1637,7 @@ namespace Hurricane {
DbU::Unit unity = DbU::lambda(1.0);
if (not item) return false;
return item->isItemVisible() and (Graphics::getThreshold(extensionName) < getScale()*unity);
return item->isItemVisible(); // and (Graphics::getThreshold(extensionName) < getScale()*unity);
}
@ -2597,7 +2605,8 @@ namespace Hurricane {
Occurrences CellWidget::getOccurrencesUnder ( const Box& area ) const
{
return getCell()->getOccurrencesUnder(area,3).getSubSet(Occurrences_IsSelectable(this));
return getCell()->getOccurrencesUnder( area, 3, screenToDbuLength(_pixelThreshold) ) \
.getSubSet( Occurrences_IsSelectable(this) );
}

View File

@ -166,6 +166,7 @@ namespace Hurricane {
inline const DisplayStyle::HSVr& getDarkening () const;
inline void copyToPrinter ( int xpaper, int ypaper, QPrinter*, PainterCb_t& );
inline void copyToImage ( QImage*, PainterCb_t& );
inline int getPixelThreshold () const;
inline const float& getScale () const;
inline const QPoint& getMousePosition () const;
inline void updateMousePosition ();
@ -639,7 +640,6 @@ namespace Hurricane {
protected:
// Internal: Attributes.
static int _initialSide;
vector<Qt::CursorShape> _cursors;
// MapView* _mapView;
Technology* _technology;
@ -664,6 +664,7 @@ namespace Hurricane {
vector<Command*> _commands;
size_t _redrawRectCount;
int _textFontHeight;
int _pixelThreshold;
friend class RedrawManager;
};
@ -1113,6 +1114,9 @@ namespace Hurricane {
{ return _scaleHistory[_ihistory]._scale; }
inline int CellWidget::getPixelThreshold () const
{ return _pixelThreshold; }
inline CellWidget::FindStateName::FindStateName ( const Name& cellHierName )
: unary_function< const shared_ptr<State>&, bool >()
, _cellHierName(cellHierName)