Skip to content

Keep the layers most worth a plane under a blend limit (P-105) - #126

Merged
jwinarske merged 1 commit into
mainfrom
fix/blend-limit-keep-priority
Oct 20, 2026
Merged

jwinarske merged 1 commit into
mainfrom
fix/blend-limit-keep-priority

Conversation

@jwinarske

Copy link
Copy Markdown
Owner

This is part of moving the parity baseline to drm-cxx 2a050f5. It ports the allocator half of upstream's 58cf1a7 (drm-cxx#363). The parsing half is #124.

drmkit enforced a CRTC's blend-stage limit (P-46) inside the search. Tests over the limit were refused without asking the kernel, and the backtrack dropped layers until the assignment fit. Three things differed from the reference:

  • Which layers survive: the ones the score-ordered greedy pass happened to place. A high-priority layer that pass left out stayed composited while low-priority ones held planes. That's the symptom #363 fixed.
  • Pinned and externally bound layers: they weren't counted against the limit.
  • The canvas's stage: it was counted only while a canvas plane was armed.

The new cap_to_blend_limit runs before the full search, as the reference's does:

  • pinned and externally bound layers hold stages of their own;
  • one stage is left for the canvas when anything composites;
  • the rest go by keep_priority, ties in the caller's order;
  • layers past the budget are composited.

The in-search check stays as a backstop.

Tests:

  • New: the_blend_limit_keeps_the_layers_most_worth_a_plane. With a limit of 3 and the high-priority layers at both ends of a five-layer stack, it now places exactly those two. Without the cap it placed 1, 4 and 5.
  • no_test_arms_more_planes_than_the_crtc_can_stack now expects the reference's answer: two placed, three composited, one stage for the canvas. It expected three placed before.

Docs: P-105 row and a CHANGELOG entry.

Checks: clippy over the workspace with all features, workspace tests, the scene, planes and scene-set tests on vkms, and rustdoc all pass. vkms has no blend limit, so nothing changes there.

drmkit enforced a CRTC's blend-stage limit (P-46) inside the search:
tests over the limit were refused without asking the kernel, and the
backtrack dropped layers until the assignment fit. The layers it kept
were the ones the score-ordered greedy pass had placed, so a
high-priority layer that pass left out stayed composited while
low-priority ones held planes. Upstream's 58cf1a7 (drm-cxx#363) fixed
that symptom by capping the placeable set before the search.

cap_to_blend_limit ports it. Pinned and externally bound layers hold
stages of their own, one is left for the canvas when anything
composites, and the rest go by keep_priority, ties in the caller's
order. The layers past the budget are composited. The in-search check
stays as a backstop.

no_test_arms_more_planes_than_the_crtc_can_stack now expects the
reference's answer: with a limit of 3 and five layers, two placed and
one stage for the canvas.

Signed-off-by: Joel Winarske <joel.winarske@linux.com>
@jwinarske
jwinarske force-pushed the fix/blend-limit-keep-priority branch from ec836b6 to a4e61d3 Compare October 20, 2026 19:20
@jwinarske
jwinarske merged commit 66a1ae0 into main Oct 20, 2026
10 checks passed
@jwinarske
jwinarske deleted the fix/blend-limit-keep-priority branch October 20, 2026 19:25
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.

1 participant