Skip to content

[BUG] Memory allocation error getting modes (Trixie, Pi Zero 2 W) #1358

@grunkyb

Description

@grunkyb

Describe the bug

Memory allocation error when loading sensor modes in trixie (works in bookworm)

To Reproduce

from picamera2 import Picamera2

picam2 = Picamera2()
mode = picam2.sensor_modes  # fails in trixie (malloc)

Expected behaviour

Create a list of dictionaries. Below is the output from bookworm.

[{'format': SRGGB10_CSI2P, 'unpacked': 'SRGGB10', 'bit_depth': 10, 'size': (1332, 990), 'fps': 120.05, 'crop_limits': (696, 528, 2664, 1980), 'exposure_limits': (31, 667234896, 20000)}, {'format': SRGGB12_CSI2P, 'unpacked': 'SRGGB12', 'bit_depth': 12, 'size': (2028, 1080), 'fps': 50.03, 'crop_limits': (0, 440, 4056, 2160), 'exposure_limits': (60, 674181621, 20000)}, {'format': SRGGB12_CSI2P, 'unpacked': 'SRGGB12', 'bit_depth': 12, 'size': (2028, 1520), 'fps': 40.01, 'crop_limits': (0, 0, 4056, 3040), 'exposure_limits': (60, 674181621, 20000)}, {'format': SRGGB12_CSI2P, 'unpacked': 'SRGGB12', 'bit_depth': 12, 'size': (4056, 3040), 'fps': 10.0, 'crop_limits': (0, 0, 4056, 3040), 'exposure_limits': (114, 694422939, 20000)}]

Hardware :

OS: Debian GNU/Linux 12 (bookworm) aarch64
Host: Raspberry Pi Zero 2 W Rev 1.0
Kernel: 6.12.34+rpt-rpi-v8
CPU: (4) @ 1.000GHz
Memory: 76MiB / 416MiB 
Camera: Raspberry Pi HQ camera (IMX477)

Additional context

More camera modes appear on trixie than on bookworm and earlier version of Debian.

bookworm

$ rpicam-hello --list-cameras
Available cameras
-----------------
0 : imx477 [4056x3040 12-bit RGGB] (/base/soc/i2c0mux/i2c@1/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [120.05 fps - (696, 528)/2664x1980 crop]
           'SRGGB12_CSI2P' : 2028x1080 [50.03 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [40.01 fps - (0, 0)/4056x3040 crop]
                             4056x3040 [10.00 fps - (0, 0)/4056x3040 crop]

trixie

$ rpicam-hello --list-cameras
Available cameras
-----------------
0 : imx477 [4056x3040 12-bit RGGB] (/base/soc/i2c0mux/i2c@1/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [120.50 fps - (696, 528)/2664x1980 crop]
                             2028x1080 [74.74 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [53.77 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [19.58 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [14.00 fps - (0, 0)/4056x3040 crop]
           'SRGGB12_CSI2P' : 1332x990 [101.68 fps - (696, 528)/2664x1980 crop]
                             2028x1080 [62.81 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [45.19 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [16.39 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [11.72 fps - (0, 0)/4056x3040 crop]
           'SRGGB8' : 1332x990 [147.91 fps - (696, 528)/2664x1980 crop]
                      2028x1080 [92.27 fps - (0, 440)/4056x2160 crop]
                      2028x1520 [66.38 fps - (0, 0)/4056x3040 crop]
                      4056x2160 [24.32 fps - (0, 440)/4056x3040 crop]
                      4056x3040 [17.39 fps - (0, 0)/4056x3040 crop]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions