Skip to content

(release/25.1) fb: Don't widen the planemask over padding bits when ROOTLESS_SAFEALPHA is set - #3591

Open
metux wants to merge 1 commit into
release/25.1from
pr/release/25.1-fb-don-t-widen-the-planemask-over-padding-bits-when-rootless-safealpha-is-set-_2026-08-20_16-18-50
Open

(release/25.1) fb: Don't widen the planemask over padding bits when ROOTLESS_SAFEALPHA is set#3591
metux wants to merge 1 commit into
release/25.1from
pr/release/25.1-fb-don-t-widen-the-planemask-over-padding-bits-when-rootless-safealpha-is-set-_2026-08-20_16-18-50

Conversation

@metux

@metux metux commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Wide LineDoubleDash lines drew black on screen under XQuartz while the server's own XGetImage readback showed the
correct pixels, because at depth 24 that readback ignores alpha. Opaque text and dashed arcs take the same path.

fbValidateGC widens a planemask that covers the drawable's depth to cover its full bits per pixel, so the blit and
fill paths can take their all-ones shortcuts. On a rootless server that also writes the alpha channel of the window's
premultiplied surface, which CoreGraphics then composites as black. Rootless keeps that alpha opaque by clearing the
bits from the planemask, but only its own ValidateGC does so, and mi revalidates the GC in the middle of a drawing
operation to swap the foreground for the background pixel. By then the damage layer has unwrapped the rootless funcs
down to fb, so the reassertion never happens and the rest of the operation lands with a zero alpha channel.

Fixes: XQuartz/XQuartz#230

Signed-off-by: Jeremy Huddleston Sequoia jeremyhu@apple.com

…HA is set

Wide LineDoubleDash lines drew black on screen under XQuartz while the server's own XGetImage readback showed the
correct pixels, because at depth 24 that readback ignores alpha. Opaque text and dashed arcs take the same path.

fbValidateGC widens a planemask that covers the drawable's depth to cover its full bits per pixel, so the blit and
fill paths can take their all-ones shortcuts. On a rootless server that also writes the alpha channel of the window's
premultiplied surface, which CoreGraphics then composites as black. Rootless keeps that alpha opaque by clearing the
bits from the planemask, but only its own ValidateGC does so, and mi revalidates the GC in the middle of a drawing
operation to swap the foreground for the background pixel. By then the damage layer has unwrapped the rootless funcs
down to fb, so the reassertion never happens and the rest of the operation lands with a zero alpha channel.

Fixes: XQuartz/XQuartz#230

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
@metux metux self-assigned this Aug 20, 2026
@metux
metux requested a review from a team August 20, 2026 14:20
metux pushed a commit that referenced this pull request Aug 20, 2026
…ESS_SAFEALPHA is set

Wide LineDoubleDash lines drew black on screen under XQuartz while the server's own XGetImage readback showed the
correct pixels, because at depth 24 that readback ignores alpha. Opaque text and dashed arcs take the same path.

fbValidateGC widens a planemask that covers the drawable's depth to cover its full bits per pixel, so the blit and
fill paths can take their all-ones shortcuts. On a rootless server that also writes the alpha channel of the window's
premultiplied surface, which CoreGraphics then composites as black. Rootless keeps that alpha opaque by clearing the
bits from the planemask, but only its own ValidateGC does so, and mi revalidates the GC in the middle of a drawing
operation to swap the foreground for the background pixel. By then the damage layer has unwrapped the rootless funcs
down to fb, so the reassertion never happens and the rest of the operation lands with a zero alpha channel.

Fixes: XQuartz/XQuartz#230

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
PR: #3591
@metux

metux commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated review — generated by Starfleet ship Voyager on behalf of @metux. Not a human review.

Identical cherry-pick of PR #3555 (already reviewed and merged on master). Same diff, same author, same XQuartz alpha-corruption fix. fbValidateGC — no ABI impact (not referenced by any NVIDIA blob, static function context). Correct for release/25.1.

@metux metux added the bot-review-passed Automated bot review found no blocking issues label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-passed Automated bot review found no blocking issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants