Skip to content

fix(android): draw pixel buffers without decoding - #1158

Merged
houko merged 1 commit into
mainfrom
feat/android-pixel-buffers-1100
Nov 21, 2026
Merged

houko merged 1 commit into
mainfrom
feat/android-pixel-buffers-1100

Conversation

@houko

@houko houko commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Send premultiplied RGBA frames ahead of the mount batch that uses them. Android updates the image view's mutable bitmap in place and applies each canvas's current pixel frames before drawing.
  • Keep unchanged copies off the pipe. Canvas pixel frames follow the drawing's lifetime and reuse bitmaps by size. The image loader and its cache continue to serve encoded sources.
  • Rebuild the Android runtime DEX and JAR and update the public guides and architecture measurement.

Verification

  • Host vet and Android arm64/x64 vet passed.
  • The Android backend's host tests passed (35 passed, 4 target-only skips). Three tests ran on a Pixel 3 XL, covering image and canvas pixels and alpha, the encoded canvas cache, and native tab bar SVG tint.
  • On the Pixel 3 XL with Android 12, a 960 × 540 app buffer changed at 59–60 fps. The eight-second screen capture contained 477 consecutive versions, each with the expected color and no blank frame. During the capture, a 2,073,600-byte frame took 5.07–5.29 ms median and 6.20–6.71 ms p95 to write through the pipe. The timings cover the pipe writes, excluding bitmap upload and rendering.

Closes #1100

@github-actions github-actions Bot added documentation Improvements or additions to documentation Android size/L bug Something isn't working conflict Conflicts with the base branch; resolve it first labels Nov 21, 2026
@houko
houko force-pushed the feat/android-pixel-buffers-1100 branch from e3efd1c to bd38d8d Compare November 21, 2026 03:22
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 21, 2026
@houko
houko force-pushed the feat/android-pixel-buffers-1100 branch from bd38d8d to c4ad5e7 Compare November 21, 2026 05:11
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 21, 2026
@houko
houko force-pushed the feat/android-pixel-buffers-1100 branch from c4ad5e7 to 82a7d05 Compare November 21, 2026 05:59
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 21, 2026
@houko
houko force-pushed the feat/android-pixel-buffers-1100 branch from 82a7d05 to 5597236 Compare November 21, 2026 06:30
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 21, 2026
@houko
houko force-pushed the feat/android-pixel-buffers-1100 branch from 5597236 to e9223b2 Compare November 21, 2026 07:38
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 21, 2026
@houko
houko force-pushed the feat/android-pixel-buffers-1100 branch from e9223b2 to 97f969e Compare November 21, 2026 11:48
@github-actions github-actions Bot removed the conflict Conflicts with the base branch; resolve it first label Nov 21, 2026
@houko

houko commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed.

  • Read the Go and Java diff against Android: show pixel-buffer versions in place and draw them in canvases #1100's acceptance. Frames go out under the pipe lock ahead of the batch that uses them. The item index matches Java's mount loop. Keys are the core's per-version copies (pointer + version). Canvas bitmaps follow the drawing and are reused by size, and image views keep one mutable bitmap per request.
  • Pixel 3 XL (Android 12): TestPixelBuffersInImageAndCanvas, the canvas-cache and tab bar tests pass. With the Go and Java changes reverted to the base and the test file kept, the test fails at the canvas sample ({255 255 255 255}, nothing drawn), so it covers the fix.
  • Frame capture: a scratch app rewrote a 960x540 buffer on every RequestAnimationFrame, shown in an image view and a canvas (DrawImageIn). An 8 s screenrecord gave 466 frames (about 58 fps). In both views every frame had a new, fully saturated color, with no background, white or repeated frame.
  • Fix while rebasing onto 701ab9e (deferred shader pixel batches), which conflicted in surface.mount: the follow-up shader batches now go through sendBatch, which returns send's error. The pixel frames and canvas keys go only with the commit's first batch. TestMountFlushesDeferredShaderPixels passes on the Pixel alongside this PR's tests.
  • Head e9223b2 was all green. The final rebase onto main resolved only CHANGELOG and a roadmap row (main added issue links), and rebuilt classes.dex/jar on Studio over main's Java, which auto-merged. Per the Android runtime chain rule, this head merges once android, test and Build and vet pass, without waiting for apple / Gallery (macos). The rebuilt runtime passes the Pixel tests again (15 passed).

Pixel 3 XL, image view and canvas drawing the same buffer

@houko
houko enabled auto-merge (rebase) November 21, 2026 12:00
@houko
houko merged commit 0b0b94e into main Nov 21, 2026
18 of 20 checks passed
@houko
houko deleted the feat/android-pixel-buffers-1100 branch November 21, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android bug Something isn't working documentation Improvements or additions to documentation size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: show pixel-buffer versions in place and draw them in canvases

1 participant