Skip to content

Disable region dirty rect clipping by default - #21553

Merged
MrJul merged 1 commit into
AvaloniaUI:masterfrom
MrJul:feature/disable-default-region-clipping
Jun 15, 2026
Merged

MrJul merged 1 commit into
AvaloniaUI:masterfrom
MrJul:feature/disable-default-region-clipping

Conversation

@MrJul

@MrJul MrJul commented Jun 11, 2026 •

Copy link
Copy Markdown
Member

What does the pull request do?

This PR disables CompositionOptions.UseRegionDirtyRectClipping by default.

It's been found to cause slowdowns in various scenarios, read #21538 (comment) for details.

Users on embedded systems might still want to turn it on, but users with actual GPUs should benefit from the setting being off by default.

This will be the new default in Avalonia 12.1.

Fixed issues

@kekekeks

Copy link
Copy Markdown
Member

We should probably keep it on for SW rendering targets. (need benchmarks though).

@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.1.999-cibuild0066268-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul

MrJul commented Jun 11, 2026 •

Copy link
Copy Markdown
Member Author

We should probably keep it on for SW rendering targets. (need benchmarks though).

Win32, software mode, average CPU frame render time:

Test UseRegionDirtyRectClipping = false UseRegionDirtyRectClipping = true
> 1000 lines (#21538) 10.0 ms 9.7 ms
2 borders (#21538 (comment)) 7.1 ms 6.7 ms
RenderDemo Hit Testing 15.8 ms 18.5 ms

So it seems that keeping it enabled in software mode is a bit better in simple cases but worse in complex ones.
I'm sure examples can be found where it's tremendously better, but this is where it should probably be manually enabled.

@maxkatz6

maxkatz6 commented Jun 14, 2026 •

Copy link
Copy Markdown
Member

Ideally, we might need to document rendering/composition options here too AvaloniaUI/avalonia-docs#998
cc @luke-whos-here

@qwertychouskie

Copy link
Copy Markdown
Contributor

Does this also apply to Linux Embedded when using direct DRM rendering? Unfortunately it seems that documentation is very lacking for what options/tunables apply, which makes diagnosing performance issues (#21580) difficult.

Also, is there a way to enable/disable this option (and other related ones) using environment variables for easy testing, or is it required to change the source code and re-compile?

@MrJul

MrJul commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Does this also apply to Linux Embedded when using direct DRM rendering?

DRM uses the GPU, so you'll get the slow software mask fallback by default when regions are enabled. So yes, setting the flag explicitly to false using .With(new CompositionOptions() { UseRegionDirtyRectClipping = false }) or waiting for this PR should improve things there. You don't need to recompile Avalonia.

@MrJul
MrJul added this pull request to the merge queue Jun 15, 2026
Merged via the queue into AvaloniaUI:master with commit 892e9e1 Jun 15, 2026
12 checks passed
@MrJul
MrJul deleted the feature/disable-default-region-clipping branch June 15, 2026 08:26
@MrJul MrJul added this to the 12.1 milestone Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I found that the rendering frame rate is very low in versions above 12.

5 participants