Skip to content

Use TimeGraphContainer forceCanvasRenderer option#1206

Merged
marcdumais-work merged 1 commit intomasterfrom
useNoWebGlContext
Jun 25, 2025
Merged

Use TimeGraphContainer forceCanvasRenderer option#1206
marcdumais-work merged 1 commit intomasterfrom
useNoWebGlContext

Conversation

@marcdumais-work
Copy link
Contributor

@marcdumais-work marcdumais-work commented Jun 20, 2025

What it does

There's a relatively low limit of WebGL contexts available for a Chrome-based browser tab (16). Each time a "TimeGraphContainer" is created, one such context is consumed. We use these contexts for a few things, not just time-line charts (where it makes most sense).

This commit takes advantage of the new option and declines that a WebGL context be used for containers we create, except for proper timeline chart views and marker containers. This means that we will now be able to create about 8 timeline-chart views per session (each uses 2 WebGL contexts), spread over however many experiments.

Note: Depends on the following timeline-chart PR, where the forceCanvasRenderer option is added in the TimeGraphContainerOptions interface:

eclipse-cdt-cloud/timeline-chart#318

update: merged and released

How to test

The easiest would be to wait until the PR above is merged and released. in the meantime, yarn link could be used.

Follow-ups

Review checklist

  • As an author, I have thoroughly tested my changes and carefully followed the instructions in this template

lineColor: this.props.style.lineColor,
classNames: 'horizontal-canvas'
classNames: 'horizontal-canvas',
noWebGl: true
Copy link
Contributor

@bhufmann bhufmann Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this container use webGL as well? This one is for marker rows (e.g. for lost events) or periodic markers? Of course this will decrease the number of available webGL contexts (up-to half less when e.g. periodic markers are shown) WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, in the end it's a trade-off. I should mention, I briefly used the devtools profiling, comparing using only WebGL for all time-graph containers vs software rendering for all, and the results for the later were almost as good as the former, except if the laptop's CPU was very busy (one time i happened to be running the timeline-chart unit tests and noticed the difference).

WDYT?

Copy link
Contributor Author

@marcdumais-work marcdumais-work Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest version uses WebGL for the case above. Compared to master, we will now be able to have 7 or 8 time-graph charts opened at one time, spread over any number of experiments. On master, each experiment with views opened would consume 2 extra WebGL contexts, even if it has no timeline-chart based views opened.

If we used software rendering for the case above, like we had initially in the PR, it would double that number to about 15-16 timeline chart views.

@marcdumais-work marcdumais-work marked this pull request as ready for review June 25, 2025 17:56
@marcdumais-work marcdumais-work changed the title Use TimeGraphContainer noWebGl option Use TimeGraphContainer forceCanvasRenderer option Jun 25, 2025
There's a relatively low limit of WebGL contexts available for a
Chrome-based browser tab (16). Each time a "TimeGraphContainer" is
created, one such context is consumed. We use these contexts for a
few things, not just time-line charts (where it makes most sense).

This commit takes advantage of the new option and declines that a
WebGL context be used for containers we create, except for proper
chart views. This means that we will now be able to create about
16 timeline-chart views per session, spread over however many
experiments.

Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
@marcdumais-work
Copy link
Contributor Author

marcdumais-work commented Jun 25, 2025

I wanted to mention that this PR is a first attempt to mitigate the issues caused by limited number of WebGL contexts that are available, to use used by time-graph containers. There is the possibility of making follow-ups to further mitigate. A couple of ideas:

  • keep track of assigned WebGL contexts currently used (updated each time one is allocated or freed) by the react-components and switch to requesting software rendering only, pass a certain threshold, such that we avoid running-out no matter how many trace views are opened. If the number of contexts decreases, start requesting WebGL-backed renderer for new containers.
  • add a preference that permits using only software renderer - this would arguably be preferable for users that expect to regularly bust the number of available WebGL contexts

@marcdumais-work
Copy link
Contributor Author

Note: the license check passed locally - the workflow seems to fail because of too many requests towards clearlydefined from GitHub.

Copy link
Contributor

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@marcdumais-work
Copy link
Contributor Author

Thanks for the review!

@marcdumais-work marcdumais-work merged commit 9f00f11 into master Jun 25, 2025
7 of 10 checks passed
@marcdumais-work marcdumais-work deleted the useNoWebGlContext branch June 25, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants