[libcamera-devel] [PATCH] libcamera: pipeline: ipu3: Stop IPA before stopping devices

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Mar 8 17:46:12 CET 2021



On 08/03/2021 16:37, Niklas Söderlund wrote:
> Hi Kieran,
> 
> On 2021-03-08 16:29:15 +0000, Kieran Bingham wrote:
>> The IPA should be stopped before the hardware devices to ensure that
>> all asynchronous actions have completed within the IPA before resources
>> are removed and released.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>> ---
>>  src/libcamera/pipeline/ipu3/ipu3.cpp | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
>> index 2b4d31500533..498f85634a83 100644
>> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
>> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
>> @@ -764,13 +764,13 @@ void PipelineHandlerIPU3::stop(Camera *camera)
>>  	IPU3CameraData *data = cameraData(camera);
>>  	int ret = 0;
>>  
>> +	data->ipa_->stop();
>> +
>>  	ret |= data->imgu_->stop();
>>  	ret |= data->cio2_.stop();
>>  	if (ret)
>>  		LOG(IPU3, Warning) << "Failed to stop camera " << camera->id();
>>  
>> -	data->ipa_->stop();
>> -
> 
> IIRC correctly this order was picked because before the cio2 is stopped 
> buffers may still be dequeued and therefor handed to the IPA for 
> processing. This was however done before the new IPC change and with a 
> mock IPA. How does this work with the new IPC/IPA if the pipeline 
> handler tries to post buffers to be processed before the CIO2 is 
> stopped?
> 
> 
>>  	freeBuffers(camera);
> 
> Should not all resources shared between pipeline and IPA be available 
> until the buffers are freed here?

freeBuffers()  releases:

  frameInfos->clear();
  data->ipa_->unmapBuffers(ids);
  ipaBuffers_.clear();
  data->imgu_->freeBuffers();

Surely we need to make sure both the devices and IPA have stopped before
we free these resources?

So I think freeBuffers should remain at the end...



> 
>>  }
>>  
>> -- 
>> 2.25.1
>>
>> _______________________________________________
>> libcamera-devel mailing list
>> libcamera-devel at lists.libcamera.org
>> https://lists.libcamera.org/listinfo/libcamera-devel
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list