Message ID | 20210728073800.93745-2-umang.jain@ideasonboard.com |
---|---|
State | Superseded |
Delegated to: | Umang Jain |
Headers | show |
Series |
|
Related | show |
On Wed, Jul 28, 2021 at 01:07:58PM +0530, Umang Jain wrote: > Currently CameraDevice wrapper is created first and then HAL config > validity is checked. If the validity checks fail, the code path will > simply return, in which case, creating CameraDevice seems a futile > exercise. It seems to be :) > > This patch defers the creation of CameraDevice wrapper until the HAL > config validity is checked for internal cameras. This will also enable > us to infer a few things beforehand, by reading the config file before > creating the CameraDevice wrapper. > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > --- > src/android/camera_hal_manager.cpp | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp > index 4cd67544..b364f62a 100644 > --- a/src/android/camera_hal_manager.cpp > +++ b/src/android/camera_hal_manager.cpp > @@ -133,9 +133,6 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam) > } > } > > - /* Create a CameraDevice instance to wrap the libcamera Camera. */ > - std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam); > - > /* > * The configuration file must be valid, and contain a corresponding > * entry for internal cameras. External cameras can be initialized > @@ -155,6 +152,9 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam) > return; > } > > + /* Create a CameraDevice instance to wrap the libcamera Camera. */ > + std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam); > + > int ret = camera->initialize(cameraConfigData); > if (ret) { > LOG(HAL, Error) << "Failed to initialize camera: " << cam->id(); > -- > 2.31.0 >
Hi Umang, Thank you for the patch. On Wed, Jul 28, 2021 at 01:07:58PM +0530, Umang Jain wrote: > Currently CameraDevice wrapper is created first and then HAL config > validity is checked. If the validity checks fail, the code path will > simply return, in which case, creating CameraDevice seems a futile > exercise. > > This patch defers the creation of CameraDevice wrapper until the HAL > config validity is checked for internal cameras. This will also enable > us to infer a few things beforehand, by reading the config file before > creating the CameraDevice wrapper. > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> This could have been folded in 2/3, but it's fine as a separate patch. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/android/camera_hal_manager.cpp | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp > index 4cd67544..b364f62a 100644 > --- a/src/android/camera_hal_manager.cpp > +++ b/src/android/camera_hal_manager.cpp > @@ -133,9 +133,6 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam) > } > } > > - /* Create a CameraDevice instance to wrap the libcamera Camera. */ > - std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam); > - > /* > * The configuration file must be valid, and contain a corresponding > * entry for internal cameras. External cameras can be initialized > @@ -155,6 +152,9 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam) > return; > } > > + /* Create a CameraDevice instance to wrap the libcamera Camera. */ > + std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam); > + > int ret = camera->initialize(cameraConfigData); > if (ret) { > LOG(HAL, Error) << "Failed to initialize camera: " << cam->id();
diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp index 4cd67544..b364f62a 100644 --- a/src/android/camera_hal_manager.cpp +++ b/src/android/camera_hal_manager.cpp @@ -133,9 +133,6 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam) } } - /* Create a CameraDevice instance to wrap the libcamera Camera. */ - std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam); - /* * The configuration file must be valid, and contain a corresponding * entry for internal cameras. External cameras can be initialized @@ -155,6 +152,9 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam) return; } + /* Create a CameraDevice instance to wrap the libcamera Camera. */ + std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam); + int ret = camera->initialize(cameraConfigData); if (ret) { LOG(HAL, Error) << "Failed to initialize camera: " << cam->id();
Currently CameraDevice wrapper is created first and then HAL config validity is checked. If the validity checks fail, the code path will simply return, in which case, creating CameraDevice seems a futile exercise. This patch defers the creation of CameraDevice wrapper until the HAL config validity is checked for internal cameras. This will also enable us to infer a few things beforehand, by reading the config file before creating the CameraDevice wrapper. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> --- src/android/camera_hal_manager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)