| Message ID | 20260618122245.946138-27-bryan.odonoghue@linaro.org |
|---|---|
| State | RFC |
| Headers | show |
| Series |
|
| Related | show |
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > Doing an optional synchronous print after syncOutput. The GPU has finished > at this point so we can interrogate how long each shader took to execute. > > Only really interesting for a debug scenario. > > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > --- > .../software_isp/software_isp_pipeline_gpu.cpp | 15 +++++++++++++++ > .../software_isp/software_isp_pipeline_gpu.h | 2 ++ > 2 files changed, 17 insertions(+) > > diff --git a/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp b/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp > index 14f6d2b8c..d7bed8837 100644 > --- a/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp > +++ b/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp > @@ -122,6 +122,12 @@ int SoftwareIspPipelineGpu::initBayerShaders(PixelFormat inputFormat, PixelForma > return ret; > } > > +void SoftwareIspPipelineGpu::initShaderBenchMarks(void) > +{ > + gpuIspShaderPassBlcNormalise_.initShaderBenchMark(); > + gpuIspShaderPassDemosiac_.initShaderBenchMark(); > +} > + > int SoftwareIspPipelineGpu::configure(const StreamConfiguration &inputCfg, > const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs, > [[maybe_unused]] bool ccmEnabled) > @@ -283,6 +289,12 @@ int SoftwareIspPipelineGpu::processGPU(FrameBuffer *input, FrameBuffer *output, > return pipelineResult; > } > > +void SoftwareIspPipelineGpu::printShaderBenchMarks(void) > +{ > + gpuIspShaderPassBlcNormalise_.printShaderBenchMark(); > + gpuIspShaderPassDemosiac_.printShaderBenchMark(); > +} > + > void SoftwareIspPipelineGpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms) > { > bench_.startFrame(); > @@ -323,6 +335,7 @@ void SoftwareIspPipelineGpu::process(uint32_t frame, FrameBuffer *input, FrameBu > > egl_.syncOutput(); > bench_.finishFrame(); > + printShaderBenchMarks(); > > outputBufferReady.emit(output); > inputBufferReady.emit(input); > @@ -349,6 +362,8 @@ int SoftwareIspPipelineGpu::start() > if (initBayerShaders(inputPixelFormat_, outputPixelFormat_)) > return -EINVAL; > > + initShaderBenchMarks(); > + > /* Raw bayer input as texture */ > eglImageBayerIn_ = std::make_unique<eGLImage>(gpuIspShaderPassBlcNormalise_.glFormat_, inputConfig_.stride / gpuIspShaderPassBlcNormalise_.getBytesPerPixel(), height_, inputConfig_.stride, GL_TEXTURE0, 0); > > diff --git a/src/libcamera/software_isp/software_isp_pipeline_gpu.h b/src/libcamera/software_isp/software_isp_pipeline_gpu.h > index 8a922f658..b32d4cad3 100644 > --- a/src/libcamera/software_isp/software_isp_pipeline_gpu.h > +++ b/src/libcamera/software_isp/software_isp_pipeline_gpu.h > @@ -63,6 +63,8 @@ private: > int getShaderVariableLocations(); > void setShaderVariableValues(const DebayerParams ¶ms); > int processGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms, std::optional<MappedFrameBuffer> *mappedInputBuffer, std::optional<DmaSyncer> *inputBufferDmaSyncer); > + void initShaderBenchMarks(void); > + void printShaderBenchMarks(void); 1,$s/void// Otherwise it looks good. > /* Pointer to object representing input texture */ > std::unique_ptr<eGLImage> eglImageBayerIn_;
diff --git a/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp b/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp index 14f6d2b8c..d7bed8837 100644 --- a/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp +++ b/src/libcamera/software_isp/software_isp_pipeline_gpu.cpp @@ -122,6 +122,12 @@ int SoftwareIspPipelineGpu::initBayerShaders(PixelFormat inputFormat, PixelForma return ret; } +void SoftwareIspPipelineGpu::initShaderBenchMarks(void) +{ + gpuIspShaderPassBlcNormalise_.initShaderBenchMark(); + gpuIspShaderPassDemosiac_.initShaderBenchMark(); +} + int SoftwareIspPipelineGpu::configure(const StreamConfiguration &inputCfg, const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs, [[maybe_unused]] bool ccmEnabled) @@ -283,6 +289,12 @@ int SoftwareIspPipelineGpu::processGPU(FrameBuffer *input, FrameBuffer *output, return pipelineResult; } +void SoftwareIspPipelineGpu::printShaderBenchMarks(void) +{ + gpuIspShaderPassBlcNormalise_.printShaderBenchMark(); + gpuIspShaderPassDemosiac_.printShaderBenchMark(); +} + void SoftwareIspPipelineGpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms) { bench_.startFrame(); @@ -323,6 +335,7 @@ void SoftwareIspPipelineGpu::process(uint32_t frame, FrameBuffer *input, FrameBu egl_.syncOutput(); bench_.finishFrame(); + printShaderBenchMarks(); outputBufferReady.emit(output); inputBufferReady.emit(input); @@ -349,6 +362,8 @@ int SoftwareIspPipelineGpu::start() if (initBayerShaders(inputPixelFormat_, outputPixelFormat_)) return -EINVAL; + initShaderBenchMarks(); + /* Raw bayer input as texture */ eglImageBayerIn_ = std::make_unique<eGLImage>(gpuIspShaderPassBlcNormalise_.glFormat_, inputConfig_.stride / gpuIspShaderPassBlcNormalise_.getBytesPerPixel(), height_, inputConfig_.stride, GL_TEXTURE0, 0); diff --git a/src/libcamera/software_isp/software_isp_pipeline_gpu.h b/src/libcamera/software_isp/software_isp_pipeline_gpu.h index 8a922f658..b32d4cad3 100644 --- a/src/libcamera/software_isp/software_isp_pipeline_gpu.h +++ b/src/libcamera/software_isp/software_isp_pipeline_gpu.h @@ -63,6 +63,8 @@ private: int getShaderVariableLocations(); void setShaderVariableValues(const DebayerParams ¶ms); int processGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms, std::optional<MappedFrameBuffer> *mappedInputBuffer, std::optional<DmaSyncer> *inputBufferDmaSyncer); + void initShaderBenchMarks(void); + void printShaderBenchMarks(void); /* Pointer to object representing input texture */ std::unique_ptr<eGLImage> eglImageBayerIn_;
Doing an optional synchronous print after syncOutput. The GPU has finished at this point so we can interrogate how long each shader took to execute. Only really interesting for a debug scenario. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- .../software_isp/software_isp_pipeline_gpu.cpp | 15 +++++++++++++++ .../software_isp/software_isp_pipeline_gpu.h | 2 ++ 2 files changed, 17 insertions(+)