android: generic_camera_buffer: Correct buffer mapping

buffer_handle_t doesn't provide sufficient info to map a buffer
properly. cros::CameraBufferManager enables handling the buffer on
ChromeOS, but no way is provided for other platforms.

Therefore, we put the assumption that planes are in the same buffer
and they are consecutive. This modifies the way of mapping in
generic_camera_buffer with the assumption.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Hirokazu Honda 2021-08-26 17:00:19 +09:00 committed by Laurent Pinchart
parent be05f8d1da
commit 7bfe7d7056
4 changed files with 100 additions and 28 deletions

View file

@ -110,7 +110,9 @@ int CameraStream::process(const libcamera::FrameBuffer &source,
* \todo Buffer mapping and processing should be moved to a
* separate thread.
*/
CameraBuffer dest(camera3Dest, PROT_READ | PROT_WRITE);
const StreamConfiguration &output = configuration();
CameraBuffer dest(camera3Dest, formats::MJPEG, output.size,
PROT_READ | PROT_WRITE);
if (!dest.isValid()) {
LOG(HAL, Error) << "Failed to map android blob buffer";
return -EINVAL;