[PATCH] libcamera: software_isp: Handle signals in the proper thread

Milan Zamazal mzamazal at redhat.com
Thu Dec 19 22:13:17 CET 2024


Hi Barnabás,

thank you for review.

Barnabás Pőcze <pobrn at protonmail.com> writes:

> Hi
>
>
> 2024. december 19., csütörtök 11:31 keltezéssel, Milan Zamazal <mzamazal at redhat.com> írta:
>
>> inputBufferReady ready signal in the simple pipeline is handled in the
>> pipeline handler thread.  Similarly, outputBufferReady and ispStatsReady
>> signals should be handled there too, everything should be called from
>> the right thread and not block the callers.
>> 
>> Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
>> ---
>>  src/libcamera/pipeline/simple/simple.cpp | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>> 
>> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
>> index 8ac24e6e..280112f4 100644
>> --- a/src/libcamera/pipeline/simple/simple.cpp
>> +++ b/src/libcamera/pipeline/simple/simple.cpp
>> @@ -548,12 +548,17 @@ int SimpleCameraData::init()
>>  			 * bound explicitly to the pipe, which is bound to the pipeline
>>  			 * handler thread. The function then simply forwards the call to
>>  			 * conversionInputDone().
>> +			 * Similarly for outputBufferReady and ispStatsReady signals.
>>  			 */
>>  			swIsp_->inputBufferReady.connect(pipe, [this](FrameBuffer *buffer) {
>>  				this->conversionInputDone(buffer);
>>  			});
>> -			swIsp_->outputBufferReady.connect(this, &SimpleCameraData::conversionOutputDone);
>> -			swIsp_->ispStatsReady.connect(this, &SimpleCameraData::ispStatsReady);
>> +			swIsp_->outputBufferReady.connect(this, [this](FrameBuffer *buffer) {
>> +				this->conversionOutputDone(buffer);
>> +			});
>> +			swIsp_->ispStatsReady.connect(this, [this](uint32_t frame, uint32_t bufferId) {
>> +				this->ispStatsReady(frame, bufferId);
>> +			});
>> [...]
>
> The object is still `this`, so I wouldn't expect any difference in behaviour. Is there?

Ah, right, should be `pipe', will fix it in v2.

> Regards,
> Barnabás Pőcze



More information about the libcamera-devel mailing list