Message ID | 20221014131846.27169-4-naush@raspberrypi.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Naush Thanks for the patch! On Fri, 14 Oct 2022 at 14:18, Naushir Patuck via libcamera-devel <libcamera-devel@lists.libcamera.org> wrote: > > Add a new config parameter numOutput0Buffers specifying the number of internally > allocated ISP Output0 buffers. This parameter defaults to 1. > > Split out the buffer allocation logic so that the buffer count for ISP Output0 > can be different from the ISP Output1 and Statistics streams. > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Thanks! David > --- > .../pipeline/raspberrypi/raspberrypi.cpp | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > index 7d1e454cddcd..450029197b11 100644 > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > @@ -297,6 +297,7 @@ public: > struct Config { > unsigned int minUnicamBuffers; > unsigned int minTotalUnicamBuffers; > + unsigned int numOutput0Buffers; > }; > > Config config_; > @@ -1401,6 +1402,7 @@ int PipelineHandlerRPi::configurePipelineHandler(RPiCameraData *data) > config = { > .minUnicamBuffers = 2, > .minTotalUnicamBuffers = 4, > + .numOutput0Buffers = 1, > }; > > return 0; > @@ -1485,12 +1487,19 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) > * so allocate the minimum required to avoid frame drops. > */ > numBuffers = minBuffers; > - } else { > + } else if (stream == &data->isp_[Isp::Output0]) { > /* > * Since the ISP runs synchronous with the IPA and requests, > - * we only ever need one set of internal buffers. Any buffers > - * the application wants to hold onto will already be exported > - * through PipelineHandlerRPi::exportFrameBuffers(). > + * we only ever need a maximum of one internal buffer. Any > + * buffers the application wants to hold onto will already > + * be exported through PipelineHandlerRPi::exportFrameBuffers(). > + */ > + numBuffers = std::min(1u, data->config_.numOutput0Buffers); > + } else { > + /* > + * Same reasoning as above, we only ever need a maximum > + * of one internal buffer for Output1 (required for colour > + * denoise) and ISP statistics. > */ > numBuffers = 1; > } > -- > 2.25.1 >
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 7d1e454cddcd..450029197b11 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -297,6 +297,7 @@ public: struct Config { unsigned int minUnicamBuffers; unsigned int minTotalUnicamBuffers; + unsigned int numOutput0Buffers; }; Config config_; @@ -1401,6 +1402,7 @@ int PipelineHandlerRPi::configurePipelineHandler(RPiCameraData *data) config = { .minUnicamBuffers = 2, .minTotalUnicamBuffers = 4, + .numOutput0Buffers = 1, }; return 0; @@ -1485,12 +1487,19 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) * so allocate the minimum required to avoid frame drops. */ numBuffers = minBuffers; - } else { + } else if (stream == &data->isp_[Isp::Output0]) { /* * Since the ISP runs synchronous with the IPA and requests, - * we only ever need one set of internal buffers. Any buffers - * the application wants to hold onto will already be exported - * through PipelineHandlerRPi::exportFrameBuffers(). + * we only ever need a maximum of one internal buffer. Any + * buffers the application wants to hold onto will already + * be exported through PipelineHandlerRPi::exportFrameBuffers(). + */ + numBuffers = std::min(1u, data->config_.numOutput0Buffers); + } else { + /* + * Same reasoning as above, we only ever need a maximum + * of one internal buffer for Output1 (required for colour + * denoise) and ISP statistics. */ numBuffers = 1; }
Add a new config parameter numOutput0Buffers specifying the number of internally allocated ISP Output0 buffers. This parameter defaults to 1. Split out the buffer allocation logic so that the buffer count for ISP Output0 can be different from the ISP Output1 and Statistics streams. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> --- .../pipeline/raspberrypi/raspberrypi.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)