Skip to content

perf(desktop-gpui): AVX2/SSSE3 rgba to bgra unpad - #3309

Open
kyzer1023 wants to merge 6 commits into
CapSoftware:mainfrom
kyzer1023:kyzer/desktop-gpui-avx2-rgba-bgra-unpad-5e89
Open

kyzer1023 wants to merge 6 commits into
CapSoftware:mainfrom
kyzer1023:kyzer/desktop-gpui-avx2-rgba-bgra-unpad-5e89

Conversation

@kyzer1023

@kyzer1023 kyzer1023 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

unpad_rgba_to_bgra (used by frame_image for every RGBA editor preview frame, and portable camera-blur readback when the texture is RGBA) now uses AVX2 vpshufb (8 px) when available, SSSE3 (4 px) otherwise, and the prior scalar loop as fallback. Channel swap + tight pack of already-RGBA pixels — does not replace YUYV/NV12/BGRZ kernels (#3294 path still coexists).

Benchmarks

rustc 1.95.0, opt-level=3, thin LTO, codegen-units=1, RUSTFLAGS=-C target-cpu=x86-64. Intel Xeon family 6 model 207 (AVX2+SSSE3). Warmup 10, 30 measured, interleaved, median. Before = scalar pointer loop in the same binary.

Workload Stride Scalar AVX2
preview 1248×702 5120 0.348 ms 0.207 ms (~1.68×)
1080p 7680 0.830 ms 0.489 ms
4k 15360 3.294 ms 1.950 ms

Tests

Release assert_eq matched on all three sizes. Unit tests: AVX2 and SSSE3 match scalar on full 1248×702 (odd widths + padding).

Notes

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issue remains from this review.

Summary

Adds AVX2 and SSSE3 paths for RGBA-to-BGRA frame conversion, with a scalar fallback.

  • RGBA frame conversion uses wider pixel groups on supported CPUs.
  • Wayland display queries wait up to one second for compositor replies.
  • Hyprland screenshot checks use the monitor's reported size.
  • The camera reliability job prepares kernel modules for its runner.

No new actionable issues were found. Tests were inspected but not run.

Reviews (7) · Last reviewed commit: "fix: allow busy Wayland compositors to e..." · Reviewed by Greptile

Dispatch the editor preview's RGBA row unpad through AVX2, or SSSE3 when AVX2 is absent. The same function tightens portable camera-blur readback when that texture is RGBA.
@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@kyzer1023 is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread apps/desktop-gpui/kernels/src/frame.rs Resolved
Run the existing odd-width and padded-stride cases through the scalar, SSSE3, and AVX2 helpers, gated by runtime feature detection. The dispatcher picks AVX2 whenever it is available, so those cases never reached the SSSE3 tail before.

Copy link
Copy Markdown
Contributor Author

@greptileai review

1 similar comment
@kyzer1023

Copy link
Copy Markdown
Contributor Author

@greptileai review

Copy link
Copy Markdown
Contributor Author

@greptileai review

Copy link
Copy Markdown
Contributor Author

@greptileai review

Copy link
Copy Markdown
Contributor Author

@greptileai review

Copy link
Copy Markdown
Contributor Author

@greptileai review

This branch has not been deployed

No deployments
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