Repository navigation
web: heat maps and their legend in saved images - #11947
jorge-ferreira-pii wants to merge 12 commits into
Conversation
gui.i and gui.tcl now build without Qt too, so a script can call the gui:: commands in any build; with no window they still log GUI-0001. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
With no Qt window, the display controls act on a copy of the Qt display-control tree kept by the web viewer, with the same paths and defaults. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
save_image -web draws what the gui:: display controls chose, and a path that does not end in .png gets .png added. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
… groups Overlays and labels are drawn over the finished image at its own scale, and select and the highlight groups work with no window. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
gui::select_marker_category works with no window, and save_image -web draws the markers as the DRC viewer does. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
save_image -web draws the heat map whose control is on, and its legend once, as the Qt heat map renderer does. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
There was a problem hiding this comment.
Code Review
This pull request enables running GUI commands (such as display controls, selections, highlights, DRC markers, and heat maps) in headless/non-Qt mode by introducing a 'ScriptView' backend, allowing scripts to render the exact same views with either the Qt GUI or the server-side web tile renderer. The changes include adding a 'DisplayControlTree' to track display control states, an 'ImageOverlays' system to draw overlays over the layout, and updating the web tile generator to composite these overlays onto saved images. Feedback on the changes highlights a performance issue in 'DisplayControlTree::addDesignRows' where default visibility for new sites is redundantly computed inside nested loops, resulting in O(S^2) complexity; this can be optimized to O(S) by computing the default visibility once before entering the loops.
| // DisplayControls::libInit: a site starts as Rows is when it is added. | ||
| for (odb::dbLib* lib : db->getLibs()) { | ||
| for (odb::dbSite* site : lib->getSites()) { | ||
| const std::string path = std::string(kRows) + "/" + site->getName(); | ||
| if (leaves_.contains(path)) { | ||
| continue; | ||
| } | ||
| bool on = true; | ||
| if (const Leaf* rows = find(kRows)) { | ||
| on = rows->visible.value_or(false); | ||
| } else { | ||
| for (const auto& [other, leaf] : leaves_) { | ||
| if (other.starts_with(std::string(kRows) + "/")) { | ||
| on = on && leaf.visible.value_or(false); | ||
| } | ||
| } | ||
| } | ||
| leaves_.erase(kRows); | ||
| addLeaf(path, {.visible = on, .selectable = on}); | ||
| } | ||
| } |
There was a problem hiding this comment.
In DisplayControlTree::addDesignRows, the default visibility on for new sites is computed inside the nested loops. When kRows is not found, it iterates over all existing leaves starting with Rows/ to compute the logical AND of their visibilities. Since each new site is added to leaves_ in the loop, this nested iteration results in an
Additionally, calling leaves_.erase(kRows) repeatedly in every iteration is redundant.
We can optimize this to
bool default_on = true;
if (const Leaf* rows = find(kRows)) {
default_on = rows->visible.value_or(false);
leaves_.erase(kRows);
} else {
for (const auto& [other, leaf] : leaves_) {
if (other.starts_with(std::string(kRows) + "/")) {
default_on = default_on && leaf.visible.value_or(false);
}
}
}
for (odb::dbLib* lib : db->getLibs()) {
for (odb::dbSite* site : lib->getSites()) {
const std::string path = std::string(kRows) + "/" + site->getName();
if (leaves_.contains(path)) {
continue;
}
addLeaf(path, {.visible = default_on, .selectable = default_on});
}
}Rows' default for new sites is worked out once, a renderer control's color is reported as ignored, and RendererControls::check takes the default for a path it has no value for. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…age-script-view Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
A renderer's control is shared with the browser, so save_image -display_option cannot set it for one image; say so instead of ignoring it. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…save-image-overlays Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…e-image-drc Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…ge-heat-maps Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com> # Conflicts: # src/web/src/script_view.cpp
Part 6 of 9 for #11488. On top of PR #11946.
The heat map whose Heat Maps/* control is on (IR drop, routing congestion, placement density, and so on) is now drawn in saved images. Its legend is drawn once in the corner when gui::set_heatmap ShowLegend 1 is set. Qt and the web use the same drawing code, and a heat map shown by both is set up and released correctly.