Skip to content

Zero-copying on Android #318

@madsmtm

Description

@madsmtm

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/Add Pixel struct and PixelFormat enum #289.
  • Buffers have stride. Should be fixed by Add Buffer::byte_stride and use it on Android #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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions