rust-windowing / rust-windowing/softbuffer

Zero-copying on Android

Open
#318 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DS - Android NDK enhancement
Dominant language
Rust
Stars
506
Forks
85
PR merge metrics
No merged PRs in 30d

Description

There's a few things that make zero-copying difficult on Android:

  • Buffers are in RGBX format instead of BGRX. Should be fixed by github.com/rust-windowing/softbuffer/pull/289.
  • Buffers have stride. Should be fixed by https://github.com/rust-windowing/softbuffer/pull/315.
  • Buffers are exposed as &mut [MaybeUninit<u8>], see NativeWindowBufferLockGuard::bytes. Is this really necessary, or could we rely on the buffer being zero-initialized? If not, we'll have to do a zeroing step ourselves in buffer_mut.
  • The surface is both unlocked and presented in NativeWindowBufferLockGuard::drop, whereas Softbuffer allows these two steps to be separate (e.g. you can Drop an in-progress Buffer<'_> and request a new one in Surface::buffer_mut, with no side-effects).

Maybe the SurfaceControl stuff @MarijnS95 is working on will allow fixing the last point?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with NativeWindowBufferLockGuard::bytes and drop, then trace Softbuffer's Surface::buffer_mut behavior for comparison. Determine whether Android buffers can avoid an explicit zeroing step and how unlock and present should be separated; done means both remaining unchecked Android zero-copy concerns are resolved consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, rust
Domain
mobile, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.