[BUG?] Argus camera doesn't send Set Analog Gain command on Capture Request re-repeat

Hello! I have noticed a weird thing happening with my camera - the gain doesn’t update after re-repeating previously created capture request.

  1. Create one capture request with Analog Gain in range (1.0 to 20.0) - this works fine, I can see in my kernel logs, that gain is changing properly (I have a print every time set_analog_gain function is called and its value.

  2. ICaptureSession->repeat(firstRequest) - works fine, is repeating and updating gain in the range

  3. Create a new capture request with Analog Gain in range (1.0 to 1.0) fixed gain, then do single capture - works fine

  4. ICaptureSession->repeat(firstRequest) - set_analog_gain in kernel is not called at all, the request is not deleted or modified from the first step.

I have tried stopping and restarting request repeat - it never changes after that. I even tried creating a new request with identical settings - still no luck.

Have a reference to argus_camera to reference how to set the configure.

I don’t have a problem figuring out the functions. The problem is that one of them doesn’t work for me. It’s exactly the same as in Argus camera UI - I mean the functions are very basic and they should work. I don’t know what’s happening to Argus.

// Set preview settings
  p_isource_settings->setSensorMode(camera_->getSensorMode()); // WORKS
  p_isource_settings->setExposureTimeRange(Range<uint64_t>{PREVIEW_EXP_TIME_MIN_NS, PREVIEW_EXP_TIME_MAX_NS}); // WORKS
  p_isource_settings->setFrameDurationRange(Range<uint64_t>{PREVIEW_EXP_TIME_MIN_NS, PREVIEW_EXP_TIME_MAX_NS + 25088}); // WORKS
  p_isource_settings->setGainRange(Range<float>{1.0f, 20.0f}); // DOESN'T WORK
  p_iauto_settings->setAeAntibandingMode(AE_ANTIBANDING_MODE_OFF); // WORKS
  p_iauto_settings->setAwbMode(AWB_MODE_AUTO); // WORKS
  p_iauto_settings->setIspDigitalGainRange(Range<float>{1.0f, 1.0f}); // WORKS

This is the unexplainable thing - setGainRange doesn’t work more on Capture Request re-repeat - everything else works.

Check the return code to confirm.


Status is STATUS_OK, and if I check getGainRange function, it returns correct range - but factually it doesn’t work, the ISP is not updating the range to the driver.

oops you need to narrow the gain to have ALG to apply it, if the default gain is in <1.0, 20.0f>
You can try <1.0, 1.0> or <20.0f, 20.0f>

Hmm, I tried setting to <20.0f, 20.0f> and still nothing. I mean I want to set back to automatic gain.

What do you mean automatic gain.
Try to change the scene or light source to check if the gain was apply to sensor.

I mean by default the ISP is calling set_gain_range according to the light source.

My use case is:

  1. Previewing with full gain range (ISP chooses the gain)
  2. I stop the preview, capture images in fixed gain (1.0, 1.0 - ISP doesn’t choose the gain anymore)
  3. Restart the same preview request as in first step - with full gain range (ISP should choose the gain again - but it doesn’t)

Here’s the kernel log, how it works

May 31 14:42:38 00011G0 kernel: [  304.246565] imx 2-001a: imx_set_gain: setting gain 114dBx10 as PGC 1497
May 31 14:42:38 00011G0 kernel: [  304.298134] imx 2-001a: imx_set_gain: setting gain 111dBx10 as PGC 1477
May 31 14:42:38 00011G0 kernel: [  304.346498] imx 2-001a: imx_set_gain: setting gain 114dBx10 as PGC 1497
May 31 14:42:38 00011G0 kernel: [  304.446570] imx 2-001a: imx_set_gain: setting gain 109dBx10 as PGC 1464
May 31 14:42:40 00011G0 kernel: [  306.019956] imx 2-001a: imx_set_gain: setting gain 0dBx10 as PGC 0	// Here I capture on fixed gain
May 31 14:42:40 00011G0 kernel: [  306.056759] imx 2-001a: imx_set_gain: setting gain 0dBx10 as PGC 0
May 31 14:42:40 00011G0 kernel: [  306.748613] imx 2-001a: imx_set_gain: setting gain 0dBx10 as PGC 0
May 31 14:42:41 00011G0 kernel: [  307.289479] imx 2-001a: imx_set_gain: setting gain 0dBx10 as PGC 0
May 31 14:42:45 00011G0 kernel: [  311.624877] imx 2-001a: imx_set_gain: setting gain 0dBx10 as PGC 0
// After my fixed gain capture ISP is not sending imx_set_gain command even though I started request repeat

EDIT: I mean the fundamental problem is that when I launch the program, the ISP sets the gain. As soon as I create a separate request with fixed gain, capture it, then set the first request again - the ISP doesn’t take over gain control.

Suppose the AE was stable at your step 2 and set property ET and when you set the gain to full by step 3 due to light source didn’t change so the gain doesn’t need to apply new gain.
Suppose the if light source change like cover the lens the AE should start running again.

Yeah, I understand - but it doesn’t - the ISP gain never changes after that, that’s the main problem. It tries to set the exposure time higher but not the gain.

What’s behavior different with argus_camera?

Here are more logs:

my app:

[2022-05-31 15:03:51.961] [debug] [argus_thread.cpp:283] Repeating request
[2022-05-31 15:03:51.962] [debug] [argus_thread.cpp:285] Setting gain to: 20 - 20
[2022-05-31 15:03:52.233] [trace] [argus_thread.cpp:189] Restarting preview

kernel log

May 31 15:03:52 00011G0 kernel: [ 1577.845729] imx 2-001a: imx_set_gain: setting gain 0dBx10 as PGC 0

So see - at 15:03:51.962 I’m setting gain to 20.0f - 20.0f - but the ISP right after that sets setting gain 0dBx10 as PGC 0 - it shouldn’t be 0 it should be 20. Is there a bug in the ISP?

Ok, I’ll check now

The issue was not present in Argus camera. However, I did find the reason, why this isn’t working. It must be a bug in Argus itself.

The reason, why the gain wasn’t working was the CAPTURE_INTENT type. It seems that if you set CAPTURE_INTENT_MANUAL at least once, it disables ISP gain control (maybe something else too like AWB) - EVEN if you set CAPTURE_INTENT_PREVIEW later - it’s not updating.

So to summarize - if you capture any request, which was created with CAPTURE_INTENT_MANUAL - all following requests after it will be CAPTURE_INTENT_MANUAL, regardless of their actual state.

I replaced CAPTURE_INTENT_MANUAL with CAPTURE_INTENT_STILL_CAPTURE for my non-preview request and now ISP gain control works.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.