[libcamera-devel] android: nautilus: Add camera HAL configuration
diff mbox series

Message ID 20210526071542.586096-1-umang.jain@ideasonboard.com
State Superseded
Delegated to: Umang Jain
Headers show
Series
  • [libcamera-devel] android: nautilus: Add camera HAL configuration
Related show

Commit Message

Umang Jain May 26, 2021, 7:15 a.m. UTC
nautilus has two internal cameras, one UVC and one for the IPU3.
However, libcamera assumes all UVC cameras as 'external' hence, mark
the location of UVC camera in HAL configuration as 'external' too.

Note that the presence of UVC camera in camera HAL will complain:

> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
  Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
  \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647

This is related to a known issue of UVC cameras on HAL which do not
provide NV12 by default.

Also, if we don't mention the UVC camera in the config:

> ERROR HALConfig camera_hal_config.cpp:393 Camera
  '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
  configuration file
> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
  Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
  \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 src/android/data/nautilus/camera_hal.yaml

Comments

Jacopo Mondi May 26, 2021, 8:05 a.m. UTC | #1
Hi Umang,

On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
> nautilus has two internal cameras, one UVC and one for the IPU3.
> However, libcamera assumes all UVC cameras as 'external' hence, mark
> the location of UVC camera in HAL configuration as 'external' too.
>
> Note that the presence of UVC camera in camera HAL will complain:
>
> > ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
>   Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> > ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
>   \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
>
> This is related to a known issue of UVC cameras on HAL which do not
> provide NV12 by default.

Does it work without configuration file support ?

Thanks
   j

>
> Also, if we don't mention the UVC camera in the config:
>
> > ERROR HALConfig camera_hal_config.cpp:393 Camera
>   '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
>   configuration file
> > ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
>   Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> > ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
>   \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
>
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
>  1 file changed, 8 insertions(+)
>  create mode 100644 src/android/data/nautilus/camera_hal.yaml
>
> diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
> new file mode 100644
> index 00000000..f2d31e1c
> --- /dev/null
> +++ b/src/android/data/nautilus/camera_hal.yaml
> @@ -0,0 +1,8 @@
> +cameras:
> +  "\\_SB_.PCI0.I2C2.CAM0":
> +    location: back
> +    rotation: 0
> +
> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> +    location: external
> +    rotation: 0
> --
> 2.26.2
>
Umang Jain May 26, 2021, 9:21 a.m. UTC | #2
Hi Jacopo

On 5/26/21 1:35 PM, Jacopo Mondi wrote:
> Hi Umang,
>
> On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
>> nautilus has two internal cameras, one UVC and one for the IPU3.
>> However, libcamera assumes all UVC cameras as 'external' hence, mark
>> the location of UVC camera in HAL configuration as 'external' too.
>>
>> Note that the presence of UVC camera in camera HAL will complain:
>>
>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
>>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
>>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
>>
>> This is related to a known issue of UVC cameras on HAL which do not
>> provide NV12 by default.
> Does it work without configuration file support ?
No, it won't, since it's UVC. And cannot work until there's a 
format-convertor in place that can convert the stream to NV12 provided 
by that camera, I suppose.
>
> Thanks
>     j
>
>> Also, if we don't mention the UVC camera in the config:
>>
>>> ERROR HALConfig camera_hal_config.cpp:393 Camera
>>    '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
>>    configuration file
>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
>>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
>>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
>>
>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
>> ---
>>   src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>   create mode 100644 src/android/data/nautilus/camera_hal.yaml
>>
>> diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
>> new file mode 100644
>> index 00000000..f2d31e1c
>> --- /dev/null
>> +++ b/src/android/data/nautilus/camera_hal.yaml
>> @@ -0,0 +1,8 @@
>> +cameras:
>> +  "\\_SB_.PCI0.I2C2.CAM0":
>> +    location: back
>> +    rotation: 0
>> +
>> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
>> +    location: external
>> +    rotation: 0
>> --
>> 2.26.2
>>
Hirokazu Honda May 26, 2021, 9:36 a.m. UTC | #3
Hi Umang,

On Wed, May 26, 2021 at 6:21 PM Umang Jain <umang.jain@ideasonboard.com>
wrote:

> Hi Jacopo
>
> On 5/26/21 1:35 PM, Jacopo Mondi wrote:
> > Hi Umang,
> >
> > On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
> >> nautilus has two internal cameras, one UVC and one for the IPU3.
> >> However, libcamera assumes all UVC cameras as 'external' hence, mark
> >> the location of UVC camera in HAL configuration as 'external' too.
> >>
> >> Note that the presence of UVC camera in camera HAL will complain:
> >>
> >>> ERROR HAL camera_device.cpp:701
> '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> >>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED
> (0x00000022): aborting
> >>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> >>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> >>
> >> This is related to a known issue of UVC cameras on HAL which do not
> >> provide NV12 by default.
> > Does it work without configuration file support ?
> No, it won't, since it's UVC. And cannot work until there's a
> format-convertor in place that can convert the stream to NV12 provided
> by that camera, I suppose.
>

It is time that we need a JPEG decoder in a post processing pipeline like a
JPEG encoder.
-Hiro

>
> > Thanks
> >     j
> >
> >> Also, if we don't mention the UVC camera in the config:
> >>
> >>> ERROR HALConfig camera_hal_config.cpp:393 Camera
> >>    '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
> >>    configuration file
> >>> ERROR HAL camera_device.cpp:701
> '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> >>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED
> (0x00000022): aborting
> >>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> >>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> >>
> >> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> >> ---
> >>   src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
> >>   1 file changed, 8 insertions(+)
> >>   create mode 100644 src/android/data/nautilus/camera_hal.yaml
> >>
> >> diff --git a/src/android/data/nautilus/camera_hal.yaml
> b/src/android/data/nautilus/camera_hal.yaml
> >> new file mode 100644
> >> index 00000000..f2d31e1c
> >> --- /dev/null
> >> +++ b/src/android/data/nautilus/camera_hal.yaml
> >> @@ -0,0 +1,8 @@
> >> +cameras:
> >> +  "\\_SB_.PCI0.I2C2.CAM0":
> >> +    location: back
> >> +    rotation: 0
> >> +
> >> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> >> +    location: external
> >> +    rotation: 0
> >> --
> >> 2.26.2
> >>
>
>
Jacopo Mondi May 26, 2021, 9:57 a.m. UTC | #4
Hi Umang,

On Wed, May 26, 2021 at 02:51:19PM +0530, Umang Jain wrote:
> Hi Jacopo
>
> On 5/26/21 1:35 PM, Jacopo Mondi wrote:
> > Hi Umang,
> >
> > On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
> > > nautilus has two internal cameras, one UVC and one for the IPU3.
> > > However, libcamera assumes all UVC cameras as 'external' hence, mark
> > > the location of UVC camera in HAL configuration as 'external' too.
> > >
> > > Note that the presence of UVC camera in camera HAL will complain:
> > >
> > > > ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > >    Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> > > > ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > >    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > >
> > > This is related to a known issue of UVC cameras on HAL which do not
> > > provide NV12 by default.
> > Does it work without configuration file support ?
> No, it won't, since it's UVC. And cannot work until there's a
> format-convertor in place that can convert the stream to NV12 provided by
> that camera, I suppose.

Right, it was not working before the configuration file series went
in, right ? What I'm interested about is that there's no regression
due to the series :)


> > > Also, if we don't mention the UVC camera in the config:
> > >
> > > > ERROR HALConfig camera_hal_config.cpp:393 Camera
> > >    '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
> > >    configuration file

This is "fine".. If you look at the caller of
CameraHalConfig::cameraConfigData() in camera_hal_manager.cpp

	const CameraConfigData *cameraConfigData = halConfig_.cameraConfigData(cam->id());
	if (!isCameraExternal && !cameraConfigData) {
		LOG(HAL, Error)
			<< "HAL configuration entry for internal camera "
			<< cam->id() << " is missing";
		return;
	}

You'll see that the configuration entry for external cameras is not
mandatory, and the UVC camera should be correctly identified as
EXTERNAL.

We spam the log enough with worrying errors which are not really
errors, so we might want to suppress this one for external cameras ?

Thanks
   j


> > > > ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > >    Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> > > > ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > >    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > >
> > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> > > ---
> > >   src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
> > >   1 file changed, 8 insertions(+)
> > >   create mode 100644 src/android/data/nautilus/camera_hal.yaml
> > >
> > > diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
> > > new file mode 100644
> > > index 00000000..f2d31e1c
> > > --- /dev/null
> > > +++ b/src/android/data/nautilus/camera_hal.yaml
> > > @@ -0,0 +1,8 @@
> > > +cameras:
> > > +  "\\_SB_.PCI0.I2C2.CAM0":
> > > +    location: back
> > > +    rotation: 0
> > > +
> > > +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> > > +    location: external
> > > +    rotation: 0
> > > --
> > > 2.26.2
> > >
>
Umang Jain May 26, 2021, 10:12 a.m. UTC | #5
Hi Jacopo

On 5/26/21 3:27 PM, Jacopo Mondi wrote:
> Hi Umang,
>
> On Wed, May 26, 2021 at 02:51:19PM +0530, Umang Jain wrote:
>> Hi Jacopo
>>
>> On 5/26/21 1:35 PM, Jacopo Mondi wrote:
>>> Hi Umang,
>>>
>>> On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
>>>> nautilus has two internal cameras, one UVC and one for the IPU3.
>>>> However, libcamera assumes all UVC cameras as 'external' hence, mark
>>>> the location of UVC camera in HAL configuration as 'external' too.
>>>>
>>>> Note that the presence of UVC camera in camera HAL will complain:
>>>>
>>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
>>>>     Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
>>>>     \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
>>>>
>>>> This is related to a known issue of UVC cameras on HAL which do not
>>>> provide NV12 by default.
>>> Does it work without configuration file support ?
>> No, it won't, since it's UVC. And cannot work until there's a
>> format-convertor in place that can convert the stream to NV12 provided by
>> that camera, I suppose.
> Right, it was not working before the configuration file series went
> in, right ? What I'm interested about is that there's no regression
> due to the series :)
Oh yea, no regression. I just went and wrote a verbose commit message 
about what's "fine"

>
>
>>>> Also, if we don't mention the UVC camera in the config:
>>>>
>>>>> ERROR HALConfig camera_hal_config.cpp:393 Camera
>>>>     '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
>>>>     configuration file
> This is "fine".. If you look at the caller of
> CameraHalConfig::cameraConfigData() in camera_hal_manager.cpp
>
> 	const CameraConfigData *cameraConfigData = halConfig_.cameraConfigData(cam->id());
> 	if (!isCameraExternal && !cameraConfigData) {
> 		LOG(HAL, Error)
> 			<< "HAL configuration entry for internal camera "
> 			<< cam->id() << " is missing";
> 		return;
> 	}
>
> You'll see that the configuration entry for external cameras is not
> mandatory, and the UVC camera should be correctly identified as
> EXTERNAL.
>
> We spam the log enough with worrying errors which are not really
> errors, so we might want to suppress this one for external cameras ?
Won't supress it entirely, but maybe not keep it as ERROR. WARN or DEBUG 
maybe?

Thanks!
>
> Thanks
>     j
>
>
>>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
>>>>     Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
>>>>     \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
>>>>
>>>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
>>>> ---
>>>>    src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
>>>>    1 file changed, 8 insertions(+)
>>>>    create mode 100644 src/android/data/nautilus/camera_hal.yaml
>>>>
>>>> diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
>>>> new file mode 100644
>>>> index 00000000..f2d31e1c
>>>> --- /dev/null
>>>> +++ b/src/android/data/nautilus/camera_hal.yaml
>>>> @@ -0,0 +1,8 @@
>>>> +cameras:
>>>> +  "\\_SB_.PCI0.I2C2.CAM0":
>>>> +    location: back
>>>> +    rotation: 0
>>>> +
>>>> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
>>>> +    location: external
>>>> +    rotation: 0
>>>> --
>>>> 2.26.2
>>>>
Jacopo Mondi May 26, 2021, 10:16 a.m. UTC | #6
Hi Umang,

On Wed, May 26, 2021 at 03:42:53PM +0530, Umang Jain wrote:
> > > > > Also, if we don't mention the UVC camera in the config:
> > > > >
> > > > > > ERROR HALConfig camera_hal_config.cpp:393 Camera
> > > > >     '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
> > > > >     configuration file
> > This is "fine".. If you look at the caller of
> > CameraHalConfig::cameraConfigData() in camera_hal_manager.cpp
> >
> > 	const CameraConfigData *cameraConfigData = halConfig_.cameraConfigData(cam->id());
> > 	if (!isCameraExternal && !cameraConfigData) {
> > 		LOG(HAL, Error)
> > 			<< "HAL configuration entry for internal camera "
> > 			<< cam->id() << " is missing";
> > 		return;
> > 	}
> >
> > You'll see that the configuration entry for external cameras is not
> > mandatory, and the UVC camera should be correctly identified as
> > EXTERNAL.
> >
> > We spam the log enough with worrying errors which are not really
> > errors, so we might want to suppress this one for external cameras ?
> Won't supress it entirely, but maybe not keep it as ERROR. WARN or DEBUG
> maybe?

Well, for internal cameras it's actually an error, even if the caller
already print one out.

I'm fine demoting it to WARN

>
> Thanks!
> >
> > Thanks
> >     j
> >
> >
> > > > > > ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > > > >     Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> > > > > > ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > > > >     \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > > > >
> > > > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> > > > > ---
> > > > >    src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
> > > > >    1 file changed, 8 insertions(+)
> > > > >    create mode 100644 src/android/data/nautilus/camera_hal.yaml
> > > > >
> > > > > diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
> > > > > new file mode 100644
> > > > > index 00000000..f2d31e1c
> > > > > --- /dev/null
> > > > > +++ b/src/android/data/nautilus/camera_hal.yaml
> > > > > @@ -0,0 +1,8 @@
> > > > > +cameras:
> > > > > +  "\\_SB_.PCI0.I2C2.CAM0":
> > > > > +    location: back
> > > > > +    rotation: 0
> > > > > +
> > > > > +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> > > > > +    location: external
> > > > > +    rotation: 0
> > > > > --
> > > > > 2.26.2
> > > > >
>
Laurent Pinchart May 26, 2021, 2:57 p.m. UTC | #7
Hi Hiro,

On Wed, May 26, 2021 at 06:36:34PM +0900, Hirokazu Honda wrote:
> On Wed, May 26, 2021 at 6:21 PM Umang Jain wrote:
> > On 5/26/21 1:35 PM, Jacopo Mondi wrote:
> > > On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
> > >> nautilus has two internal cameras, one UVC and one for the IPU3.
> > >> However, libcamera assumes all UVC cameras as 'external' hence, mark
> > >> the location of UVC camera in HAL configuration as 'external' too.
> > >>
> > >> Note that the presence of UVC camera in camera HAL will complain:
> > >>
> > >>> ERROR HAL camera_device.cpp:701
> > '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > >>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED
> > (0x00000022): aborting
> > >>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > >>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > >>
> > >> This is related to a known issue of UVC cameras on HAL which do not
> > >> provide NV12 by default.
> > > Does it work without configuration file support ?
> > No, it won't, since it's UVC. And cannot work until there's a
> > format-convertor in place that can convert the stream to NV12 provided
> > by that camera, I suppose.
> 
> It is time that we need a JPEG decoder in a post processing pipeline like a
> JPEG encoder.

Or a YUYV to NV12 converter, as the camera can also produce YUYV ?

> > >> Also, if we don't mention the UVC camera in the config:
> > >>
> > >>> ERROR HALConfig camera_hal_config.cpp:393 Camera
> > >>    '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
> > >>    configuration file
> > >>> ERROR HAL camera_device.cpp:701
> > '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > >>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED
> > (0x00000022): aborting
> > >>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > >>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > >>
> > >> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> > >> ---
> > >>   src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
> > >>   1 file changed, 8 insertions(+)
> > >>   create mode 100644 src/android/data/nautilus/camera_hal.yaml
> > >>
> > >> diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
> > >> new file mode 100644
> > >> index 00000000..f2d31e1c
> > >> --- /dev/null
> > >> +++ b/src/android/data/nautilus/camera_hal.yaml
> > >> @@ -0,0 +1,8 @@
> > >> +cameras:
> > >> +  "\\_SB_.PCI0.I2C2.CAM0":
> > >> +    location: back
> > >> +    rotation: 0
> > >> +
> > >> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> > >> +    location: external
> > >> +    rotation: 0
Laurent Pinchart May 26, 2021, 2:59 p.m. UTC | #8
Hi Umang,

On Wed, May 26, 2021 at 03:42:53PM +0530, Umang Jain wrote:
> On 5/26/21 3:27 PM, Jacopo Mondi wrote:
> > On Wed, May 26, 2021 at 02:51:19PM +0530, Umang Jain wrote:
> >> On 5/26/21 1:35 PM, Jacopo Mondi wrote:
> >>> On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
> >>>> nautilus has two internal cameras, one UVC and one for the IPU3.
> >>>> However, libcamera assumes all UVC cameras as 'external' hence, mark
> >>>> the location of UVC camera in HAL configuration as 'external' too.
> >>>>
> >>>> Note that the presence of UVC camera in camera HAL will complain:
> >>>>
> >>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> >>>>     Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> >>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> >>>>     \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> >>>>
> >>>> This is related to a known issue of UVC cameras on HAL which do not
> >>>> provide NV12 by default.
> >>>
> >>> Does it work without configuration file support ?
> >>
> >> No, it won't, since it's UVC. And cannot work until there's a
> >> format-convertor in place that can convert the stream to NV12 provided by
> >> that camera, I suppose.
> >
> > Right, it was not working before the configuration file series went
> > in, right ? What I'm interested about is that there's no regression
> > due to the series :)
>
> Oh yea, no regression. I just went and wrote a verbose commit message 
> about what's "fine"
> 
> >>>> Also, if we don't mention the UVC camera in the config:
> >>>>
> >>>>> ERROR HALConfig camera_hal_config.cpp:393 Camera
> >>>>     '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
> >>>>     configuration file
> >
> > This is "fine".. If you look at the caller of
> > CameraHalConfig::cameraConfigData() in camera_hal_manager.cpp
> >
> > 	const CameraConfigData *cameraConfigData = halConfig_.cameraConfigData(cam->id());
> > 	if (!isCameraExternal && !cameraConfigData) {
> > 		LOG(HAL, Error)
> > 			<< "HAL configuration entry for internal camera "
> > 			<< cam->id() << " is missing";
> > 		return;
> > 	}
> >
> > You'll see that the configuration entry for external cameras is not
> > mandatory, and the UVC camera should be correctly identified as
> > EXTERNAL.
> >
> > We spam the log enough with worrying errors which are not really
> > errors, so we might want to suppress this one for external cameras ?
>
> Won't supress it entirely, but maybe not keep it as ERROR. WARN or DEBUG 
> maybe?

Given that the UVC camera is internal, what happens if you set its
location to front in the configuration file ?

> >>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> >>>>     Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> >>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> >>>>     \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> >>>>
> >>>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> >>>> ---
> >>>>    src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
> >>>>    1 file changed, 8 insertions(+)
> >>>>    create mode 100644 src/android/data/nautilus/camera_hal.yaml
> >>>>
> >>>> diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
> >>>> new file mode 100644
> >>>> index 00000000..f2d31e1c
> >>>> --- /dev/null
> >>>> +++ b/src/android/data/nautilus/camera_hal.yaml
> >>>> @@ -0,0 +1,8 @@
> >>>> +cameras:
> >>>> +  "\\_SB_.PCI0.I2C2.CAM0":
> >>>> +    location: back
> >>>> +    rotation: 0
> >>>> +
> >>>> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> >>>> +    location: external
> >>>> +    rotation: 0
Hirokazu Honda May 26, 2021, 3:20 p.m. UTC | #9
HI Laurent,

On Wed, May 26, 2021 at 11:57 PM Laurent Pinchart <
laurent.pinchart@ideasonboard.com> wrote:

> Hi Hiro,
>
> On Wed, May 26, 2021 at 06:36:34PM +0900, Hirokazu Honda wrote:
> > On Wed, May 26, 2021 at 6:21 PM Umang Jain wrote:
> > > On 5/26/21 1:35 PM, Jacopo Mondi wrote:
> > > > On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
> > > >> nautilus has two internal cameras, one UVC and one for the IPU3.
> > > >> However, libcamera assumes all UVC cameras as 'external' hence, mark
> > > >> the location of UVC camera in HAL configuration as 'external' too.
> > > >>
> > > >> Note that the presence of UVC camera in camera HAL will complain:
> > > >>
> > > >>> ERROR HAL camera_device.cpp:701
> > > '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > > >>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED
> > > (0x00000022): aborting
> > > >>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > > >>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > > >>
> > > >> This is related to a known issue of UVC cameras on HAL which do not
> > > >> provide NV12 by default.
> > > > Does it work without configuration file support ?
> > > No, it won't, since it's UVC. And cannot work until there's a
> > > format-convertor in place that can convert the stream to NV12 provided
> > > by that camera, I suppose.
> >
> > It is time that we need a JPEG decoder in a post processing pipeline
> like a
> > JPEG encoder.
>
> Or a YUYV to NV12 converter, as the camera can also produce YUYV ?
>
>
I guess the camera is capable to produce YUYV only for lower resolutions
and produce JPEG for higher resolutions?

-Hiro

> > >> Also, if we don't mention the UVC camera in the config:
> > > >>
> > > >>> ERROR HALConfig camera_hal_config.cpp:393 Camera
> > > >>    '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the
> HAL
> > > >>    configuration file
> > > >>> ERROR HAL camera_device.cpp:701
> > > '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > > >>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED
> > > (0x00000022): aborting
> > > >>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > > >>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > > >>
> > > >> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> > > >> ---
> > > >>   src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
> > > >>   1 file changed, 8 insertions(+)
> > > >>   create mode 100644 src/android/data/nautilus/camera_hal.yaml
> > > >>
> > > >> diff --git a/src/android/data/nautilus/camera_hal.yaml
> b/src/android/data/nautilus/camera_hal.yaml
> > > >> new file mode 100644
> > > >> index 00000000..f2d31e1c
> > > >> --- /dev/null
> > > >> +++ b/src/android/data/nautilus/camera_hal.yaml
> > > >> @@ -0,0 +1,8 @@
> > > >> +cameras:
> > > >> +  "\\_SB_.PCI0.I2C2.CAM0":
> > > >> +    location: back
> > > >> +    rotation: 0
> > > >> +
> > > >> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> > > >> +    location: external
> > > >> +    rotation: 0
>
> --
> Regards,
>
> Laurent Pinchart
>
Laurent Pinchart May 26, 2021, 4:13 p.m. UTC | #10
Hi Hiro,

On Thu, May 27, 2021 at 12:20:13AM +0900, Hirokazu Honda wrote:
> On Wed, May 26, 2021 at 11:57 PM Laurent Pinchart wrote:
> > On Wed, May 26, 2021 at 06:36:34PM +0900, Hirokazu Honda wrote:
> >> On Wed, May 26, 2021 at 6:21 PM Umang Jain wrote:
> >>> On 5/26/21 1:35 PM, Jacopo Mondi wrote:
> >>>> On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
> >>>>> nautilus has two internal cameras, one UVC and one for the IPU3.
> >>>>> However, libcamera assumes all UVC cameras as 'external' hence, mark
> >>>>> the location of UVC camera in HAL configuration as 'external' too.
> >>>>>
> >>>>> Note that the presence of UVC camera in camera HAL will complain:
> >>>>>
> >>>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> >>>>>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> >>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> >>>>>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> >>>>>
> >>>>> This is related to a known issue of UVC cameras on HAL which do not
> >>>>> provide NV12 by default.
> >>>> Does it work without configuration file support ?
> >>>
> >>> No, it won't, since it's UVC. And cannot work until there's a
> >>> format-convertor in place that can convert the stream to NV12 provided
> >>> by that camera, I suppose.
> >>
> >> It is time that we need a JPEG decoder in a post processing pipeline like a
> >> JPEG encoder.
> >
> > Or a YUYV to NV12 converter, as the camera can also produce YUYV ?
>
> I guess the camera is capable to produce YUYV only for lower resolutions
> and produce JPEG for higher resolutions?

It's up to the camera, but generally speaking, yes, the highest
resolutions and frame rates are only available in MJPEG. Wouldn't a
software decoder likely be too slow in those cases though ?

> >>>> Also, if we don't mention the UVC camera in the config:
> >>>>>
> >>>>>> ERROR HALConfig camera_hal_config.cpp:393 Camera
> >>>>>    '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
> >>>>>    configuration file
> >>>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> >>>>>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> >>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> >>>>>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> >>>>>
> >>>>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> >>>>> ---
> >>>>>   src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
> >>>>>   1 file changed, 8 insertions(+)
> >>>>>   create mode 100644 src/android/data/nautilus/camera_hal.yaml
> >>>>>
> >>>>> diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
> >>>>> new file mode 100644
> >>>>> index 00000000..f2d31e1c
> >>>>> --- /dev/null
> >>>>> +++ b/src/android/data/nautilus/camera_hal.yaml
> >>>>> @@ -0,0 +1,8 @@
> >>>>> +cameras:
> >>>>> +  "\\_SB_.PCI0.I2C2.CAM0":
> >>>>> +    location: back
> >>>>> +    rotation: 0
> >>>>> +
> >>>>> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> >>>>> +    location: external
> >>>>> +    rotation: 0
Hirokazu Honda May 26, 2021, 4:18 p.m. UTC | #11
Hi Laurent,

On Thu, May 27, 2021 at 1:14 AM Laurent Pinchart <
laurent.pinchart@ideasonboard.com> wrote:

> Hi Hiro,
>
> On Thu, May 27, 2021 at 12:20:13AM +0900, Hirokazu Honda wrote:
> > On Wed, May 26, 2021 at 11:57 PM Laurent Pinchart wrote:
> > > On Wed, May 26, 2021 at 06:36:34PM +0900, Hirokazu Honda wrote:
> > >> On Wed, May 26, 2021 at 6:21 PM Umang Jain wrote:
> > >>> On 5/26/21 1:35 PM, Jacopo Mondi wrote:
> > >>>> On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
> > >>>>> nautilus has two internal cameras, one UVC and one for the IPU3.
> > >>>>> However, libcamera assumes all UVC cameras as 'external' hence,
> mark
> > >>>>> the location of UVC camera in HAL configuration as 'external' too.
> > >>>>>
> > >>>>> Note that the presence of UVC camera in camera HAL will complain:
> > >>>>>
> > >>>>>> ERROR HAL camera_device.cpp:701
> '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > >>>>>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED
> (0x00000022): aborting
> > >>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > >>>>>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > >>>>>
> > >>>>> This is related to a known issue of UVC cameras on HAL which do not
> > >>>>> provide NV12 by default.
> > >>>> Does it work without configuration file support ?
> > >>>
> > >>> No, it won't, since it's UVC. And cannot work until there's a
> > >>> format-convertor in place that can convert the stream to NV12
> provided
> > >>> by that camera, I suppose.
> > >>
> > >> It is time that we need a JPEG decoder in a post processing pipeline
> like a
> > >> JPEG encoder.
> > >
> > > Or a YUYV to NV12 converter, as the camera can also produce YUYV ?
> >
> > I guess the camera is capable to produce YUYV only for lower resolutions
> > and produce JPEG for higher resolutions?
>
> It's up to the camera, but generally speaking, yes, the highest
> resolutions and frame rates are only available in MJPEG. Wouldn't a
> software decoder likely be too slow in those cases though ?
>
>
Right, on ChromeOS, if an app asks YUV and a camera is capable of producing
MJPEG for the resolution, cros camera services requests HAL MJPEG and
decodes it to YUV by jpeg decoder (with hw acceleration if there is,
without if there isn't).
So we don't need a JPEG decoder for ChromeOS. I don't know if it's nice to
have a jpeg decoder in libcamera for other platforms.
-Hiro

> > >>>> Also, if we don't mention the UVC camera in the config:
> > >>>>>
> > >>>>>> ERROR HALConfig camera_hal_config.cpp:393 Camera
> > >>>>>    '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in
> the HAL
> > >>>>>    configuration file
> > >>>>>> ERROR HAL camera_device.cpp:701
> '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > >>>>>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED
> (0x00000022): aborting
> > >>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > >>>>>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > >>>>>
> > >>>>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> > >>>>> ---
> > >>>>>   src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
> > >>>>>   1 file changed, 8 insertions(+)
> > >>>>>   create mode 100644 src/android/data/nautilus/camera_hal.yaml
> > >>>>>
> > >>>>> diff --git a/src/android/data/nautilus/camera_hal.yaml
> b/src/android/data/nautilus/camera_hal.yaml
> > >>>>> new file mode 100644
> > >>>>> index 00000000..f2d31e1c
> > >>>>> --- /dev/null
> > >>>>> +++ b/src/android/data/nautilus/camera_hal.yaml
> > >>>>> @@ -0,0 +1,8 @@
> > >>>>> +cameras:
> > >>>>> +  "\\_SB_.PCI0.I2C2.CAM0":
> > >>>>> +    location: back
> > >>>>> +    rotation: 0
> > >>>>> +
> > >>>>> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> > >>>>> +    location: external
> > >>>>> +    rotation: 0
>
> --
> Regards,
>
> Laurent Pinchart
>
Umang Jain May 26, 2021, 5:28 p.m. UTC | #12
Hi Laurent,

On 5/26/21 8:29 PM, Laurent Pinchart wrote:
> Hi Umang,
>
> On Wed, May 26, 2021 at 03:42:53PM +0530, Umang Jain wrote:
>> On 5/26/21 3:27 PM, Jacopo Mondi wrote:
>>> On Wed, May 26, 2021 at 02:51:19PM +0530, Umang Jain wrote:
>>>> On 5/26/21 1:35 PM, Jacopo Mondi wrote:
>>>>> On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
>>>>>> nautilus has two internal cameras, one UVC and one for the IPU3.
>>>>>> However, libcamera assumes all UVC cameras as 'external' hence, mark
>>>>>> the location of UVC camera in HAL configuration as 'external' too.
>>>>>>
>>>>>> Note that the presence of UVC camera in camera HAL will complain:
>>>>>>
>>>>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
>>>>>>      Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
>>>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
>>>>>>      \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
>>>>>>
>>>>>> This is related to a known issue of UVC cameras on HAL which do not
>>>>>> provide NV12 by default.
>>>>> Does it work without configuration file support ?
>>>> No, it won't, since it's UVC. And cannot work until there's a
>>>> format-convertor in place that can convert the stream to NV12 provided by
>>>> that camera, I suppose.
>>> Right, it was not working before the configuration file series went
>>> in, right ? What I'm interested about is that there's no regression
>>> due to the series :)
>> Oh yea, no regression. I just went and wrote a verbose commit message
>> about what's "fine"
>>
>>>>>> Also, if we don't mention the UVC camera in the config:
>>>>>>
>>>>>>> ERROR HALConfig camera_hal_config.cpp:393 Camera
>>>>>>      '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
>>>>>>      configuration file
>>> This is "fine".. If you look at the caller of
>>> CameraHalConfig::cameraConfigData() in camera_hal_manager.cpp
>>>
>>> 	const CameraConfigData *cameraConfigData = halConfig_.cameraConfigData(cam->id());
>>> 	if (!isCameraExternal && !cameraConfigData) {
>>> 		LOG(HAL, Error)
>>> 			<< "HAL configuration entry for internal camera "
>>> 			<< cam->id() << " is missing";
>>> 		return;
>>> 	}
>>>
>>> You'll see that the configuration entry for external cameras is not
>>> mandatory, and the UVC camera should be correctly identified as
>>> EXTERNAL.
>>>
>>> We spam the log enough with worrying errors which are not really
>>> errors, so we might want to suppress this one for external cameras ?
>> Won't supress it entirely, but maybe not keep it as ERROR. WARN or DEBUG
>> maybe?
> Given that the UVC camera is internal, what happens if you set its
> location to front in the configuration file ?
It complains :-)

There is a location check of what libcamera reports vs what's provided 
in camera hal.

[0:16:15.090460200] [4680]  WARN HAL camera_device.cpp:481 
'\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647': Camera location does not 
match configuration file. Using 2

Oh, I can't un-see "2" now ;-)
>
>>>>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
>>>>>>      Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
>>>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
>>>>>>      \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
>>>>>>
>>>>>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
>>>>>> ---
>>>>>>     src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
>>>>>>     1 file changed, 8 insertions(+)
>>>>>>     create mode 100644 src/android/data/nautilus/camera_hal.yaml
>>>>>>
>>>>>> diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
>>>>>> new file mode 100644
>>>>>> index 00000000..f2d31e1c
>>>>>> --- /dev/null
>>>>>> +++ b/src/android/data/nautilus/camera_hal.yaml
>>>>>> @@ -0,0 +1,8 @@
>>>>>> +cameras:
>>>>>> +  "\\_SB_.PCI0.I2C2.CAM0":
>>>>>> +    location: back
>>>>>> +    rotation: 0
>>>>>> +
>>>>>> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
>>>>>> +    location: external
>>>>>> +    rotation: 0
Laurent Pinchart May 27, 2021, 3:05 a.m. UTC | #13
Hi Hiro,

On Thu, May 27, 2021 at 01:18:44AM +0900, Hirokazu Honda wrote:
> On Thu, May 27, 2021 at 1:14 AM Laurent Pinchart wrote:
> > On Thu, May 27, 2021 at 12:20:13AM +0900, Hirokazu Honda wrote:
> > > On Wed, May 26, 2021 at 11:57 PM Laurent Pinchart wrote:
> > > > On Wed, May 26, 2021 at 06:36:34PM +0900, Hirokazu Honda wrote:
> > > >> On Wed, May 26, 2021 at 6:21 PM Umang Jain wrote:
> > > >>> On 5/26/21 1:35 PM, Jacopo Mondi wrote:
> > > >>>> On Wed, May 26, 2021 at 12:45:42PM +0530, Umang Jain wrote:
> > > >>>>> nautilus has two internal cameras, one UVC and one for the IPU3.
> > > >>>>> However, libcamera assumes all UVC cameras as 'external' hence, mark
> > > >>>>> the location of UVC camera in HAL configuration as 'external' too.
> > > >>>>>
> > > >>>>> Note that the presence of UVC camera in camera HAL will complain:
> > > >>>>>
> > > >>>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > > >>>>>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> > > >>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > > >>>>>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > > >>>>>
> > > >>>>> This is related to a known issue of UVC cameras on HAL which do not
> > > >>>>> provide NV12 by default.
> > > >>>> Does it work without configuration file support ?
> > > >>>
> > > >>> No, it won't, since it's UVC. And cannot work until there's a
> > > >>> format-convertor in place that can convert the stream to NV12 provided
> > > >>> by that camera, I suppose.
> > > >>
> > > >> It is time that we need a JPEG decoder in a post processing pipeline like a
> > > >> JPEG encoder.
> > > >
> > > > Or a YUYV to NV12 converter, as the camera can also produce YUYV ?
> > >
> > > I guess the camera is capable to produce YUYV only for lower resolutions
> > > and produce JPEG for higher resolutions?
> >
> > It's up to the camera, but generally speaking, yes, the highest
> > resolutions and frame rates are only available in MJPEG. Wouldn't a
> > software decoder likely be too slow in those cases though ?
>
> Right, on ChromeOS, if an app asks YUV and a camera is capable of producing
> MJPEG for the resolution, cros camera services requests HAL MJPEG and
> decodes it to YUV by jpeg decoder (with hw acceleration if there is,
> without if there isn't).
> So we don't need a JPEG decoder for ChromeOS. I don't know if it's nice to
> have a jpeg decoder in libcamera for other platforms.

Oh, nice :-) That certainly makes it easier for us.

We have generally considered JPEG out-of-scope for the libcamera core so
far, with the annoying exception of UVC. Maybe we'll need a JPEG decoder
for Android in the future, for UVC devices, but that will be for later.

> > > >>>> Also, if we don't mention the UVC camera in the config:
> > > >>>>>
> > > >>>>>> ERROR HALConfig camera_hal_config.cpp:393 Camera
> > > >>>>>    '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647' not described in the HAL
> > > >>>>>    configuration file
> > > >>>>>> ERROR HAL camera_device.cpp:701 '\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647':
> > > >>>>>    Failed to map mandatory Android format IMPLEMENTATION_DEFINED (0x00000022): aborting
> > > >>>>>> ERROR HAL camera_hal_manager.cpp:153 Failed to initialize camera:
> > > >>>>>    \_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647
> > > >>>>>
> > > >>>>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> > > >>>>> ---
> > > >>>>>   src/android/data/nautilus/camera_hal.yaml | 8 ++++++++
> > > >>>>>   1 file changed, 8 insertions(+)
> > > >>>>>   create mode 100644 src/android/data/nautilus/camera_hal.yaml
> > > >>>>>
> > > >>>>> diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
> > > >>>>> new file mode 100644
> > > >>>>> index 00000000..f2d31e1c
> > > >>>>> --- /dev/null
> > > >>>>> +++ b/src/android/data/nautilus/camera_hal.yaml
> > > >>>>> @@ -0,0 +1,8 @@
> > > >>>>> +cameras:
> > > >>>>> +  "\\_SB_.PCI0.I2C2.CAM0":
> > > >>>>> +    location: back
> > > >>>>> +    rotation: 0
> > > >>>>> +
> > > >>>>> +  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
> > > >>>>> +    location: external
> > > >>>>> +    rotation: 0

Patch
diff mbox series

diff --git a/src/android/data/nautilus/camera_hal.yaml b/src/android/data/nautilus/camera_hal.yaml
new file mode 100644
index 00000000..f2d31e1c
--- /dev/null
+++ b/src/android/data/nautilus/camera_hal.yaml
@@ -0,0 +1,8 @@ 
+cameras:
+  "\\_SB_.PCI0.I2C2.CAM0":
+    location: back
+    rotation: 0
+
+  "\\_SB_.PCI0.XHCI.RHUB.HS09-9:1.0-04f2:b647":
+    location: external
+    rotation: 0