[v2,2/2] libcamera: Add gc08a3 camera sensor proprietary for ciri
diff mbox series

Message ID 20240924090051.1617040-3-chenghaoyang@google.com
State Superseded
Headers show
Series
  • Add camera sensor properties for ciri
Related show

Commit Message

Harvey Yang Sept. 24, 2024, 8:26 a.m. UTC
gc08a3 is the second sensor used by ciri.

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Co-developed-by: Xing Gu <xinggu@chromium.org>
Co-developed-by: Yudhistira Erlandinata <yerlandinata@chromium.org>
Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>
---
 src/ipa/libipa/camera_sensor_helper.cpp         | 17 +++++++++++++++++
 .../sensor/camera_sensor_properties.cpp         |  7 +++++++
 2 files changed, 24 insertions(+)

Comments

Kieran Bingham Sept. 24, 2024, 12:49 p.m. UTC | #1
Quoting Harvey Yang (2024-09-24 09:26:11)
> gc08a3 is the second sensor used by ciri.

Please keep this related to the sensor hardware.

Same comments for $SUBJECT as preceeding patch.

> 
> Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
> Co-developed-by: Xing Gu <xinggu@chromium.org>
> Co-developed-by: Yudhistira Erlandinata <yerlandinata@chromium.org>
> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>
> ---
>  src/ipa/libipa/camera_sensor_helper.cpp         | 17 +++++++++++++++++
>  .../sensor/camera_sensor_properties.cpp         |  7 +++++++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
> index cd7d12d6..afa177fe 100644
> --- a/src/ipa/libipa/camera_sensor_helper.cpp
> +++ b/src/ipa/libipa/camera_sensor_helper.cpp
> @@ -536,6 +536,23 @@ private:
>  };
>  REGISTER_CAMERA_SENSOR_HELPER("gc05a2", CameraSensorHelperGc05a2)
>  
> +class CameraSensorHelperGc08a3 : public CameraSensorHelper
> +{
> +public:
> +       uint32_t gainCode(double gain) const override
> +       {
> +               uint32_t aeGain = std::clamp((uint32_t)gain, kAeBaseGain_, kStep_ * kAeBaseGain_);
> +               return aeGain * 0x400 / kAeBaseGain_;
> +       }
> +
> +       // `double gain(uint32_t gainCode)` will not be used.

Same issue here too.

Also - applying these patches fails:

kbingham@Monstersaurus:~/iob/libcamera/ci/libcamera-gitlab-ci$ ./send-for-testing.sh 4617
git -C libcamera fetch --prune libcamera.org
git -C libcamera fetch --prune gl.fdo
git -C libcamera am --quit
fatal: Resolve operation not in progress, we are not resuming.
git -C libcamera reset --hard
HEAD is now at 64e347679b51 libcamera: rkisp1: Eliminate hard-coded resizer limits
git -C libcamera switch --detach
HEAD is now at 64e347679b51 libcamera: rkisp1: Eliminate hard-coded resizer limits
git -C libcamera checkout libcamera.org/master
Previous HEAD position was 64e347679b51 libcamera: rkisp1: Eliminate hard-coded resizer limits
HEAD is now at 642dbafe64d5 libcamera: libipa: camera_sensor: Add Sony IMX214 sensor properties
Preparing patchwork/4617
git -C libcamera show-ref --verify --quiet refs/heads/patchwork/4617
git -C libcamera checkout -b patchwork/4617
Switched to a new branch 'patchwork/4617'
git -C libcamera pw series apply 4617 -s
Applying: libcamera: Add gc05a2 camera sensor proprietary for ciri
Using index info to reconstruct a base tree...
M	src/ipa/libipa/camera_sensor_helper.cpp
M	src/libcamera/sensor/camera_sensor_properties.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/libcamera/sensor/camera_sensor_properties.cpp
Auto-merging src/ipa/libipa/camera_sensor_helper.cpp
CONFLICT (content): Merge conflict in src/ipa/libipa/camera_sensor_helper.cpp
Recorded preimage for 'src/ipa/libipa/camera_sensor_helper.cpp'
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 libcamera: Add gc05a2 camera sensor proprietary for ciri
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


--
Kieran


> +
> +private:
> +       static constexpr uint32_t kStep_ = 16;
> +       static constexpr uint32_t kAeBaseGain_ = 1024;
> +};
> +REGISTER_CAMERA_SENSOR_HELPER("gc08a3", CameraSensorHelperGc08a3)
> +
>  class CameraSensorHelperImx219 : public CameraSensorHelper
>  {
>  public:
> diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
> index 3e1bd85e..c76c8088 100644
> --- a/src/libcamera/sensor/camera_sensor_properties.cpp
> +++ b/src/libcamera/sensor/camera_sensor_properties.cpp
> @@ -77,6 +77,13 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
>                                 { controls::draft::TestPatternModeColorBars, 1 },
>                         },
>                 } },
> +               { "gc08a3", {
> +                       .unitCellSize = { 1120, 1120 },
> +                       .testPatternModes = {
> +                               { controls::draft::TestPatternModeOff, 0 },
> +                               { controls::draft::TestPatternModeColorBars, 2 },
> +                       },
> +               } },
>                 { "hi846", {
>                         .unitCellSize = { 1120, 1120 },
>                         .testPatternModes = {
> -- 
> 2.46.0.792.g87dc391469-goog
>
Harvey Yang Nov. 19, 2024, 7:42 a.m. UTC | #2
Hi Kieran,

On Tue, Sep 24, 2024 at 8:49 PM Kieran Bingham
<kieran.bingham@ideasonboard.com> wrote:
>
> Quoting Harvey Yang (2024-09-24 09:26:11)
> > gc08a3 is the second sensor used by ciri.
>
> Please keep this related to the sensor hardware.
>
> Same comments for $SUBJECT as preceeding patch.

Updated. Please check again.

>
> >
> > Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
> > Co-developed-by: Xing Gu <xinggu@chromium.org>
> > Co-developed-by: Yudhistira Erlandinata <yerlandinata@chromium.org>
> > Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>
> > ---
> >  src/ipa/libipa/camera_sensor_helper.cpp         | 17 +++++++++++++++++
> >  .../sensor/camera_sensor_properties.cpp         |  7 +++++++
> >  2 files changed, 24 insertions(+)
> >
> > diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
> > index cd7d12d6..afa177fe 100644
> > --- a/src/ipa/libipa/camera_sensor_helper.cpp
> > +++ b/src/ipa/libipa/camera_sensor_helper.cpp
> > @@ -536,6 +536,23 @@ private:
> >  };
> >  REGISTER_CAMERA_SENSOR_HELPER("gc05a2", CameraSensorHelperGc05a2)
> >
> > +class CameraSensorHelperGc08a3 : public CameraSensorHelper
> > +{
> > +public:
> > +       uint32_t gainCode(double gain) const override
> > +       {
> > +               uint32_t aeGain = std::clamp((uint32_t)gain, kAeBaseGain_, kStep_ * kAeBaseGain_);
> > +               return aeGain * 0x400 / kAeBaseGain_;
> > +       }
> > +
> > +       // `double gain(uint32_t gainCode)` will not be used.
>
> Same issue here too.
>
> Also - applying these patches fails:
>
> kbingham@Monstersaurus:~/iob/libcamera/ci/libcamera-gitlab-ci$ ./send-for-testing.sh 4617
> git -C libcamera fetch --prune libcamera.org
> git -C libcamera fetch --prune gl.fdo
> git -C libcamera am --quit
> fatal: Resolve operation not in progress, we are not resuming.
> git -C libcamera reset --hard
> HEAD is now at 64e347679b51 libcamera: rkisp1: Eliminate hard-coded resizer limits
> git -C libcamera switch --detach
> HEAD is now at 64e347679b51 libcamera: rkisp1: Eliminate hard-coded resizer limits
> git -C libcamera checkout libcamera.org/master
> Previous HEAD position was 64e347679b51 libcamera: rkisp1: Eliminate hard-coded resizer limits
> HEAD is now at 642dbafe64d5 libcamera: libipa: camera_sensor: Add Sony IMX214 sensor properties
> Preparing patchwork/4617
> git -C libcamera show-ref --verify --quiet refs/heads/patchwork/4617
> git -C libcamera checkout -b patchwork/4617
> Switched to a new branch 'patchwork/4617'
> git -C libcamera pw series apply 4617 -s
> Applying: libcamera: Add gc05a2 camera sensor proprietary for ciri
> Using index info to reconstruct a base tree...
> M       src/ipa/libipa/camera_sensor_helper.cpp
> M       src/libcamera/sensor/camera_sensor_properties.cpp
> Falling back to patching base and 3-way merge...
> Auto-merging src/libcamera/sensor/camera_sensor_properties.cpp
> Auto-merging src/ipa/libipa/camera_sensor_helper.cpp
> CONFLICT (content): Merge conflict in src/ipa/libipa/camera_sensor_helper.cpp
> Recorded preimage for 'src/ipa/libipa/camera_sensor_helper.cpp'
> error: Failed to merge in the changes.
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> Patch failed at 0001 libcamera: Add gc05a2 camera sensor proprietary for ciri
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".

Rebased onto the current origin/master.

BR,
Harvey

>
>
> --
> Kieran
>
>
> > +
> > +private:
> > +       static constexpr uint32_t kStep_ = 16;
> > +       static constexpr uint32_t kAeBaseGain_ = 1024;
> > +};
> > +REGISTER_CAMERA_SENSOR_HELPER("gc08a3", CameraSensorHelperGc08a3)
> > +
> >  class CameraSensorHelperImx219 : public CameraSensorHelper
> >  {
> >  public:
> > diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
> > index 3e1bd85e..c76c8088 100644
> > --- a/src/libcamera/sensor/camera_sensor_properties.cpp
> > +++ b/src/libcamera/sensor/camera_sensor_properties.cpp
> > @@ -77,6 +77,13 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
> >                                 { controls::draft::TestPatternModeColorBars, 1 },
> >                         },
> >                 } },
> > +               { "gc08a3", {
> > +                       .unitCellSize = { 1120, 1120 },
> > +                       .testPatternModes = {
> > +                               { controls::draft::TestPatternModeOff, 0 },
> > +                               { controls::draft::TestPatternModeColorBars, 2 },
> > +                       },
> > +               } },
> >                 { "hi846", {
> >                         .unitCellSize = { 1120, 1120 },
> >                         .testPatternModes = {
> > --
> > 2.46.0.792.g87dc391469-goog
> >

Patch
diff mbox series

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index cd7d12d6..afa177fe 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -536,6 +536,23 @@  private:
 };
 REGISTER_CAMERA_SENSOR_HELPER("gc05a2", CameraSensorHelperGc05a2)
 
+class CameraSensorHelperGc08a3 : public CameraSensorHelper
+{
+public:
+	uint32_t gainCode(double gain) const override
+	{
+		uint32_t aeGain = std::clamp((uint32_t)gain, kAeBaseGain_, kStep_ * kAeBaseGain_);
+		return aeGain * 0x400 / kAeBaseGain_;
+	}
+
+	// `double gain(uint32_t gainCode)` will not be used.
+
+private:
+	static constexpr uint32_t kStep_ = 16;
+	static constexpr uint32_t kAeBaseGain_ = 1024;
+};
+REGISTER_CAMERA_SENSOR_HELPER("gc08a3", CameraSensorHelperGc08a3)
+
 class CameraSensorHelperImx219 : public CameraSensorHelper
 {
 public:
diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp
index 3e1bd85e..c76c8088 100644
--- a/src/libcamera/sensor/camera_sensor_properties.cpp
+++ b/src/libcamera/sensor/camera_sensor_properties.cpp
@@ -77,6 +77,13 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				{ controls::draft::TestPatternModeColorBars, 1 },
 			},
 		} },
+		{ "gc08a3", {
+			.unitCellSize = { 1120, 1120 },
+			.testPatternModes = {
+				{ controls::draft::TestPatternModeOff, 0 },
+				{ controls::draft::TestPatternModeColorBars, 2 },
+			},
+		} },
 		{ "hi846", {
 			.unitCellSize = { 1120, 1120 },
 			.testPatternModes = {