pipeline: raspberrypi: Avoid over-allocation for ISP Output 1

The V4L2DeviceFormat structure for the ISP Output 1 node was a copy of what is
used ISP Output 0 node, but with the size changed. However, the plane size and
stride values were not updated. So there is a possibility that the buffer might
be over-sized for the requested resolution.

Fix this by only copying the relevant fields from the ISP Output 0
V4L2DeviceFormat structure, and let the device driver size the planes as needed.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Naushir Patuck
2022-03-25 09:08:56 +00:00
committed by Laurent Pinchart
parent 54398c1583
commit e96e9e6e1d

View File

@@ -845,11 +845,13 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
* colour denoise will not run.
*/
if (!output1Set) {
V4L2DeviceFormat output1Format = format;
V4L2DeviceFormat output1Format;
constexpr Size maxDimensions(1200, 1200);
const Size limit = maxDimensions.boundedToAspectRatio(format.size);
output1Format.size = (format.size / 2).boundedTo(limit).alignedDownTo(2, 2);
output1Format.colorSpace = format.colorSpace;
output1Format.fourcc = V4L2PixelFormat::fromPixelFormat(formats::YUV420);
LOG(RPI, Debug) << "Setting ISP Output1 (internal) to "
<< output1Format.toString();