| Message ID | 20260618122245.946138-26-bryan.odonoghue@linaro.org |
|---|---|
| State | RFC |
| Headers | show |
| Series |
|
| Related | show |
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > --- > .../software_isp/gpu_pipeline_shader_pass.cpp | 10 ++++++++++ > src/libcamera/software_isp/gpu_pipeline_shader_pass.h | 4 ++++ > 2 files changed, 14 insertions(+) > > diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp > index d0d13eef9..57d60f50e 100644 > --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp > +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp > @@ -57,6 +57,8 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 > glViewport(0, 0, width, height); > glClear(GL_COLOR_BUFFER_BIT); > > + eglBenchMark_.begin(egl_); > + > glDrawArrays(GL_TRIANGLE_FAN, 0, DEBAYER_OPENGL_COORDS); > err = glGetError(); > if (err != GL_NO_ERROR) { > @@ -64,9 +66,17 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 > return -ENODEV; > } > > + eglBenchMark_.end(egl_); > + > return 0; > } > > +void GpuIspShaderPass::printShaderBenchMark(void) > +{ > + LOG(GpuShaderPass, Debug) << > + "ShaderPass = " << this->name() << " took " << eglBenchMark_.getTimeElapsedSync(egl_) / 1000 << " us"; > +} > + > int GpuIspShaderPass::start() > { > return 0; > diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h > index a329845ee..0cff531e9 100644 > --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h > +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h > @@ -74,8 +74,12 @@ public: > */ > GLint glFormat_; > > + void initShaderBenchMark(void) { eglBenchMark_.init(); } > + void printShaderBenchMark(void); 1,$s/void// Otherwise it looks good to me as far as I understand it. > + > protected: > eGL& egl_; > + eGLBenchMark eglBenchMark_; > > /* Shader calculates this getter provides ability to interrogate if needed */ > unsigned int bytesPerPixel_;
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > --- > .../software_isp/gpu_pipeline_shader_pass.cpp | 10 ++++++++++ > src/libcamera/software_isp/gpu_pipeline_shader_pass.h | 4 ++++ > 2 files changed, 14 insertions(+) > > diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp > index d0d13eef9..57d60f50e 100644 > --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp > +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp > @@ -57,6 +57,8 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 > glViewport(0, 0, width, height); > glClear(GL_COLOR_BUFFER_BIT); > > + eglBenchMark_.begin(egl_); > + > glDrawArrays(GL_TRIANGLE_FAN, 0, DEBAYER_OPENGL_COORDS); > err = glGetError(); > if (err != GL_NO_ERROR) { > @@ -64,9 +66,17 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 > return -ENODEV; > } > > + eglBenchMark_.end(egl_); On RPi 4: - Debian 12: It doesn't work as the facility is unsupported. - Debian 13: It works, but if I comment out the eglBenchMark_ calls, the per-frame time reported by software ISP is about 15% faster (and a bit faster than on master). > + > return 0; > } > > +void GpuIspShaderPass::printShaderBenchMark(void) > +{ > + LOG(GpuShaderPass, Debug) << > + "ShaderPass = " << this->name() << " took " << eglBenchMark_.getTimeElapsedSync(egl_) / 1000 << " us"; When running on RPi 4 Debian 13 with DEBUG logging, I get the following segmentation fault: 0x0000007ff78207e0 in std::basic_ostream<char, std::char_traits<char> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) () from /lib/aarch64-linux-gnu/libstdc++.so.6 (gdb) where #0 0x0000007ff78207e0 in std::basic_ostream<char, std::char_traits<char> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) () from /lib/aarch64-linux-gnu/libstdc++.so.6 #1 0x0000007ff7821d10 in std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned long>(unsigned long) () from /lib/aarch64-linux-gnu/libstdc++.so.6 #2 0x0000007ff7f485c4 in std::basic_ostream<char, std::char_traits<char> >::operator<< ( this=0x7feefdd270, __n=<optimized out>) at /usr/include/c++/14/ostream:179 #3 libcamera::GpuIspShaderPass::printShaderBenchMark (this=this@entry=0x7fe8027d08) at ../src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp:78 When I extract eglBenchMark_.getTimeElapsedSync(egl_) / 1000 to a local `unsigned int' variable just before the LOG call and use the variable there instead of the expression, it works fine. Don't ask me why. > +} > + > int GpuIspShaderPass::start() > { > return 0; > diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h > index a329845ee..0cff531e9 100644 > --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h > +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h > @@ -74,8 +74,12 @@ public: > */ > GLint glFormat_; > > + void initShaderBenchMark(void) { eglBenchMark_.init(); } > + void printShaderBenchMark(void); > + > protected: > eGL& egl_; > + eGLBenchMark eglBenchMark_; > > /* Shader calculates this getter provides ability to interrogate if needed */ > unsigned int bytesPerPixel_;
On 06/07/2026 17:06, Milan Zamazal wrote: > Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > >> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> >> --- >> .../software_isp/gpu_pipeline_shader_pass.cpp | 10 ++++++++++ >> src/libcamera/software_isp/gpu_pipeline_shader_pass.h | 4 ++++ >> 2 files changed, 14 insertions(+) >> >> diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp >> index d0d13eef9..57d60f50e 100644 >> --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp >> +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp >> @@ -57,6 +57,8 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 >> glViewport(0, 0, width, height); >> glClear(GL_COLOR_BUFFER_BIT); >> >> + eglBenchMark_.begin(egl_); >> + >> glDrawArrays(GL_TRIANGLE_FAN, 0, DEBAYER_OPENGL_COORDS); >> err = glGetError(); >> if (err != GL_NO_ERROR) { >> @@ -64,9 +66,17 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 >> return -ENODEV; >> } >> >> + eglBenchMark_.end(egl_); > > On RPi 4: > > - Debian 12: It doesn't work as the facility is unsupported. > > - Debian 13: It works, but if I comment out the eglBenchMark_ calls, the > per-frame time reported by software ISP is about 15% faster (and a bit > faster than on master). Out of curiosity why not RaspiOS ? BTW which version of Mesa is that ? Actually this is pretty useful to know, I have a bunch of RPI 3/4 so, I should be able to "play along at home" and verify the tests we put in place for the different levels of functionality work. >> + >> return 0; >> } >> >> +void GpuIspShaderPass::printShaderBenchMark(void) >> +{ >> + LOG(GpuShaderPass, Debug) << >> + "ShaderPass = " << this->name() << " took " << eglBenchMark_.getTimeElapsedSync(egl_) / 1000 << " us"; > > When running on RPi 4 Debian 13 with DEBUG logging, I get the following > segmentation fault: > > 0x0000007ff78207e0 in std::basic_ostream<char, std::char_traits<char> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) () from /lib/aarch64-linux-gnu/libstdc++.so.6 > (gdb) where > #0 0x0000007ff78207e0 in std::basic_ostream<char, std::char_traits<char> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) () from /lib/aarch64-linux-gnu/libstdc++.so.6 > #1 0x0000007ff7821d10 in std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned long>(unsigned long) () > from /lib/aarch64-linux-gnu/libstdc++.so.6 > #2 0x0000007ff7f485c4 in std::basic_ostream<char, std::char_traits<char> >::operator<< ( > this=0x7feefdd270, __n=<optimized out>) at /usr/include/c++/14/ostream:179 > #3 libcamera::GpuIspShaderPass::printShaderBenchMark (this=this@entry=0x7fe8027d08) > at ../src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp:78 > > When I extract > > eglBenchMark_.getTimeElapsedSync(egl_) / 1000 > > to a local `unsigned int' variable just before the LOG call and use the > variable there instead of the expression, it works fine. Don't ask me > why. what happens with unsigned long long ? > >> +} >> + >> int GpuIspShaderPass::start() >> { >> return 0; >> diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h >> index a329845ee..0cff531e9 100644 >> --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h >> +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h >> @@ -74,8 +74,12 @@ public: >> */ >> GLint glFormat_; >> >> + void initShaderBenchMark(void) { eglBenchMark_.init(); } >> + void printShaderBenchMark(void); >> + >> protected: >> eGL& egl_; >> + eGLBenchMark eglBenchMark_; >> >> /* Shader calculates this getter provides ability to interrogate if needed */ >> unsigned int bytesPerPixel_; >
Bryan O'Donoghue <bod.linux@nxsw.ie> writes: > On 06/07/2026 17:06, Milan Zamazal wrote: >> Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: >> > >>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> >>> --- >>> .../software_isp/gpu_pipeline_shader_pass.cpp | 10 ++++++++++ >>> src/libcamera/software_isp/gpu_pipeline_shader_pass.h | 4 ++++ >>> 2 files changed, 14 insertions(+) >>> >>> diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp >>> index d0d13eef9..57d60f50e 100644 >>> --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp >>> +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp >>> @@ -57,6 +57,8 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 >>> glViewport(0, 0, width, height); >>> glClear(GL_COLOR_BUFFER_BIT); >>> >>> + eglBenchMark_.begin(egl_); >>> + >>> glDrawArrays(GL_TRIANGLE_FAN, 0, DEBAYER_OPENGL_COORDS); >>> err = glGetError(); >>> if (err != GL_NO_ERROR) { >>> @@ -64,9 +66,17 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 >>> return -ENODEV; >>> } >>> >>> + eglBenchMark_.end(egl_); >> On RPi 4: >> - Debian 12: It doesn't work as the facility is unsupported. >> - Debian 13: It works, but if I comment out the eglBenchMark_ calls, the >> per-frame time reported by software ISP is about 15% faster (and a bit >> faster than on master). > > Out of curiosity why not RaspiOS ? I had had a frustrating experience with it (unstable graphics etc.), so I reinstalled to Debian, some years ago. > BTW which version of Mesa is that ? EGL: GL_VERSION: OpenGL ES 3.1 Mesa 25.0.7-2 > Actually this is pretty useful to know, I have a bunch of RPI 3/4 so, I should be able to "play along at > home" and verify the tests we put in place for the different levels of functionality work. > >>> + >>> return 0; >>> } >>> >>> +void GpuIspShaderPass::printShaderBenchMark(void) >>> +{ >>> + LOG(GpuShaderPass, Debug) << >>> + "ShaderPass = " << this->name() << " took " << eglBenchMark_.getTimeElapsedSync(egl_) / 1000 << " us"; >> When running on RPi 4 Debian 13 with DEBUG logging, I get the following >> segmentation fault: >> 0x0000007ff78207e0 in std::basic_ostream<char, std::char_traits<char> >> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) () from >> /lib/aarch64-linux-gnu/libstdc++.so.6 >> (gdb) where >> #0 0x0000007ff78207e0 in std::basic_ostream<char, std::char_traits<char> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) () from /lib/aarch64-linux-gnu/libstdc++.so.6 >> #1 0x0000007ff7821d10 in std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned long>(unsigned long) () >> from /lib/aarch64-linux-gnu/libstdc++.so.6 >> #2 0x0000007ff7f485c4 in std::basic_ostream<char, std::char_traits<char> >::operator<< ( >> this=0x7feefdd270, __n=<optimized out>) at /usr/include/c++/14/ostream:179 >> #3 libcamera::GpuIspShaderPass::printShaderBenchMark (this=this@entry=0x7fe8027d08) >> at ../src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp:78 >> When I extract >> eglBenchMark_.getTimeElapsedSync(egl_) / 1000 >> to a local `unsigned int' variable just before the LOG call and use the >> variable there instead of the expression, it works fine. Don't ask me >> why. > > what happens with unsigned long long ? No problem, GLuint64 is fine too. The only thing that seems to matter is using the local variable. gcc (Debian 14.2.0-19) 14.2.0 >> >>> +} >>> + >>> int GpuIspShaderPass::start() >>> { >>> return 0; >>> diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h >>> index a329845ee..0cff531e9 100644 >>> --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h >>> +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h >>> @@ -74,8 +74,12 @@ public: >>> */ >>> GLint glFormat_; >>> >>> + void initShaderBenchMark(void) { eglBenchMark_.init(); } >>> + void printShaderBenchMark(void); >>> + >>> protected: >>> eGL& egl_; >>> + eGLBenchMark eglBenchMark_; >>> >>> /* Shader calculates this getter provides ability to interrogate if needed */ >>> unsigned int bytesPerPixel_; >>
Milan Zamazal <mzamazal@redhat.com> writes: > Bryan O'Donoghue <bod.linux@nxsw.ie> writes: > >> On 06/07/2026 17:06, Milan Zamazal wrote: >>> Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: >>> >> >>>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> >>>> --- >>>> .../software_isp/gpu_pipeline_shader_pass.cpp | 10 ++++++++++ >>>> src/libcamera/software_isp/gpu_pipeline_shader_pass.h | 4 ++++ >>>> 2 files changed, 14 insertions(+) >>>> >>>> diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp >>>> index d0d13eef9..57d60f50e 100644 >>>> --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp >>>> +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp >>>> @@ -57,6 +57,8 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 >>>> glViewport(0, 0, width, height); >>>> glClear(GL_COLOR_BUFFER_BIT); >>>> >>>> + eglBenchMark_.begin(egl_); >>>> + >>>> glDrawArrays(GL_TRIANGLE_FAN, 0, DEBAYER_OPENGL_COORDS); >>>> err = glGetError(); >>>> if (err != GL_NO_ERROR) { >>>> @@ -64,9 +66,17 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 >>>> return -ENODEV; >>>> } >>>> >>>> + eglBenchMark_.end(egl_); >>> On RPi 4: >>> - Debian 12: It doesn't work as the facility is unsupported. >>> - Debian 13: It works, but if I comment out the eglBenchMark_ calls, the >>> per-frame time reported by software ISP is about 15% faster (and a bit >>> faster than on master). >> >> Out of curiosity why not RaspiOS ? > > I had had a frustrating experience with it (unstable graphics etc.), so > I reinstalled to Debian, some years ago. > >> BTW which version of Mesa is that ? > > EGL: GL_VERSION: OpenGL ES 3.1 Mesa 25.0.7-2 > >> Actually this is pretty useful to know, I have a bunch of RPI 3/4 so, I should be able to "play along at >> home" and verify the tests we put in place for the different levels of functionality work. >> >>>> + >>>> return 0; >>>> } >>>> >>>> +void GpuIspShaderPass::printShaderBenchMark(void) >>>> +{ >>>> + LOG(GpuShaderPass, Debug) << >>>> + "ShaderPass = " << this->name() << " took " << eglBenchMark_.getTimeElapsedSync(egl_) / 1000 << " us"; >>> When running on RPi 4 Debian 13 with DEBUG logging, I get the following >>> segmentation fault: >>> 0x0000007ff78207e0 in std::basic_ostream<char, std::char_traits<char> >>> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) () from >>> /lib/aarch64-linux-gnu/libstdc++.so.6 >>> (gdb) where >>> #0 0x0000007ff78207e0 in std::basic_ostream<char, std::char_traits<char> >::sentry::sentry(std::basic_ostream<char, std::char_traits<char> >&) () from /lib/aarch64-linux-gnu/libstdc++.so.6 >>> #1 0x0000007ff7821d10 in std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned long>(unsigned long) () >>> from /lib/aarch64-linux-gnu/libstdc++.so.6 >>> #2 0x0000007ff7f485c4 in std::basic_ostream<char, std::char_traits<char> >::operator<< ( >>> this=0x7feefdd270, __n=<optimized out>) at /usr/include/c++/14/ostream:179 >>> #3 libcamera::GpuIspShaderPass::printShaderBenchMark (this=this@entry=0x7fe8027d08) >>> at ../src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp:78 >>> When I extract >>> eglBenchMark_.getTimeElapsedSync(egl_) / 1000 >>> to a local `unsigned int' variable just before the LOG call and use the >>> variable there instead of the expression, it works fine. Don't ask me >>> why. >> >> what happens with unsigned long long ? > > No problem, GLuint64 is fine too. The only thing that seems to matter > is using the local variable. AI discovered the problem -- a 32-bit variable is used in a place where a 64-bit memory location is expected. This patch fixes the problem: diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h index c9b3a4e81..8d98faf75 100644 --- a/include/libcamera/internal/egl.h +++ b/include/libcamera/internal/egl.h @@ -152,7 +152,7 @@ private: PFNGLBEGINQUERYPROC glBeginQuery; PFNGLENDQUERYPROC glEndQuery; PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectuiv; - PFNGLGETQUERYOBJECTUIVPROC glGetQueryObjectui64v; + PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64v; PFNGLGENQUERIESPROC glGenQueries; }; @@ -192,7 +192,7 @@ private: GLuint64 getTimeElapsed(eGL &egl, bool sync) { - GLuint time_elapsed_ns = 0; + GLuint64 time_elapsed_ns = 0; GLuint available = 0; if (!sync) diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp index fc1516634..237ce59bc 100644 --- a/src/libcamera/egl.cpp +++ b/src/libcamera/egl.cpp @@ -435,7 +435,7 @@ int eGL::initEGLContext() goto fail; } - glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUIVPROC)eglGetProcAddress("glGetQueryObjectui64v"); + glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VEXTPROC)eglGetProcAddress("glGetQueryObjectui64v"); if (!glGetQueryObjectuiv) { LOG(eGL, Error) << "glGetQueryObjectui64v not found"; goto fail; > gcc (Debian 14.2.0-19) 14.2.0 > >>> >>>> +} >>>> + >>>> int GpuIspShaderPass::start() >>>> { >>>> return 0; >>>> diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h >>>> index a329845ee..0cff531e9 100644 >>>> --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h >>>> +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h >>>> @@ -74,8 +74,12 @@ public: >>>> */ >>>> GLint glFormat_; >>>> >>>> + void initShaderBenchMark(void) { eglBenchMark_.init(); } >>>> + void printShaderBenchMark(void); >>>> + >>>> protected: >>>> eGL& egl_; >>>> + eGLBenchMark eglBenchMark_; >>>> >>>> /* Shader calculates this getter provides ability to interrogate if needed */ >>>> unsigned int bytesPerPixel_; >>>
diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp index d0d13eef9..57d60f50e 100644 --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.cpp @@ -57,6 +57,8 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); + eglBenchMark_.begin(egl_); + glDrawArrays(GL_TRIANGLE_FAN, 0, DEBAYER_OPENGL_COORDS); err = glGetError(); if (err != GL_NO_ERROR) { @@ -64,9 +66,17 @@ int GpuIspShaderPass::process(eGLImage &eglImageIn, eGLImage &eglImageOut, uint3 return -ENODEV; } + eglBenchMark_.end(egl_); + return 0; } +void GpuIspShaderPass::printShaderBenchMark(void) +{ + LOG(GpuShaderPass, Debug) << + "ShaderPass = " << this->name() << " took " << eglBenchMark_.getTimeElapsedSync(egl_) / 1000 << " us"; +} + int GpuIspShaderPass::start() { return 0; diff --git a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h index a329845ee..0cff531e9 100644 --- a/src/libcamera/software_isp/gpu_pipeline_shader_pass.h +++ b/src/libcamera/software_isp/gpu_pipeline_shader_pass.h @@ -74,8 +74,12 @@ public: */ GLint glFormat_; + void initShaderBenchMark(void) { eglBenchMark_.init(); } + void printShaderBenchMark(void); + protected: eGL& egl_; + eGLBenchMark eglBenchMark_; /* Shader calculates this getter provides ability to interrogate if needed */ unsigned int bytesPerPixel_;
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- .../software_isp/gpu_pipeline_shader_pass.cpp | 10 ++++++++++ src/libcamera/software_isp/gpu_pipeline_shader_pass.h | 4 ++++ 2 files changed, 14 insertions(+)