I'm writing an Android application in C++, and want to get a GraphicBuffer from a block of memory that contains a YUV420sp image. Specifically, I have an IMemory from the camera's dataCallbackTimestamp callback function that gives me a block of memory with a video frame's image, and I want to add it to a BufferQueue without doing a memcpy. I'm using HAL, and do not have HAL3 or Camera2 available on my client's HW (which would make this trivial).
In particular, how do I create a zero-copy ANativeWindowBuffer or a GraphicBuffer out of a void* ? I need to be able to map 30 such GraphicBuffers per second for 4K video. I've scoured the internet and examples, but cannot figure out how to do this without a memcpy (which kills my framerate).
I can handle pixel formats, etc., but just need help creating the actual GraphicBuffer from memory.