Android & Libcamera issue

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Jun 13 00:09:58 CEST 2024


Hi Jan,

Quoting jan at radicalsystems.co.za (2024-06-12 16:55:49)
> Hi Libcamera Guru
> 
>  
> 
> Please help with Android interfacing to libcamera
> 
>  
> 
> W.r.t. src/android/mm/generic_camera_buffer.cpp
> 
> And function
> 
> CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer,
> 
>                                                        buffer_handle_t
> camera3Buffer,
> 
>                                                        PixelFormat
> pixelFormat,
> 
>                                                        const Size &size, int
> flags)
> 
>  
> 
> I get an error: "Discontiguous planes are not supported"
> 
>  
> 
> The working code looks like this, which seems to short cut things or hack it
> to work:
> 
> https://github.com/raspberry-vanilla/android_external_libcamera/blob/android
> -14.0/src/android/mm/generic_camera_buffer.cpp
> 
>  
> 
> /*
> 
> * As Android doesn't offer an API to query buffer layouts, assume for
> 
> * now that the buffer is backed by a single dmabuf, with planes being
> 
> * stored contiguously.
> 
> */
> 
> for (int i = 0; i < camera3Buffer->numFds; i++) {
> 
>                 if (camera3Buffer->data[i] == -1 || camera3Buffer->data[i]
> == fd_)
> 
>                                 continue;
> 
>  
> 
>                 fd_ = camera3Buffer->data[0];
> 
> }
> 
>  
> 
>  
> 
> And I updated it to be more recent:
> 
> https://github.com/libcamera-org/libcamera/blob/master/src/android/mm/generi
> c_camera_buffer.cpp
> 
> /*
> 
> * As Android doesn't offer an API to query buffer layouts, assume for
> 
> * now that the buffer is backed by a single dmabuf, with planes being
> 
> * stored contiguously.
> 
> */
> 
> for (int i = 0; i < camera3Buffer->numFds; i++) {
> 
>                 if (camera3Buffer->data[i] == -1 || camera3Buffer->data[i]
> == fd_)
> 
>                                 continue;
> 
>  
> 
>                 if (fd_ != -1) {
> 
>                                 error_ = -EINVAL;
> 
>                                 LOG(HAL, Error) << "Discontiguous planes are
> not supported";
> 
>                                 return;
> 
>                 }
> 
>  
> 
>                 fd_ = camera3Buffer->data[i];
> 
> }
> 
>  
> 
> I'm trying to resolve my issue to taking a picture while streaming.
> 
> Can someone please shed some light on what the issue can be?

Given the error message, and code above - it sounds ilke there are
planes (from an image format) that are in separate buffers, and that's
not (yet?) supported. So the code needs to be developed to fix that, or
the configuration needs to ensure that format isn't selected.

Can you identify what pixel format is being used in the configuration?
Can you debug what the buffer layout is? Are these buffers coming from
libcamera? or android?

--
Kieran


> 
>  
> 
> Will really appreciate it.
> 
>  
> 
> Regards,
> 
> Jan Zwiegers
> 
>  
> 
>  
> 
>  
> 
>  
>


More information about the libcamera-devel mailing list