[libcamera-devel,v6,11/15] pipeline: raspberrypi: Add minimal memory usage config file
diff mbox series

Message ID 20230127154322.29019-12-naush@raspberrypi.com
State Superseded
Headers show
Series
  • [libcamera-devel,v6,01/15] libcamera: stream: Add stream hints to StreamConfiguration
Related show

Commit Message

Naushir Patuck Jan. 27, 2023, 3:43 p.m. UTC
Add a platform configuration file that allocates the least amount of
frame buffer memory possible. This configuration does come with the
following compromises:

- Startup frame drops are disabled, so the first few frames will not
have fully converged AE/AWB/ALSC applied.

- Applications must provide ISP Output0 and Unicam Image (if a RAW
stream is configured) buffers in requests.

- Only 1 Unicam Image buffer will be allocated if a RAW stream is not
configured, causing the framerate to be effectively halved.

To use the configuration on the Raspberry Pi platform, invoke the
application with the following prepended to the command line:

LIBCAMERA_RPI_CONFIG_FILE=/usr/local/share/libcamera/pipeline/raspberrypi/minimal_mem.yaml

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 .../pipeline/raspberrypi/data/meson.build     |  1 +
 .../raspberrypi/data/minimal_mem.yaml         | 37 +++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 src/libcamera/pipeline/raspberrypi/data/minimal_mem.yaml

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/data/meson.build b/src/libcamera/pipeline/raspberrypi/data/meson.build
index 1c70433bbcbc..6aecd8ae68c8 100644
--- a/src/libcamera/pipeline/raspberrypi/data/meson.build
+++ b/src/libcamera/pipeline/raspberrypi/data/meson.build
@@ -2,6 +2,7 @@ 
 
 conf_files = files([
     'example.yaml',
+    'minimal_mem.yaml',
 ])
 
 install_data(conf_files,
diff --git a/src/libcamera/pipeline/raspberrypi/data/minimal_mem.yaml b/src/libcamera/pipeline/raspberrypi/data/minimal_mem.yaml
new file mode 100644
index 000000000000..5e4906af7cfd
--- /dev/null
+++ b/src/libcamera/pipeline/raspberrypi/data/minimal_mem.yaml
@@ -0,0 +1,37 @@ 
+{
+        "version": 1.0,
+        "target": "bcm2835",
+
+        "pipeline_handler":
+        {
+                # The minimum number of internal buffers to be allocated for
+                # Unicam. This value must be greater than 0, but less than or
+                # equal to min_total_unicam_buffers.
+                #
+                # A larger number of internal buffers can reduce the occurrence
+                # of frame drops during high CPU loads, but might also cause
+                # additional latency in the system.
+                #
+                # Note that the pipeline handler might override this value and
+                # not allocate any internal buffers if it knows they will never
+                # be used. For example if the RAW stream is marked as mandatory
+                # and there are no dropped frames signalled for algorithm
+                # convergence.
+                #
+                "min_unicam_buffers": 0,
+
+                # The minimum total (internal + external) buffer count used for
+                # Unicam. The number of internal buffers allocated for Unicam is
+                # given by:
+                #
+                # internal buffer count = max(min_unicam_buffers,
+                #         min_total_unicam_buffers - external buffer count)
+                #
+                "min_total_unicam_buffers": 1,
+
+                # Override any request from the IPA to drop a number of startup
+                # frames.
+                #
+                "disable_startup_frame_drops": true
+        }
+}