libcamera: software_isp: Clear frameContexts on Stop()
diff mbox series

Message ID 20241013120450.149837-1-robert.mader@collabora.com
State Superseded
Headers show
Series
  • libcamera: software_isp: Clear frameContexts on Stop()
Related show

Commit Message

Robert Mader Oct. 13, 2024, 12:04 p.m. UTC
Like the hardware pipelines do. Otherwise we might hit the following
assert: "Frame context for ... has been overwritten by ...".

Fixes: 04d171e6 ("libcamera: software_isp: Call Algorithm::queueRequest")
Signed-off-by: Robert Mader <robert.mader@collabora.com>
---
 src/ipa/simple/soft_simple.cpp | 1 +
 1 file changed, 1 insertion(+)

Comments

Umang Jain Oct. 13, 2024, 3:50 p.m. UTC | #1
Hi Robert,

On 13/10/24 5:34 pm, Robert Mader wrote:
> Like the hardware pipelines do. Otherwise we might hit the following
> assert: "Frame context for ... has been overwritten by ...".

Would you like to mention here briefly, on what use-case you hit this 
assertion.
>
> Fixes: 04d171e6 ("libcamera: software_isp: Call Algorithm::queueRequest")
> Signed-off-by: Robert Mader <robert.mader@collabora.com>
> ---
>   src/ipa/simple/soft_simple.cpp | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp
> index b28c7039..ac8847cb 100644
> --- a/src/ipa/simple/soft_simple.cpp
> +++ b/src/ipa/simple/soft_simple.cpp
> @@ -245,6 +245,7 @@ int IPASoftSimple::start()
>   
>   void IPASoftSimple::stop()
>   {
> +  context_.frameContexts.clear();

Looks good to me but additional hardware pipelines also reset/clear at 
configure() time, for e.g.

        /* Clear the IPA context before the streaming session. */
         context_.configuration = {};
         context_.activeState = {};
         context_.frameContexts.clear();

Would it make sense to do it in Soft IPA as well?
Robert Mader Oct. 13, 2024, 4:42 p.m. UTC | #2
On 13.10.24 17:50, Umang Jain wrote:
> Hi Robert,
>
> On 13/10/24 5:34 pm, Robert Mader wrote:
>> Like the hardware pipelines do. Otherwise we might hit the following
>> assert: "Frame context for ... has been overwritten by ...".
>
> Would you like to mention here briefly, on what use-case you hit this 
> assertion.
Can do. Most easily this can be reproduced when switching back and forth 
between two cameras using the swISP, e.g. on a phone like the Pixel 3a.
>>
>> Fixes: 04d171e6 ("libcamera: software_isp: Call 
>> Algorithm::queueRequest")
>> Signed-off-by: Robert Mader <robert.mader@collabora.com>
>> ---
>>   src/ipa/simple/soft_simple.cpp | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/src/ipa/simple/soft_simple.cpp 
>> b/src/ipa/simple/soft_simple.cpp
>> index b28c7039..ac8847cb 100644
>> --- a/src/ipa/simple/soft_simple.cpp
>> +++ b/src/ipa/simple/soft_simple.cpp
>> @@ -245,6 +245,7 @@ int IPASoftSimple::start()
>>     void IPASoftSimple::stop()
>>   {
>> +  context_.frameContexts.clear();
>
> Looks good to me but additional hardware pipelines also reset/clear at 
> configure() time, for e.g.
>
>        /* Clear the IPA context before the streaming session. */
>         context_.configuration = {};
>         context_.activeState = {};
>         context_.frameContexts.clear();
>
> Would it make sense to do it in Soft IPA as well?
Yeah, good point - looks like cleaning up configuration and activeState 
so far wasn't really required for gain, but will be for the blacklevel.

Patch
diff mbox series

diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp
index b28c7039..ac8847cb 100644
--- a/src/ipa/simple/soft_simple.cpp
+++ b/src/ipa/simple/soft_simple.cpp
@@ -245,6 +245,7 @@  int IPASoftSimple::start()
 
 void IPASoftSimple::stop()
 {
+  context_.frameContexts.clear();
 }
 
 void IPASoftSimple::queueRequest(const uint32_t frame, const ControlList &controls)