| Message ID | 20251127022256.178929-18-bryan.odonoghue@linaro.org |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Quoting Bryan O'Donoghue (2025-11-27 02:22:49) > The eGL class wants to be able to teardown its sync_ data member > properly but, doing so in the destructor means we can't make the eGL > context current and thus can't tear down the sync primitive properly. > > Introduce a stop() method to the debayer class which triggers from the > softisp's stop method, allowing a controlled and appropriate tear-down > of debayer-egl and egl class related data well before the destructors > get invoked. > > Reviewed-by: Milan Zamazal <mzamazal@redhat.com> > [bod: Made method blocking not queued per Robert's bugfixes] > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > --- > src/libcamera/software_isp/debayer.h | 1 + > src/libcamera/software_isp/debayer_cpu.cpp | 10 ++++++++++ > src/libcamera/software_isp/debayer_cpu.h | 1 + > src/libcamera/software_isp/software_isp.cpp | 3 +++ > 4 files changed, 15 insertions(+) > > diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h > index 451c1c9ac..088b062c0 100644 > --- a/src/libcamera/software_isp/debayer.h > +++ b/src/libcamera/software_isp/debayer.h > @@ -48,6 +48,7 @@ public: > strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0; > > virtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0; > + virtual void stop() = 0; > > virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0; > > diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp > index 00738c56b..28fb8ca50 100644 > --- a/src/libcamera/software_isp/debayer_cpu.cpp > +++ b/src/libcamera/software_isp/debayer_cpu.cpp > @@ -788,6 +788,16 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output > inputBufferReady.emit(input); > } > > +/** > + * \fn void Debayer::stop() > + * \brief Stop the debayering process and perform cleanup > + * > + * In the DebayerCPU case this is an empty stub function but > + * for the GPU case this does something useful. The stub here is to > + * ensure the right version of the virtual gets called. > + */ > +void DebayerCpu::stop() {} I think the lint stage will want this reformated. With that: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > + > SizeRange DebayerCpu::sizes(PixelFormat inputFormat, const Size &inputSize) > { > Size patternSize = this->patternSize(inputFormat); > diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h > index ecc4f9dd0..2d385cf01 100644 > --- a/src/libcamera/software_isp/debayer_cpu.h > +++ b/src/libcamera/software_isp/debayer_cpu.h > @@ -38,6 +38,7 @@ public: > std::tuple<unsigned int, unsigned int> > strideAndFrameSize(const PixelFormat &outputFormat, const Size &size); > void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params); > + void stop(); > SizeRange sizes(PixelFormat inputFormat, const Size &inputSize); > const SharedFD &getStatsFD() { return stats_->getStatsFD(); } > > diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp > index 4c232339b..aa4a40cb6 100644 > --- a/src/libcamera/software_isp/software_isp.cpp > +++ b/src/libcamera/software_isp/software_isp.cpp > @@ -367,6 +367,9 @@ int SoftwareIsp::start() > */ > void SoftwareIsp::stop() > { > + debayer_->invokeMethod(&Debayer::stop, > + ConnectionTypeBlocking); > + > ispWorkerThread_.exit(); > ispWorkerThread_.wait(); > ispWorkerThread_.removeMessages(debayer_.get()); > -- > 2.51.2 >
diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index 451c1c9ac..088b062c0 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -48,6 +48,7 @@ public: strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0; virtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0; + virtual void stop() = 0; virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0; diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 00738c56b..28fb8ca50 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -788,6 +788,16 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output inputBufferReady.emit(input); } +/** + * \fn void Debayer::stop() + * \brief Stop the debayering process and perform cleanup + * + * In the DebayerCPU case this is an empty stub function but + * for the GPU case this does something useful. The stub here is to + * ensure the right version of the virtual gets called. + */ +void DebayerCpu::stop() {} + SizeRange DebayerCpu::sizes(PixelFormat inputFormat, const Size &inputSize) { Size patternSize = this->patternSize(inputFormat); diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h index ecc4f9dd0..2d385cf01 100644 --- a/src/libcamera/software_isp/debayer_cpu.h +++ b/src/libcamera/software_isp/debayer_cpu.h @@ -38,6 +38,7 @@ public: std::tuple<unsigned int, unsigned int> strideAndFrameSize(const PixelFormat &outputFormat, const Size &size); void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params); + void stop(); SizeRange sizes(PixelFormat inputFormat, const Size &inputSize); const SharedFD &getStatsFD() { return stats_->getStatsFD(); } diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 4c232339b..aa4a40cb6 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -367,6 +367,9 @@ int SoftwareIsp::start() */ void SoftwareIsp::stop() { + debayer_->invokeMethod(&Debayer::stop, + ConnectionTypeBlocking); + ispWorkerThread_.exit(); ispWorkerThread_.wait(); ispWorkerThread_.removeMessages(debayer_.get());