[RFC,v2,0/7] C++20 migration
mbox series

Message ID 20260323102724.1385487-1-barnabas.pocze@ideasonboard.com
Headers show
Series
  • C++20 migration
Related show

Message

Barnabás Pőcze March 23, 2026, 10:27 a.m. UTC
With gcc 16 switching C++20 by default, and it being released for more
than five years now, this is a proof of concept patch set containing the
changes needed to make the current CI jobs succeed with cpp_std=c++20.

There is still at least one issue that seemingly only appears in C++20:
https://gitlab.freedesktop.org/camera/libcamera/-/issues/267
the cause is not known, but a potential workaround has been merged.

The last two patches drop the use of `libcamera::Span` in favor of
`std::span`. However, gcc 9 does not have an implementation, so those
two cannot be merged as is.

Barnabás Pőcze (7):
  gstreamer: Add `-Wno-volatile` for GCC
  meson: Ignore `Wredundant-move` with GCC 11 and above
  libcamera: base: log: Ignore deprecations
  treewide: Use character literal instead of string in some cases
  meson: Switch to C++20
  treewide: Use `std::span`
  libcamera: base: span: Deprecate it

 Documentation/guides/pipeline-handler.rst     |  4 +-
 include/libcamera/base/file.h                 | 10 ++--
 include/libcamera/base/span.h                 | 16 +++----
 include/libcamera/base/thread.h               |  4 +-
 include/libcamera/camera.h                    |  5 +-
 include/libcamera/controls.h                  | 22 ++++++---
 include/libcamera/framebuffer.h               | 10 ++--
 .../libcamera/internal/byte_stream_buffer.h   |  6 +--
 include/libcamera/internal/camera_sensor.h    |  6 +--
 .../converter/converter_dw100_vertexmap.h     |  5 +-
 include/libcamera/internal/egl.h              |  8 ++--
 include/libcamera/internal/framebuffer.h      |  4 +-
 .../libcamera/internal/mapped_framebuffer.h   |  4 +-
 include/libcamera/internal/matrix.h           | 26 +++++-----
 include/libcamera/internal/pipeline_handler.h |  2 +-
 include/libcamera/internal/process.h          |  6 +--
 include/libcamera/internal/pub_key.h          |  7 ++-
 .../libcamera/internal/shared_mem_object.h    |  6 +--
 include/libcamera/internal/v4l2_device.h      |  6 +--
 include/libcamera/internal/vector.h           |  4 +-
 meson.build                                   | 23 ++++-----
 src/android/camera_buffer.h                   | 11 +++--
 src/android/camera_capabilities.cpp           |  4 +-
 src/android/camera_request.cpp                |  4 +-
 src/android/jpeg/encoder.h                    |  4 +-
 src/android/jpeg/encoder_jea.cpp              |  2 +-
 src/android/jpeg/encoder_jea.h                |  2 +-
 src/android/jpeg/encoder_libjpeg.cpp          | 10 ++--
 src/android/jpeg/encoder_libjpeg.h            | 12 ++---
 src/android/jpeg/exif.cpp                     |  2 +-
 src/android/jpeg/exif.h                       |  7 ++-
 src/android/jpeg/post_processor_jpeg.cpp      |  2 +-
 src/android/mm/cros_camera_buffer.cpp         |  4 +-
 .../mm/cros_frame_buffer_allocator.cpp        |  2 +-
 src/android/mm/generic_camera_buffer.cpp      |  4 +-
 .../mm/generic_frame_buffer_allocator.cpp     |  2 +-
 src/apps/cam/capture_script.cpp               | 12 ++---
 src/apps/cam/drm.cpp                          |  6 +--
 src/apps/cam/drm.h                            |  4 +-
 src/apps/cam/file_sink.cpp                    |  2 +-
 src/apps/cam/sdl_sink.cpp                     |  4 +-
 src/apps/cam/sdl_texture.h                    |  4 +-
 src/apps/cam/sdl_texture_1plane.cpp           |  2 +-
 src/apps/cam/sdl_texture_1plane.h             |  2 +-
 src/apps/cam/sdl_texture_mjpg.cpp             |  4 +-
 src/apps/cam/sdl_texture_mjpg.h               |  4 +-
 src/apps/cam/sdl_texture_yuv.cpp              |  2 +-
 src/apps/cam/sdl_texture_yuv.h                |  2 +-
 src/apps/common/dng_writer.cpp                |  4 +-
 src/apps/common/image.cpp                     |  6 +--
 src/apps/common/image.h                       | 10 ++--
 src/apps/common/ppm_writer.cpp                |  2 +-
 src/apps/common/ppm_writer.h                  |  4 +-
 src/apps/ipa-verify/main.cpp                  |  4 +-
 src/apps/lc-compliance/helpers/capture.cpp    |  2 +-
 src/apps/lc-compliance/helpers/capture.h      |  2 +-
 src/gstreamer/gstlibcamera-controls.cpp.in    |  4 +-
 src/gstreamer/gstlibcamera-utils.cpp          | 20 ++++----
 src/gstreamer/meson.build                     |  7 +++
 src/ipa/ipu3/algorithms/af.cpp                |  8 ++--
 src/ipa/ipu3/algorithms/af.h                  |  2 +-
 src/ipa/ipu3/algorithms/agc.cpp               |  2 +-
 src/ipa/ipu3/ipu3.cpp                         |  8 ++--
 src/ipa/libipa/exposure_mode_helper.cpp       |  2 +-
 src/ipa/libipa/exposure_mode_helper.h         |  4 +-
 src/ipa/libipa/histogram.cpp                  |  4 +-
 src/ipa/libipa/histogram.h                    |  8 ++--
 src/ipa/libipa/lsc_polynomial.h               |  2 +-
 src/ipa/libipa/v4l2_params.cpp                |  2 +-
 src/ipa/libipa/v4l2_params.h                  | 20 ++++----
 src/ipa/mali-c55/algorithms/agc.cpp           | 10 ++--
 src/ipa/mali-c55/mali-c55.cpp                 |  4 +-
 src/ipa/mali-c55/params.h                     |  2 +-
 src/ipa/rkisp1/algorithms/agc.cpp             |  2 +-
 src/ipa/rkisp1/algorithms/agc.h               |  7 +--
 src/ipa/rkisp1/algorithms/awb.cpp             |  2 +-
 src/ipa/rkisp1/algorithms/lsc.cpp             | 24 +++++-----
 src/ipa/rkisp1/algorithms/lsc.h               |  4 +-
 src/ipa/rkisp1/params.cpp                     |  2 +-
 src/ipa/rkisp1/params.h                       |  8 ++--
 src/ipa/rkisp1/rkisp1.cpp                     |  2 +-
 src/ipa/rpi/cam_helper/cam_helper.cpp         |  4 +-
 src/ipa/rpi/cam_helper/cam_helper.h           |  6 +--
 src/ipa/rpi/cam_helper/cam_helper_imx477.cpp  |  4 +-
 src/ipa/rpi/cam_helper/cam_helper_imx519.cpp  |  4 +-
 src/ipa/rpi/cam_helper/cam_helper_imx708.cpp  |  4 +-
 src/ipa/rpi/cam_helper/md_parser.h            |  9 ++--
 src/ipa/rpi/cam_helper/md_parser_smia.cpp     |  4 +-
 src/ipa/rpi/common/ipa_base.cpp               | 20 ++++----
 src/ipa/rpi/common/ipa_base.h                 |  2 +-
 src/ipa/rpi/controller/af_algorithm.h         |  5 +-
 src/ipa/rpi/controller/rpi/af.cpp             |  2 +-
 src/ipa/rpi/controller/rpi/af.h               |  2 +-
 src/ipa/rpi/controller/rpi/alsc.cpp           |  2 +-
 src/ipa/rpi/pisp/pisp.cpp                     | 12 +++--
 src/ipa/rpi/vc4/vc4.cpp                       | 48 ++++++++++---------
 src/libcamera/base/backtrace.cpp              |  8 ++--
 src/libcamera/base/file.cpp                   |  6 +--
 src/libcamera/base/log.cpp                    | 17 ++++---
 src/libcamera/base/thread.cpp                 |  2 +-
 src/libcamera/byte_stream_buffer.cpp          |  4 +-
 src/libcamera/camera.cpp                      |  2 +-
 src/libcamera/control_serializer.cpp          |  2 +-
 src/libcamera/controls.cpp                    | 22 ++++-----
 src/libcamera/converter/converter_dw100.cpp   |  2 +-
 .../converter/converter_dw100_vertexmap.cpp   |  4 +-
 src/libcamera/egl.cpp                         |  6 +--
 src/libcamera/framebuffer.cpp                 |  6 +--
 src/libcamera/ipa_manager.cpp                 |  2 +-
 src/libcamera/ipa_module.cpp                  | 16 +++----
 src/libcamera/mapped_framebuffer.cpp          |  2 +-
 src/libcamera/matrix.cpp                      | 26 +++++-----
 src/libcamera/media_pipeline.cpp              |  6 +--
 src/libcamera/pipeline/imx8-isi/imx8-isi.cpp  |  4 +-
 src/libcamera/pipeline/ipu3/ipu3.cpp          |  6 +--
 src/libcamera/pipeline/mali-c55/mali-c55.cpp  |  6 +--
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  6 +--
 src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |  2 +-
 src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  6 +--
 .../pipeline/rpi/common/pipeline_base.cpp     | 12 ++---
 .../pipeline/rpi/common/pipeline_base.h       |  2 +-
 src/libcamera/pipeline/rpi/pisp/pisp.cpp      |  4 +-
 src/libcamera/pipeline/rpi/vc4/vc4.cpp        |  2 +-
 src/libcamera/pipeline/simple/simple.cpp      | 10 ++--
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  6 +--
 src/libcamera/pipeline/vimc/vimc.cpp          |  6 +--
 src/libcamera/pipeline/virtual/virtual.cpp    |  6 +--
 src/libcamera/process.cpp                     |  4 +-
 src/libcamera/pub_key.cpp                     |  6 +--
 src/libcamera/sensor/camera_sensor_legacy.cpp |  8 ++--
 src/libcamera/sensor/camera_sensor_raw.cpp    |  8 ++--
 src/libcamera/shared_mem_object.cpp           |  2 +-
 src/libcamera/v4l2_device.cpp                 | 14 +++---
 src/libcamera/v4l2_videodevice.cpp            |  6 +--
 src/libcamera/vector.cpp                      |  2 +-
 src/libcamera/yaml_parser.cpp                 |  2 +-
 src/py/libcamera/py_helpers.cpp               |  2 +-
 src/py/libcamera/py_main.cpp                  |  4 +-
 src/v4l2/v4l2_camera_proxy.cpp                |  2 +-
 src/v4l2/v4l2_compat_manager.cpp              |  4 +-
 test/controls/control_value.cpp               | 28 +++++------
 test/file.cpp                                 |  2 +-
 test/span.cpp                                 |  1 +
 test/utils.cpp                                |  4 +-
 test/v4l2_videodevice/controls.cpp            |  4 +-
 utils/codegen/controls.py                     |  4 +-
 utils/gen-debug-controls.py                   |  4 +-
 147 files changed, 487 insertions(+), 461 deletions(-)

--
2.53.0

Comments

Kieran Bingham March 23, 2026, 5:10 p.m. UTC | #1
Quoting Barnabás Pőcze (2026-03-23 10:27:17)
> With gcc 16 switching C++20 by default, and it being released for more
> than five years now, this is a proof of concept patch set containing the
> changes needed to make the current CI jobs succeed with cpp_std=c++20.
> 
> There is still at least one issue that seemingly only appears in C++20:
> https://gitlab.freedesktop.org/camera/libcamera/-/issues/267
> the cause is not known, but a potential workaround has been merged.
> 
> The last two patches drop the use of `libcamera::Span` in favor of
> `std::span`. However, gcc 9 does not have an implementation, so those
> two cannot be merged as is.

Perhaps we should consider merging the first 5 patches already then to
support with the migration?

Can we in anyway 'alias' std::span to libcamera::Span for gcc-9, so we
could already move forwards ? or would that get too messy ?

> 
> Barnabás Pőcze (7):
>   gstreamer: Add `-Wno-volatile` for GCC
>   meson: Ignore `Wredundant-move` with GCC 11 and above
>   libcamera: base: log: Ignore deprecations
>   treewide: Use character literal instead of string in some cases
>   meson: Switch to C++20
>   treewide: Use `std::span`
>   libcamera: base: span: Deprecate it
> 
>  Documentation/guides/pipeline-handler.rst     |  4 +-
>  include/libcamera/base/file.h                 | 10 ++--
>  include/libcamera/base/span.h                 | 16 +++----
>  include/libcamera/base/thread.h               |  4 +-
>  include/libcamera/camera.h                    |  5 +-
>  include/libcamera/controls.h                  | 22 ++++++---
>  include/libcamera/framebuffer.h               | 10 ++--
>  .../libcamera/internal/byte_stream_buffer.h   |  6 +--
>  include/libcamera/internal/camera_sensor.h    |  6 +--
>  .../converter/converter_dw100_vertexmap.h     |  5 +-
>  include/libcamera/internal/egl.h              |  8 ++--
>  include/libcamera/internal/framebuffer.h      |  4 +-
>  .../libcamera/internal/mapped_framebuffer.h   |  4 +-
>  include/libcamera/internal/matrix.h           | 26 +++++-----
>  include/libcamera/internal/pipeline_handler.h |  2 +-
>  include/libcamera/internal/process.h          |  6 +--
>  include/libcamera/internal/pub_key.h          |  7 ++-
>  .../libcamera/internal/shared_mem_object.h    |  6 +--
>  include/libcamera/internal/v4l2_device.h      |  6 +--
>  include/libcamera/internal/vector.h           |  4 +-
>  meson.build                                   | 23 ++++-----
>  src/android/camera_buffer.h                   | 11 +++--
>  src/android/camera_capabilities.cpp           |  4 +-
>  src/android/camera_request.cpp                |  4 +-
>  src/android/jpeg/encoder.h                    |  4 +-
>  src/android/jpeg/encoder_jea.cpp              |  2 +-
>  src/android/jpeg/encoder_jea.h                |  2 +-
>  src/android/jpeg/encoder_libjpeg.cpp          | 10 ++--
>  src/android/jpeg/encoder_libjpeg.h            | 12 ++---
>  src/android/jpeg/exif.cpp                     |  2 +-
>  src/android/jpeg/exif.h                       |  7 ++-
>  src/android/jpeg/post_processor_jpeg.cpp      |  2 +-
>  src/android/mm/cros_camera_buffer.cpp         |  4 +-
>  .../mm/cros_frame_buffer_allocator.cpp        |  2 +-
>  src/android/mm/generic_camera_buffer.cpp      |  4 +-
>  .../mm/generic_frame_buffer_allocator.cpp     |  2 +-
>  src/apps/cam/capture_script.cpp               | 12 ++---
>  src/apps/cam/drm.cpp                          |  6 +--
>  src/apps/cam/drm.h                            |  4 +-
>  src/apps/cam/file_sink.cpp                    |  2 +-
>  src/apps/cam/sdl_sink.cpp                     |  4 +-
>  src/apps/cam/sdl_texture.h                    |  4 +-
>  src/apps/cam/sdl_texture_1plane.cpp           |  2 +-
>  src/apps/cam/sdl_texture_1plane.h             |  2 +-
>  src/apps/cam/sdl_texture_mjpg.cpp             |  4 +-
>  src/apps/cam/sdl_texture_mjpg.h               |  4 +-
>  src/apps/cam/sdl_texture_yuv.cpp              |  2 +-
>  src/apps/cam/sdl_texture_yuv.h                |  2 +-
>  src/apps/common/dng_writer.cpp                |  4 +-
>  src/apps/common/image.cpp                     |  6 +--
>  src/apps/common/image.h                       | 10 ++--
>  src/apps/common/ppm_writer.cpp                |  2 +-
>  src/apps/common/ppm_writer.h                  |  4 +-
>  src/apps/ipa-verify/main.cpp                  |  4 +-
>  src/apps/lc-compliance/helpers/capture.cpp    |  2 +-
>  src/apps/lc-compliance/helpers/capture.h      |  2 +-
>  src/gstreamer/gstlibcamera-controls.cpp.in    |  4 +-
>  src/gstreamer/gstlibcamera-utils.cpp          | 20 ++++----
>  src/gstreamer/meson.build                     |  7 +++
>  src/ipa/ipu3/algorithms/af.cpp                |  8 ++--
>  src/ipa/ipu3/algorithms/af.h                  |  2 +-
>  src/ipa/ipu3/algorithms/agc.cpp               |  2 +-
>  src/ipa/ipu3/ipu3.cpp                         |  8 ++--
>  src/ipa/libipa/exposure_mode_helper.cpp       |  2 +-
>  src/ipa/libipa/exposure_mode_helper.h         |  4 +-
>  src/ipa/libipa/histogram.cpp                  |  4 +-
>  src/ipa/libipa/histogram.h                    |  8 ++--
>  src/ipa/libipa/lsc_polynomial.h               |  2 +-
>  src/ipa/libipa/v4l2_params.cpp                |  2 +-
>  src/ipa/libipa/v4l2_params.h                  | 20 ++++----
>  src/ipa/mali-c55/algorithms/agc.cpp           | 10 ++--
>  src/ipa/mali-c55/mali-c55.cpp                 |  4 +-
>  src/ipa/mali-c55/params.h                     |  2 +-
>  src/ipa/rkisp1/algorithms/agc.cpp             |  2 +-
>  src/ipa/rkisp1/algorithms/agc.h               |  7 +--
>  src/ipa/rkisp1/algorithms/awb.cpp             |  2 +-
>  src/ipa/rkisp1/algorithms/lsc.cpp             | 24 +++++-----
>  src/ipa/rkisp1/algorithms/lsc.h               |  4 +-
>  src/ipa/rkisp1/params.cpp                     |  2 +-
>  src/ipa/rkisp1/params.h                       |  8 ++--
>  src/ipa/rkisp1/rkisp1.cpp                     |  2 +-
>  src/ipa/rpi/cam_helper/cam_helper.cpp         |  4 +-
>  src/ipa/rpi/cam_helper/cam_helper.h           |  6 +--
>  src/ipa/rpi/cam_helper/cam_helper_imx477.cpp  |  4 +-
>  src/ipa/rpi/cam_helper/cam_helper_imx519.cpp  |  4 +-
>  src/ipa/rpi/cam_helper/cam_helper_imx708.cpp  |  4 +-
>  src/ipa/rpi/cam_helper/md_parser.h            |  9 ++--
>  src/ipa/rpi/cam_helper/md_parser_smia.cpp     |  4 +-
>  src/ipa/rpi/common/ipa_base.cpp               | 20 ++++----
>  src/ipa/rpi/common/ipa_base.h                 |  2 +-
>  src/ipa/rpi/controller/af_algorithm.h         |  5 +-
>  src/ipa/rpi/controller/rpi/af.cpp             |  2 +-
>  src/ipa/rpi/controller/rpi/af.h               |  2 +-
>  src/ipa/rpi/controller/rpi/alsc.cpp           |  2 +-
>  src/ipa/rpi/pisp/pisp.cpp                     | 12 +++--
>  src/ipa/rpi/vc4/vc4.cpp                       | 48 ++++++++++---------
>  src/libcamera/base/backtrace.cpp              |  8 ++--
>  src/libcamera/base/file.cpp                   |  6 +--
>  src/libcamera/base/log.cpp                    | 17 ++++---
>  src/libcamera/base/thread.cpp                 |  2 +-
>  src/libcamera/byte_stream_buffer.cpp          |  4 +-
>  src/libcamera/camera.cpp                      |  2 +-
>  src/libcamera/control_serializer.cpp          |  2 +-
>  src/libcamera/controls.cpp                    | 22 ++++-----
>  src/libcamera/converter/converter_dw100.cpp   |  2 +-
>  .../converter/converter_dw100_vertexmap.cpp   |  4 +-
>  src/libcamera/egl.cpp                         |  6 +--
>  src/libcamera/framebuffer.cpp                 |  6 +--
>  src/libcamera/ipa_manager.cpp                 |  2 +-
>  src/libcamera/ipa_module.cpp                  | 16 +++----
>  src/libcamera/mapped_framebuffer.cpp          |  2 +-
>  src/libcamera/matrix.cpp                      | 26 +++++-----
>  src/libcamera/media_pipeline.cpp              |  6 +--
>  src/libcamera/pipeline/imx8-isi/imx8-isi.cpp  |  4 +-
>  src/libcamera/pipeline/ipu3/ipu3.cpp          |  6 +--
>  src/libcamera/pipeline/mali-c55/mali-c55.cpp  |  6 +--
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  6 +--
>  src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |  2 +-
>  src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  6 +--
>  .../pipeline/rpi/common/pipeline_base.cpp     | 12 ++---
>  .../pipeline/rpi/common/pipeline_base.h       |  2 +-
>  src/libcamera/pipeline/rpi/pisp/pisp.cpp      |  4 +-
>  src/libcamera/pipeline/rpi/vc4/vc4.cpp        |  2 +-
>  src/libcamera/pipeline/simple/simple.cpp      | 10 ++--
>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  6 +--
>  src/libcamera/pipeline/vimc/vimc.cpp          |  6 +--
>  src/libcamera/pipeline/virtual/virtual.cpp    |  6 +--
>  src/libcamera/process.cpp                     |  4 +-
>  src/libcamera/pub_key.cpp                     |  6 +--
>  src/libcamera/sensor/camera_sensor_legacy.cpp |  8 ++--
>  src/libcamera/sensor/camera_sensor_raw.cpp    |  8 ++--
>  src/libcamera/shared_mem_object.cpp           |  2 +-
>  src/libcamera/v4l2_device.cpp                 | 14 +++---
>  src/libcamera/v4l2_videodevice.cpp            |  6 +--
>  src/libcamera/vector.cpp                      |  2 +-
>  src/libcamera/yaml_parser.cpp                 |  2 +-
>  src/py/libcamera/py_helpers.cpp               |  2 +-
>  src/py/libcamera/py_main.cpp                  |  4 +-
>  src/v4l2/v4l2_camera_proxy.cpp                |  2 +-
>  src/v4l2/v4l2_compat_manager.cpp              |  4 +-
>  test/controls/control_value.cpp               | 28 +++++------
>  test/file.cpp                                 |  2 +-
>  test/span.cpp                                 |  1 +
>  test/utils.cpp                                |  4 +-
>  test/v4l2_videodevice/controls.cpp            |  4 +-
>  utils/codegen/controls.py                     |  4 +-
>  utils/gen-debug-controls.py                   |  4 +-
>  147 files changed, 487 insertions(+), 461 deletions(-)
> 
> --
> 2.53.0
Laurent Pinchart March 26, 2026, 3:31 p.m. UTC | #2
Hi Barnabás,

Thank you for the patch.

On Mon, Mar 23, 2026 at 11:27:23AM +0100, Barnabás Pőcze wrote:
> Now that C++20 is used, convert everything to use `std::span` instead of
> `libcamera::Span`.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>  Documentation/guides/pipeline-handler.rst     |  4 +-
>  include/libcamera/base/file.h                 | 10 ++--
>  include/libcamera/base/span.h                 | 12 ++---
>  include/libcamera/base/thread.h               |  4 +-
>  include/libcamera/camera.h                    |  5 +-
>  include/libcamera/controls.h                  | 22 ++++++---
>  include/libcamera/framebuffer.h               | 10 ++--
>  .../libcamera/internal/byte_stream_buffer.h   |  6 +--
>  include/libcamera/internal/camera_sensor.h    |  6 +--
>  .../converter/converter_dw100_vertexmap.h     |  5 +-
>  include/libcamera/internal/egl.h              |  8 ++--
>  include/libcamera/internal/framebuffer.h      |  4 +-
>  .../libcamera/internal/mapped_framebuffer.h   |  4 +-
>  include/libcamera/internal/matrix.h           | 26 +++++-----
>  include/libcamera/internal/pipeline_handler.h |  2 +-
>  include/libcamera/internal/process.h          |  6 +--
>  include/libcamera/internal/pub_key.h          |  7 ++-
>  .../libcamera/internal/shared_mem_object.h    |  6 +--
>  include/libcamera/internal/v4l2_device.h      |  6 +--
>  include/libcamera/internal/vector.h           |  4 +-
>  src/android/camera_buffer.h                   | 11 +++--
>  src/android/camera_capabilities.cpp           |  4 +-
>  src/android/camera_request.cpp                |  4 +-
>  src/android/jpeg/encoder.h                    |  4 +-
>  src/android/jpeg/encoder_jea.cpp              |  2 +-
>  src/android/jpeg/encoder_jea.h                |  2 +-
>  src/android/jpeg/encoder_libjpeg.cpp          | 10 ++--
>  src/android/jpeg/encoder_libjpeg.h            | 12 ++---
>  src/android/jpeg/exif.cpp                     |  2 +-
>  src/android/jpeg/exif.h                       |  7 ++-
>  src/android/jpeg/post_processor_jpeg.cpp      |  2 +-
>  src/android/mm/cros_camera_buffer.cpp         |  4 +-
>  .../mm/cros_frame_buffer_allocator.cpp        |  2 +-
>  src/android/mm/generic_camera_buffer.cpp      |  4 +-
>  .../mm/generic_frame_buffer_allocator.cpp     |  2 +-
>  src/apps/cam/capture_script.cpp               | 12 ++---
>  src/apps/cam/drm.cpp                          |  6 +--
>  src/apps/cam/drm.h                            |  4 +-
>  src/apps/cam/file_sink.cpp                    |  2 +-
>  src/apps/cam/sdl_sink.cpp                     |  4 +-
>  src/apps/cam/sdl_texture.h                    |  4 +-
>  src/apps/cam/sdl_texture_1plane.cpp           |  2 +-
>  src/apps/cam/sdl_texture_1plane.h             |  2 +-
>  src/apps/cam/sdl_texture_mjpg.cpp             |  4 +-
>  src/apps/cam/sdl_texture_mjpg.h               |  4 +-
>  src/apps/cam/sdl_texture_yuv.cpp              |  2 +-
>  src/apps/cam/sdl_texture_yuv.h                |  2 +-
>  src/apps/common/dng_writer.cpp                |  4 +-
>  src/apps/common/image.cpp                     |  6 +--
>  src/apps/common/image.h                       | 10 ++--
>  src/apps/common/ppm_writer.cpp                |  2 +-
>  src/apps/common/ppm_writer.h                  |  4 +-
>  src/apps/ipa-verify/main.cpp                  |  4 +-
>  src/apps/lc-compliance/helpers/capture.cpp    |  2 +-
>  src/apps/lc-compliance/helpers/capture.h      |  2 +-
>  src/gstreamer/gstlibcamera-controls.cpp.in    |  4 +-
>  src/gstreamer/gstlibcamera-utils.cpp          | 20 ++++----
>  src/ipa/ipu3/algorithms/af.cpp                |  8 ++--
>  src/ipa/ipu3/algorithms/af.h                  |  2 +-
>  src/ipa/ipu3/algorithms/agc.cpp               |  2 +-
>  src/ipa/ipu3/ipu3.cpp                         |  8 ++--
>  src/ipa/libipa/exposure_mode_helper.cpp       |  2 +-
>  src/ipa/libipa/exposure_mode_helper.h         |  4 +-
>  src/ipa/libipa/histogram.cpp                  |  4 +-
>  src/ipa/libipa/histogram.h                    |  8 ++--
>  src/ipa/libipa/lsc_polynomial.h               |  2 +-
>  src/ipa/libipa/v4l2_params.cpp                |  2 +-
>  src/ipa/libipa/v4l2_params.h                  | 20 ++++----
>  src/ipa/mali-c55/algorithms/agc.cpp           | 10 ++--
>  src/ipa/mali-c55/mali-c55.cpp                 |  4 +-
>  src/ipa/mali-c55/params.h                     |  2 +-
>  src/ipa/rkisp1/algorithms/agc.cpp             |  2 +-
>  src/ipa/rkisp1/algorithms/agc.h               |  7 +--
>  src/ipa/rkisp1/algorithms/awb.cpp             |  2 +-
>  src/ipa/rkisp1/algorithms/lsc.cpp             | 24 +++++-----
>  src/ipa/rkisp1/algorithms/lsc.h               |  4 +-
>  src/ipa/rkisp1/params.cpp                     |  2 +-
>  src/ipa/rkisp1/params.h                       |  8 ++--
>  src/ipa/rkisp1/rkisp1.cpp                     |  2 +-
>  src/ipa/rpi/cam_helper/cam_helper.cpp         |  4 +-
>  src/ipa/rpi/cam_helper/cam_helper.h           |  6 +--
>  src/ipa/rpi/cam_helper/cam_helper_imx477.cpp  |  4 +-
>  src/ipa/rpi/cam_helper/cam_helper_imx519.cpp  |  4 +-
>  src/ipa/rpi/cam_helper/cam_helper_imx708.cpp  |  4 +-
>  src/ipa/rpi/cam_helper/md_parser.h            |  9 ++--
>  src/ipa/rpi/cam_helper/md_parser_smia.cpp     |  4 +-
>  src/ipa/rpi/common/ipa_base.cpp               | 20 ++++----
>  src/ipa/rpi/common/ipa_base.h                 |  2 +-
>  src/ipa/rpi/controller/af_algorithm.h         |  5 +-
>  src/ipa/rpi/controller/rpi/af.cpp             |  2 +-
>  src/ipa/rpi/controller/rpi/af.h               |  2 +-
>  src/ipa/rpi/controller/rpi/alsc.cpp           |  2 +-
>  src/ipa/rpi/pisp/pisp.cpp                     | 12 +++--
>  src/ipa/rpi/vc4/vc4.cpp                       | 48 ++++++++++---------
>  src/libcamera/base/backtrace.cpp              |  8 ++--
>  src/libcamera/base/file.cpp                   |  6 +--
>  src/libcamera/base/thread.cpp                 |  2 +-
>  src/libcamera/byte_stream_buffer.cpp          |  4 +-
>  src/libcamera/camera.cpp                      |  2 +-
>  src/libcamera/control_serializer.cpp          |  2 +-
>  src/libcamera/controls.cpp                    | 22 ++++-----
>  src/libcamera/converter/converter_dw100.cpp   |  2 +-
>  .../converter/converter_dw100_vertexmap.cpp   |  4 +-
>  src/libcamera/egl.cpp                         |  6 +--
>  src/libcamera/framebuffer.cpp                 |  6 +--
>  src/libcamera/ipa_manager.cpp                 |  2 +-
>  src/libcamera/ipa_module.cpp                  | 16 +++----
>  src/libcamera/mapped_framebuffer.cpp          |  2 +-
>  src/libcamera/matrix.cpp                      | 26 +++++-----
>  src/libcamera/pipeline/imx8-isi/imx8-isi.cpp  |  4 +-
>  src/libcamera/pipeline/ipu3/ipu3.cpp          |  6 +--
>  src/libcamera/pipeline/mali-c55/mali-c55.cpp  |  6 +--
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  6 +--
>  src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |  2 +-
>  src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  6 +--
>  .../pipeline/rpi/common/pipeline_base.cpp     | 12 ++---
>  .../pipeline/rpi/common/pipeline_base.h       |  2 +-
>  src/libcamera/pipeline/rpi/pisp/pisp.cpp      |  4 +-
>  src/libcamera/pipeline/rpi/vc4/vc4.cpp        |  2 +-
>  src/libcamera/pipeline/simple/simple.cpp      |  4 +-
>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  6 +--
>  src/libcamera/pipeline/vimc/vimc.cpp          |  6 +--
>  src/libcamera/pipeline/virtual/virtual.cpp    |  6 +--
>  src/libcamera/process.cpp                     |  4 +-
>  src/libcamera/pub_key.cpp                     |  6 +--
>  src/libcamera/sensor/camera_sensor_legacy.cpp |  8 ++--
>  src/libcamera/sensor/camera_sensor_raw.cpp    |  8 ++--
>  src/libcamera/shared_mem_object.cpp           |  2 +-
>  src/libcamera/v4l2_device.cpp                 | 14 +++---
>  src/libcamera/v4l2_videodevice.cpp            |  6 +--
>  src/libcamera/vector.cpp                      |  2 +-
>  src/libcamera/yaml_parser.cpp                 |  2 +-
>  src/py/libcamera/py_helpers.cpp               |  2 +-
>  src/py/libcamera/py_main.cpp                  |  4 +-
>  src/v4l2/v4l2_camera_proxy.cpp                |  2 +-
>  src/v4l2/v4l2_compat_manager.cpp              |  4 +-
>  test/controls/control_value.cpp               | 28 +++++------
>  test/file.cpp                                 |  2 +-
>  test/utils.cpp                                |  4 +-
>  test/v4l2_videodevice/controls.cpp            |  4 +-
>  utils/codegen/controls.py                     |  4 +-
>  utils/gen-debug-controls.py                   |  4 +-
>  142 files changed, 448 insertions(+), 436 deletions(-)

There are still a few occurrences of Span in the code base that I think
need to be addressed. The following occurrences can I think just be
replaced with 'std::span':

src/ipa/rpi/controller/rpi/awb_nn.cpp:  return "[" + utils::join(Span(dims, dimsSize), ",") + "]";
src/libcamera/ipa_data_serializer.cpp: * \todo Switch to Span instead of byte and fd vector
src/libcamera/mapped_framebuffer.cpp: * The MappedBuffer::Plane uses the Span interface to describe the mapped memory
src/libcamera/matrix.cpp: * \return Row \a i from the matrix, as a Span
utils/gen-debug-controls.py:                    if m.type is not None and m.type.startswith('Span'):

The following ones could be replaced by either 'std::span' or 'span':

src/libcamera/matrix.cpp: * \a data is a one-dimensional Span and will be turned into a matrix in
src/libcamera/matrix.cpp: * This operator[] returns a Span, which can then be indexed into again with
src/libcamera/matrix.cpp: * matrix. Note that the lifetime of the Span returned by this first-level
src/libcamera/matrix.cpp: * to save the Span that is the result of this operator[].
src/libcamera/shared_mem_object.cpp: * fails, the function returns an empty Span. This can be also checked using the
src/libcamera/shared_mem_object.cpp: * \return The memory buffer, or an empty Span if allocation failed

These should probably drop the type name as they're redundant (doxygen
shows types in the generated documentation):

src/libcamera/byte_stream_buffer.cpp: * \brief Read data from the managed memory buffer into Span \a data
src/libcamera/byte_stream_buffer.cpp: * \param[out] data Span representing the destination memory
src/libcamera/egl.cpp: * \param[in] shaderEnv Span of preprocessor definitions to prepend
src/libcamera/egl.cpp: * \param[in] shaderEnv Span of preprocessor definitions to prepend
src/libcamera/egl.cpp: * \param[in] shaderEnv Span of preprocessor definitions to prepend

would become

src/libcamera/byte_stream_buffer.cpp: * \brief Read data from the managed memory buffer into \a data
src/libcamera/byte_stream_buffer.cpp: * \param[out] data The destination memory
src/libcamera/egl.cpp: * \param[in] shaderEnv Preprocessor definitions to prepend
src/libcamera/egl.cpp: * \param[in] shaderEnv Preprocessor definitions to prepend
src/libcamera/egl.cpp: * \param[in] shaderEnv Preprocessor definitions to prepend

Finally, thare are two occurrences in control yaml files:

src/libcamera/control_ids_rpi.yaml:        Span of the BCM2835 ISP generated statistics for the current frame.
src/libcamera/control_ids_rpi.yaml:        Span of the PiSP Frontend ISP generated statistics for the current

I'd just drop "Span of" here too.
Barnabás Pőcze March 27, 2026, 8:28 a.m. UTC | #3
2026. 03. 23. 18:10 keltezéssel, Kieran Bingham írta:
> Quoting Barnabás Pőcze (2026-03-23 10:27:17)
>> With gcc 16 switching C++20 by default, and it being released for more
>> than five years now, this is a proof of concept patch set containing the
>> changes needed to make the current CI jobs succeed with cpp_std=c++20.
>>
>> There is still at least one issue that seemingly only appears in C++20:
>> https://gitlab.freedesktop.org/camera/libcamera/-/issues/267
>> the cause is not known, but a potential workaround has been merged.
>>
>> The last two patches drop the use of `libcamera::Span` in favor of
>> `std::span`. However, gcc 9 does not have an implementation, so those
>> two cannot be merged as is.
> 
> Perhaps we should consider merging the first 5 patches already then to
> support with the migration?
> 
> Can we in anyway 'alias' std::span to libcamera::Span for gcc-9, so we
> could already move forwards ? or would that get too messy ?

I am a bit worried it would create more issues than it solves.


> 
>>
>> Barnabás Pőcze (7):
>>    gstreamer: Add `-Wno-volatile` for GCC
>>    meson: Ignore `Wredundant-move` with GCC 11 and above
>>    libcamera: base: log: Ignore deprecations
>>    treewide: Use character literal instead of string in some cases
>>    meson: Switch to C++20
>>    treewide: Use `std::span`
>>    libcamera: base: span: Deprecate it
>>
>>   Documentation/guides/pipeline-handler.rst     |  4 +-
>>   include/libcamera/base/file.h                 | 10 ++--
>>   include/libcamera/base/span.h                 | 16 +++----
>>   include/libcamera/base/thread.h               |  4 +-
>>   include/libcamera/camera.h                    |  5 +-
>>   include/libcamera/controls.h                  | 22 ++++++---
>>   include/libcamera/framebuffer.h               | 10 ++--
>>   .../libcamera/internal/byte_stream_buffer.h   |  6 +--
>>   include/libcamera/internal/camera_sensor.h    |  6 +--
>>   .../converter/converter_dw100_vertexmap.h     |  5 +-
>>   include/libcamera/internal/egl.h              |  8 ++--
>>   include/libcamera/internal/framebuffer.h      |  4 +-
>>   .../libcamera/internal/mapped_framebuffer.h   |  4 +-
>>   include/libcamera/internal/matrix.h           | 26 +++++-----
>>   include/libcamera/internal/pipeline_handler.h |  2 +-
>>   include/libcamera/internal/process.h          |  6 +--
>>   include/libcamera/internal/pub_key.h          |  7 ++-
>>   .../libcamera/internal/shared_mem_object.h    |  6 +--
>>   include/libcamera/internal/v4l2_device.h      |  6 +--
>>   include/libcamera/internal/vector.h           |  4 +-
>>   meson.build                                   | 23 ++++-----
>>   src/android/camera_buffer.h                   | 11 +++--
>>   src/android/camera_capabilities.cpp           |  4 +-
>>   src/android/camera_request.cpp                |  4 +-
>>   src/android/jpeg/encoder.h                    |  4 +-
>>   src/android/jpeg/encoder_jea.cpp              |  2 +-
>>   src/android/jpeg/encoder_jea.h                |  2 +-
>>   src/android/jpeg/encoder_libjpeg.cpp          | 10 ++--
>>   src/android/jpeg/encoder_libjpeg.h            | 12 ++---
>>   src/android/jpeg/exif.cpp                     |  2 +-
>>   src/android/jpeg/exif.h                       |  7 ++-
>>   src/android/jpeg/post_processor_jpeg.cpp      |  2 +-
>>   src/android/mm/cros_camera_buffer.cpp         |  4 +-
>>   .../mm/cros_frame_buffer_allocator.cpp        |  2 +-
>>   src/android/mm/generic_camera_buffer.cpp      |  4 +-
>>   .../mm/generic_frame_buffer_allocator.cpp     |  2 +-
>>   src/apps/cam/capture_script.cpp               | 12 ++---
>>   src/apps/cam/drm.cpp                          |  6 +--
>>   src/apps/cam/drm.h                            |  4 +-
>>   src/apps/cam/file_sink.cpp                    |  2 +-
>>   src/apps/cam/sdl_sink.cpp                     |  4 +-
>>   src/apps/cam/sdl_texture.h                    |  4 +-
>>   src/apps/cam/sdl_texture_1plane.cpp           |  2 +-
>>   src/apps/cam/sdl_texture_1plane.h             |  2 +-
>>   src/apps/cam/sdl_texture_mjpg.cpp             |  4 +-
>>   src/apps/cam/sdl_texture_mjpg.h               |  4 +-
>>   src/apps/cam/sdl_texture_yuv.cpp              |  2 +-
>>   src/apps/cam/sdl_texture_yuv.h                |  2 +-
>>   src/apps/common/dng_writer.cpp                |  4 +-
>>   src/apps/common/image.cpp                     |  6 +--
>>   src/apps/common/image.h                       | 10 ++--
>>   src/apps/common/ppm_writer.cpp                |  2 +-
>>   src/apps/common/ppm_writer.h                  |  4 +-
>>   src/apps/ipa-verify/main.cpp                  |  4 +-
>>   src/apps/lc-compliance/helpers/capture.cpp    |  2 +-
>>   src/apps/lc-compliance/helpers/capture.h      |  2 +-
>>   src/gstreamer/gstlibcamera-controls.cpp.in    |  4 +-
>>   src/gstreamer/gstlibcamera-utils.cpp          | 20 ++++----
>>   src/gstreamer/meson.build                     |  7 +++
>>   src/ipa/ipu3/algorithms/af.cpp                |  8 ++--
>>   src/ipa/ipu3/algorithms/af.h                  |  2 +-
>>   src/ipa/ipu3/algorithms/agc.cpp               |  2 +-
>>   src/ipa/ipu3/ipu3.cpp                         |  8 ++--
>>   src/ipa/libipa/exposure_mode_helper.cpp       |  2 +-
>>   src/ipa/libipa/exposure_mode_helper.h         |  4 +-
>>   src/ipa/libipa/histogram.cpp                  |  4 +-
>>   src/ipa/libipa/histogram.h                    |  8 ++--
>>   src/ipa/libipa/lsc_polynomial.h               |  2 +-
>>   src/ipa/libipa/v4l2_params.cpp                |  2 +-
>>   src/ipa/libipa/v4l2_params.h                  | 20 ++++----
>>   src/ipa/mali-c55/algorithms/agc.cpp           | 10 ++--
>>   src/ipa/mali-c55/mali-c55.cpp                 |  4 +-
>>   src/ipa/mali-c55/params.h                     |  2 +-
>>   src/ipa/rkisp1/algorithms/agc.cpp             |  2 +-
>>   src/ipa/rkisp1/algorithms/agc.h               |  7 +--
>>   src/ipa/rkisp1/algorithms/awb.cpp             |  2 +-
>>   src/ipa/rkisp1/algorithms/lsc.cpp             | 24 +++++-----
>>   src/ipa/rkisp1/algorithms/lsc.h               |  4 +-
>>   src/ipa/rkisp1/params.cpp                     |  2 +-
>>   src/ipa/rkisp1/params.h                       |  8 ++--
>>   src/ipa/rkisp1/rkisp1.cpp                     |  2 +-
>>   src/ipa/rpi/cam_helper/cam_helper.cpp         |  4 +-
>>   src/ipa/rpi/cam_helper/cam_helper.h           |  6 +--
>>   src/ipa/rpi/cam_helper/cam_helper_imx477.cpp  |  4 +-
>>   src/ipa/rpi/cam_helper/cam_helper_imx519.cpp  |  4 +-
>>   src/ipa/rpi/cam_helper/cam_helper_imx708.cpp  |  4 +-
>>   src/ipa/rpi/cam_helper/md_parser.h            |  9 ++--
>>   src/ipa/rpi/cam_helper/md_parser_smia.cpp     |  4 +-
>>   src/ipa/rpi/common/ipa_base.cpp               | 20 ++++----
>>   src/ipa/rpi/common/ipa_base.h                 |  2 +-
>>   src/ipa/rpi/controller/af_algorithm.h         |  5 +-
>>   src/ipa/rpi/controller/rpi/af.cpp             |  2 +-
>>   src/ipa/rpi/controller/rpi/af.h               |  2 +-
>>   src/ipa/rpi/controller/rpi/alsc.cpp           |  2 +-
>>   src/ipa/rpi/pisp/pisp.cpp                     | 12 +++--
>>   src/ipa/rpi/vc4/vc4.cpp                       | 48 ++++++++++---------
>>   src/libcamera/base/backtrace.cpp              |  8 ++--
>>   src/libcamera/base/file.cpp                   |  6 +--
>>   src/libcamera/base/log.cpp                    | 17 ++++---
>>   src/libcamera/base/thread.cpp                 |  2 +-
>>   src/libcamera/byte_stream_buffer.cpp          |  4 +-
>>   src/libcamera/camera.cpp                      |  2 +-
>>   src/libcamera/control_serializer.cpp          |  2 +-
>>   src/libcamera/controls.cpp                    | 22 ++++-----
>>   src/libcamera/converter/converter_dw100.cpp   |  2 +-
>>   .../converter/converter_dw100_vertexmap.cpp   |  4 +-
>>   src/libcamera/egl.cpp                         |  6 +--
>>   src/libcamera/framebuffer.cpp                 |  6 +--
>>   src/libcamera/ipa_manager.cpp                 |  2 +-
>>   src/libcamera/ipa_module.cpp                  | 16 +++----
>>   src/libcamera/mapped_framebuffer.cpp          |  2 +-
>>   src/libcamera/matrix.cpp                      | 26 +++++-----
>>   src/libcamera/media_pipeline.cpp              |  6 +--
>>   src/libcamera/pipeline/imx8-isi/imx8-isi.cpp  |  4 +-
>>   src/libcamera/pipeline/ipu3/ipu3.cpp          |  6 +--
>>   src/libcamera/pipeline/mali-c55/mali-c55.cpp  |  6 +--
>>   src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  6 +--
>>   src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |  2 +-
>>   src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  6 +--
>>   .../pipeline/rpi/common/pipeline_base.cpp     | 12 ++---
>>   .../pipeline/rpi/common/pipeline_base.h       |  2 +-
>>   src/libcamera/pipeline/rpi/pisp/pisp.cpp      |  4 +-
>>   src/libcamera/pipeline/rpi/vc4/vc4.cpp        |  2 +-
>>   src/libcamera/pipeline/simple/simple.cpp      | 10 ++--
>>   src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  6 +--
>>   src/libcamera/pipeline/vimc/vimc.cpp          |  6 +--
>>   src/libcamera/pipeline/virtual/virtual.cpp    |  6 +--
>>   src/libcamera/process.cpp                     |  4 +-
>>   src/libcamera/pub_key.cpp                     |  6 +--
>>   src/libcamera/sensor/camera_sensor_legacy.cpp |  8 ++--
>>   src/libcamera/sensor/camera_sensor_raw.cpp    |  8 ++--
>>   src/libcamera/shared_mem_object.cpp           |  2 +-
>>   src/libcamera/v4l2_device.cpp                 | 14 +++---
>>   src/libcamera/v4l2_videodevice.cpp            |  6 +--
>>   src/libcamera/vector.cpp                      |  2 +-
>>   src/libcamera/yaml_parser.cpp                 |  2 +-
>>   src/py/libcamera/py_helpers.cpp               |  2 +-
>>   src/py/libcamera/py_main.cpp                  |  4 +-
>>   src/v4l2/v4l2_camera_proxy.cpp                |  2 +-
>>   src/v4l2/v4l2_compat_manager.cpp              |  4 +-
>>   test/controls/control_value.cpp               | 28 +++++------
>>   test/file.cpp                                 |  2 +-
>>   test/span.cpp                                 |  1 +
>>   test/utils.cpp                                |  4 +-
>>   test/v4l2_videodevice/controls.cpp            |  4 +-
>>   utils/codegen/controls.py                     |  4 +-
>>   utils/gen-debug-controls.py                   |  4 +-
>>   147 files changed, 487 insertions(+), 461 deletions(-)
>>
>> --
>> 2.53.0
Barnabás Pőcze March 27, 2026, 8:28 a.m. UTC | #4
2026. 03. 26. 16:31 keltezéssel, Laurent Pinchart írta:
> Hi Barnabás,
> 
> Thank you for the patch.
> 
> On Mon, Mar 23, 2026 at 11:27:23AM +0100, Barnabás Pőcze wrote:
>> Now that C++20 is used, convert everything to use `std::span` instead of
>> `libcamera::Span`.
>>
>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>> ---
>>   Documentation/guides/pipeline-handler.rst     |  4 +-
>>   include/libcamera/base/file.h                 | 10 ++--
>>   include/libcamera/base/span.h                 | 12 ++---
>>   include/libcamera/base/thread.h               |  4 +-
>>   include/libcamera/camera.h                    |  5 +-
>>   include/libcamera/controls.h                  | 22 ++++++---
>>   include/libcamera/framebuffer.h               | 10 ++--
>>   .../libcamera/internal/byte_stream_buffer.h   |  6 +--
>>   include/libcamera/internal/camera_sensor.h    |  6 +--
>>   .../converter/converter_dw100_vertexmap.h     |  5 +-
>>   include/libcamera/internal/egl.h              |  8 ++--
>>   include/libcamera/internal/framebuffer.h      |  4 +-
>>   .../libcamera/internal/mapped_framebuffer.h   |  4 +-
>>   include/libcamera/internal/matrix.h           | 26 +++++-----
>>   include/libcamera/internal/pipeline_handler.h |  2 +-
>>   include/libcamera/internal/process.h          |  6 +--
>>   include/libcamera/internal/pub_key.h          |  7 ++-
>>   .../libcamera/internal/shared_mem_object.h    |  6 +--
>>   include/libcamera/internal/v4l2_device.h      |  6 +--
>>   include/libcamera/internal/vector.h           |  4 +-
>>   src/android/camera_buffer.h                   | 11 +++--
>>   src/android/camera_capabilities.cpp           |  4 +-
>>   src/android/camera_request.cpp                |  4 +-
>>   src/android/jpeg/encoder.h                    |  4 +-
>>   src/android/jpeg/encoder_jea.cpp              |  2 +-
>>   src/android/jpeg/encoder_jea.h                |  2 +-
>>   src/android/jpeg/encoder_libjpeg.cpp          | 10 ++--
>>   src/android/jpeg/encoder_libjpeg.h            | 12 ++---
>>   src/android/jpeg/exif.cpp                     |  2 +-
>>   src/android/jpeg/exif.h                       |  7 ++-
>>   src/android/jpeg/post_processor_jpeg.cpp      |  2 +-
>>   src/android/mm/cros_camera_buffer.cpp         |  4 +-
>>   .../mm/cros_frame_buffer_allocator.cpp        |  2 +-
>>   src/android/mm/generic_camera_buffer.cpp      |  4 +-
>>   .../mm/generic_frame_buffer_allocator.cpp     |  2 +-
>>   src/apps/cam/capture_script.cpp               | 12 ++---
>>   src/apps/cam/drm.cpp                          |  6 +--
>>   src/apps/cam/drm.h                            |  4 +-
>>   src/apps/cam/file_sink.cpp                    |  2 +-
>>   src/apps/cam/sdl_sink.cpp                     |  4 +-
>>   src/apps/cam/sdl_texture.h                    |  4 +-
>>   src/apps/cam/sdl_texture_1plane.cpp           |  2 +-
>>   src/apps/cam/sdl_texture_1plane.h             |  2 +-
>>   src/apps/cam/sdl_texture_mjpg.cpp             |  4 +-
>>   src/apps/cam/sdl_texture_mjpg.h               |  4 +-
>>   src/apps/cam/sdl_texture_yuv.cpp              |  2 +-
>>   src/apps/cam/sdl_texture_yuv.h                |  2 +-
>>   src/apps/common/dng_writer.cpp                |  4 +-
>>   src/apps/common/image.cpp                     |  6 +--
>>   src/apps/common/image.h                       | 10 ++--
>>   src/apps/common/ppm_writer.cpp                |  2 +-
>>   src/apps/common/ppm_writer.h                  |  4 +-
>>   src/apps/ipa-verify/main.cpp                  |  4 +-
>>   src/apps/lc-compliance/helpers/capture.cpp    |  2 +-
>>   src/apps/lc-compliance/helpers/capture.h      |  2 +-
>>   src/gstreamer/gstlibcamera-controls.cpp.in    |  4 +-
>>   src/gstreamer/gstlibcamera-utils.cpp          | 20 ++++----
>>   src/ipa/ipu3/algorithms/af.cpp                |  8 ++--
>>   src/ipa/ipu3/algorithms/af.h                  |  2 +-
>>   src/ipa/ipu3/algorithms/agc.cpp               |  2 +-
>>   src/ipa/ipu3/ipu3.cpp                         |  8 ++--
>>   src/ipa/libipa/exposure_mode_helper.cpp       |  2 +-
>>   src/ipa/libipa/exposure_mode_helper.h         |  4 +-
>>   src/ipa/libipa/histogram.cpp                  |  4 +-
>>   src/ipa/libipa/histogram.h                    |  8 ++--
>>   src/ipa/libipa/lsc_polynomial.h               |  2 +-
>>   src/ipa/libipa/v4l2_params.cpp                |  2 +-
>>   src/ipa/libipa/v4l2_params.h                  | 20 ++++----
>>   src/ipa/mali-c55/algorithms/agc.cpp           | 10 ++--
>>   src/ipa/mali-c55/mali-c55.cpp                 |  4 +-
>>   src/ipa/mali-c55/params.h                     |  2 +-
>>   src/ipa/rkisp1/algorithms/agc.cpp             |  2 +-
>>   src/ipa/rkisp1/algorithms/agc.h               |  7 +--
>>   src/ipa/rkisp1/algorithms/awb.cpp             |  2 +-
>>   src/ipa/rkisp1/algorithms/lsc.cpp             | 24 +++++-----
>>   src/ipa/rkisp1/algorithms/lsc.h               |  4 +-
>>   src/ipa/rkisp1/params.cpp                     |  2 +-
>>   src/ipa/rkisp1/params.h                       |  8 ++--
>>   src/ipa/rkisp1/rkisp1.cpp                     |  2 +-
>>   src/ipa/rpi/cam_helper/cam_helper.cpp         |  4 +-
>>   src/ipa/rpi/cam_helper/cam_helper.h           |  6 +--
>>   src/ipa/rpi/cam_helper/cam_helper_imx477.cpp  |  4 +-
>>   src/ipa/rpi/cam_helper/cam_helper_imx519.cpp  |  4 +-
>>   src/ipa/rpi/cam_helper/cam_helper_imx708.cpp  |  4 +-
>>   src/ipa/rpi/cam_helper/md_parser.h            |  9 ++--
>>   src/ipa/rpi/cam_helper/md_parser_smia.cpp     |  4 +-
>>   src/ipa/rpi/common/ipa_base.cpp               | 20 ++++----
>>   src/ipa/rpi/common/ipa_base.h                 |  2 +-
>>   src/ipa/rpi/controller/af_algorithm.h         |  5 +-
>>   src/ipa/rpi/controller/rpi/af.cpp             |  2 +-
>>   src/ipa/rpi/controller/rpi/af.h               |  2 +-
>>   src/ipa/rpi/controller/rpi/alsc.cpp           |  2 +-
>>   src/ipa/rpi/pisp/pisp.cpp                     | 12 +++--
>>   src/ipa/rpi/vc4/vc4.cpp                       | 48 ++++++++++---------
>>   src/libcamera/base/backtrace.cpp              |  8 ++--
>>   src/libcamera/base/file.cpp                   |  6 +--
>>   src/libcamera/base/thread.cpp                 |  2 +-
>>   src/libcamera/byte_stream_buffer.cpp          |  4 +-
>>   src/libcamera/camera.cpp                      |  2 +-
>>   src/libcamera/control_serializer.cpp          |  2 +-
>>   src/libcamera/controls.cpp                    | 22 ++++-----
>>   src/libcamera/converter/converter_dw100.cpp   |  2 +-
>>   .../converter/converter_dw100_vertexmap.cpp   |  4 +-
>>   src/libcamera/egl.cpp                         |  6 +--
>>   src/libcamera/framebuffer.cpp                 |  6 +--
>>   src/libcamera/ipa_manager.cpp                 |  2 +-
>>   src/libcamera/ipa_module.cpp                  | 16 +++----
>>   src/libcamera/mapped_framebuffer.cpp          |  2 +-
>>   src/libcamera/matrix.cpp                      | 26 +++++-----
>>   src/libcamera/pipeline/imx8-isi/imx8-isi.cpp  |  4 +-
>>   src/libcamera/pipeline/ipu3/ipu3.cpp          |  6 +--
>>   src/libcamera/pipeline/mali-c55/mali-c55.cpp  |  6 +--
>>   src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  6 +--
>>   src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |  2 +-
>>   src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  6 +--
>>   .../pipeline/rpi/common/pipeline_base.cpp     | 12 ++---
>>   .../pipeline/rpi/common/pipeline_base.h       |  2 +-
>>   src/libcamera/pipeline/rpi/pisp/pisp.cpp      |  4 +-
>>   src/libcamera/pipeline/rpi/vc4/vc4.cpp        |  2 +-
>>   src/libcamera/pipeline/simple/simple.cpp      |  4 +-
>>   src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  6 +--
>>   src/libcamera/pipeline/vimc/vimc.cpp          |  6 +--
>>   src/libcamera/pipeline/virtual/virtual.cpp    |  6 +--
>>   src/libcamera/process.cpp                     |  4 +-
>>   src/libcamera/pub_key.cpp                     |  6 +--
>>   src/libcamera/sensor/camera_sensor_legacy.cpp |  8 ++--
>>   src/libcamera/sensor/camera_sensor_raw.cpp    |  8 ++--
>>   src/libcamera/shared_mem_object.cpp           |  2 +-
>>   src/libcamera/v4l2_device.cpp                 | 14 +++---
>>   src/libcamera/v4l2_videodevice.cpp            |  6 +--
>>   src/libcamera/vector.cpp                      |  2 +-
>>   src/libcamera/yaml_parser.cpp                 |  2 +-
>>   src/py/libcamera/py_helpers.cpp               |  2 +-
>>   src/py/libcamera/py_main.cpp                  |  4 +-
>>   src/v4l2/v4l2_camera_proxy.cpp                |  2 +-
>>   src/v4l2/v4l2_compat_manager.cpp              |  4 +-
>>   test/controls/control_value.cpp               | 28 +++++------
>>   test/file.cpp                                 |  2 +-
>>   test/utils.cpp                                |  4 +-
>>   test/v4l2_videodevice/controls.cpp            |  4 +-
>>   utils/codegen/controls.py                     |  4 +-
>>   utils/gen-debug-controls.py                   |  4 +-
>>   142 files changed, 448 insertions(+), 436 deletions(-)
> 
> There are still a few occurrences of Span in the code base that I think
> need to be addressed. The following occurrences can I think just be
> replaced with 'std::span':

Oops, you're right. I made the suggested changes. I should do something so that
`awb_nn.cpp` is built...


> 
> src/ipa/rpi/controller/rpi/awb_nn.cpp:  return "[" + utils::join(Span(dims, dimsSize), ",") + "]";
> src/libcamera/ipa_data_serializer.cpp: * \todo Switch to Span instead of byte and fd vector
> src/libcamera/mapped_framebuffer.cpp: * The MappedBuffer::Plane uses the Span interface to describe the mapped memory
> src/libcamera/matrix.cpp: * \return Row \a i from the matrix, as a Span
> utils/gen-debug-controls.py:                    if m.type is not None and m.type.startswith('Span'):
> 
> The following ones could be replaced by either 'std::span' or 'span':
> 
> src/libcamera/matrix.cpp: * \a data is a one-dimensional Span and will be turned into a matrix in
> src/libcamera/matrix.cpp: * This operator[] returns a Span, which can then be indexed into again with
> src/libcamera/matrix.cpp: * matrix. Note that the lifetime of the Span returned by this first-level
> src/libcamera/matrix.cpp: * to save the Span that is the result of this operator[].
> src/libcamera/shared_mem_object.cpp: * fails, the function returns an empty Span. This can be also checked using the
> src/libcamera/shared_mem_object.cpp: * \return The memory buffer, or an empty Span if allocation failed
> 
> These should probably drop the type name as they're redundant (doxygen
> shows types in the generated documentation):
> 
> src/libcamera/byte_stream_buffer.cpp: * \brief Read data from the managed memory buffer into Span \a data
> src/libcamera/byte_stream_buffer.cpp: * \param[out] data Span representing the destination memory
> src/libcamera/egl.cpp: * \param[in] shaderEnv Span of preprocessor definitions to prepend
> src/libcamera/egl.cpp: * \param[in] shaderEnv Span of preprocessor definitions to prepend
> src/libcamera/egl.cpp: * \param[in] shaderEnv Span of preprocessor definitions to prepend
> 
> would become
> 
> src/libcamera/byte_stream_buffer.cpp: * \brief Read data from the managed memory buffer into \a data
> src/libcamera/byte_stream_buffer.cpp: * \param[out] data The destination memory
> src/libcamera/egl.cpp: * \param[in] shaderEnv Preprocessor definitions to prepend
> src/libcamera/egl.cpp: * \param[in] shaderEnv Preprocessor definitions to prepend
> src/libcamera/egl.cpp: * \param[in] shaderEnv Preprocessor definitions to prepend
> 
> Finally, thare are two occurrences in control yaml files:
> 
> src/libcamera/control_ids_rpi.yaml:        Span of the BCM2835 ISP generated statistics for the current frame.
> src/libcamera/control_ids_rpi.yaml:        Span of the PiSP Frontend ISP generated statistics for the current
> 
> I'd just drop "Span of" here too.
>
Laurent Pinchart March 27, 2026, 8:35 a.m. UTC | #5
On Fri, Mar 27, 2026 at 09:28:53AM +0100, Barnabás Pőcze wrote:
> 2026. 03. 26. 16:31 keltezéssel, Laurent Pinchart írta:
> > On Mon, Mar 23, 2026 at 11:27:23AM +0100, Barnabás Pőcze wrote:
> >> Now that C++20 is used, convert everything to use `std::span` instead of
> >> `libcamera::Span`.
> >>
> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> >> ---
> >>   Documentation/guides/pipeline-handler.rst     |  4 +-
> >>   include/libcamera/base/file.h                 | 10 ++--
> >>   include/libcamera/base/span.h                 | 12 ++---
> >>   include/libcamera/base/thread.h               |  4 +-
> >>   include/libcamera/camera.h                    |  5 +-
> >>   include/libcamera/controls.h                  | 22 ++++++---
> >>   include/libcamera/framebuffer.h               | 10 ++--
> >>   .../libcamera/internal/byte_stream_buffer.h   |  6 +--
> >>   include/libcamera/internal/camera_sensor.h    |  6 +--
> >>   .../converter/converter_dw100_vertexmap.h     |  5 +-
> >>   include/libcamera/internal/egl.h              |  8 ++--
> >>   include/libcamera/internal/framebuffer.h      |  4 +-
> >>   .../libcamera/internal/mapped_framebuffer.h   |  4 +-
> >>   include/libcamera/internal/matrix.h           | 26 +++++-----
> >>   include/libcamera/internal/pipeline_handler.h |  2 +-
> >>   include/libcamera/internal/process.h          |  6 +--
> >>   include/libcamera/internal/pub_key.h          |  7 ++-
> >>   .../libcamera/internal/shared_mem_object.h    |  6 +--
> >>   include/libcamera/internal/v4l2_device.h      |  6 +--
> >>   include/libcamera/internal/vector.h           |  4 +-
> >>   src/android/camera_buffer.h                   | 11 +++--
> >>   src/android/camera_capabilities.cpp           |  4 +-
> >>   src/android/camera_request.cpp                |  4 +-
> >>   src/android/jpeg/encoder.h                    |  4 +-
> >>   src/android/jpeg/encoder_jea.cpp              |  2 +-
> >>   src/android/jpeg/encoder_jea.h                |  2 +-
> >>   src/android/jpeg/encoder_libjpeg.cpp          | 10 ++--
> >>   src/android/jpeg/encoder_libjpeg.h            | 12 ++---
> >>   src/android/jpeg/exif.cpp                     |  2 +-
> >>   src/android/jpeg/exif.h                       |  7 ++-
> >>   src/android/jpeg/post_processor_jpeg.cpp      |  2 +-
> >>   src/android/mm/cros_camera_buffer.cpp         |  4 +-
> >>   .../mm/cros_frame_buffer_allocator.cpp        |  2 +-
> >>   src/android/mm/generic_camera_buffer.cpp      |  4 +-
> >>   .../mm/generic_frame_buffer_allocator.cpp     |  2 +-
> >>   src/apps/cam/capture_script.cpp               | 12 ++---
> >>   src/apps/cam/drm.cpp                          |  6 +--
> >>   src/apps/cam/drm.h                            |  4 +-
> >>   src/apps/cam/file_sink.cpp                    |  2 +-
> >>   src/apps/cam/sdl_sink.cpp                     |  4 +-
> >>   src/apps/cam/sdl_texture.h                    |  4 +-
> >>   src/apps/cam/sdl_texture_1plane.cpp           |  2 +-
> >>   src/apps/cam/sdl_texture_1plane.h             |  2 +-
> >>   src/apps/cam/sdl_texture_mjpg.cpp             |  4 +-
> >>   src/apps/cam/sdl_texture_mjpg.h               |  4 +-
> >>   src/apps/cam/sdl_texture_yuv.cpp              |  2 +-
> >>   src/apps/cam/sdl_texture_yuv.h                |  2 +-
> >>   src/apps/common/dng_writer.cpp                |  4 +-
> >>   src/apps/common/image.cpp                     |  6 +--
> >>   src/apps/common/image.h                       | 10 ++--
> >>   src/apps/common/ppm_writer.cpp                |  2 +-
> >>   src/apps/common/ppm_writer.h                  |  4 +-
> >>   src/apps/ipa-verify/main.cpp                  |  4 +-
> >>   src/apps/lc-compliance/helpers/capture.cpp    |  2 +-
> >>   src/apps/lc-compliance/helpers/capture.h      |  2 +-
> >>   src/gstreamer/gstlibcamera-controls.cpp.in    |  4 +-
> >>   src/gstreamer/gstlibcamera-utils.cpp          | 20 ++++----
> >>   src/ipa/ipu3/algorithms/af.cpp                |  8 ++--
> >>   src/ipa/ipu3/algorithms/af.h                  |  2 +-
> >>   src/ipa/ipu3/algorithms/agc.cpp               |  2 +-
> >>   src/ipa/ipu3/ipu3.cpp                         |  8 ++--
> >>   src/ipa/libipa/exposure_mode_helper.cpp       |  2 +-
> >>   src/ipa/libipa/exposure_mode_helper.h         |  4 +-
> >>   src/ipa/libipa/histogram.cpp                  |  4 +-
> >>   src/ipa/libipa/histogram.h                    |  8 ++--
> >>   src/ipa/libipa/lsc_polynomial.h               |  2 +-
> >>   src/ipa/libipa/v4l2_params.cpp                |  2 +-
> >>   src/ipa/libipa/v4l2_params.h                  | 20 ++++----
> >>   src/ipa/mali-c55/algorithms/agc.cpp           | 10 ++--
> >>   src/ipa/mali-c55/mali-c55.cpp                 |  4 +-
> >>   src/ipa/mali-c55/params.h                     |  2 +-
> >>   src/ipa/rkisp1/algorithms/agc.cpp             |  2 +-
> >>   src/ipa/rkisp1/algorithms/agc.h               |  7 +--
> >>   src/ipa/rkisp1/algorithms/awb.cpp             |  2 +-
> >>   src/ipa/rkisp1/algorithms/lsc.cpp             | 24 +++++-----
> >>   src/ipa/rkisp1/algorithms/lsc.h               |  4 +-
> >>   src/ipa/rkisp1/params.cpp                     |  2 +-
> >>   src/ipa/rkisp1/params.h                       |  8 ++--
> >>   src/ipa/rkisp1/rkisp1.cpp                     |  2 +-
> >>   src/ipa/rpi/cam_helper/cam_helper.cpp         |  4 +-
> >>   src/ipa/rpi/cam_helper/cam_helper.h           |  6 +--
> >>   src/ipa/rpi/cam_helper/cam_helper_imx477.cpp  |  4 +-
> >>   src/ipa/rpi/cam_helper/cam_helper_imx519.cpp  |  4 +-
> >>   src/ipa/rpi/cam_helper/cam_helper_imx708.cpp  |  4 +-
> >>   src/ipa/rpi/cam_helper/md_parser.h            |  9 ++--
> >>   src/ipa/rpi/cam_helper/md_parser_smia.cpp     |  4 +-
> >>   src/ipa/rpi/common/ipa_base.cpp               | 20 ++++----
> >>   src/ipa/rpi/common/ipa_base.h                 |  2 +-
> >>   src/ipa/rpi/controller/af_algorithm.h         |  5 +-
> >>   src/ipa/rpi/controller/rpi/af.cpp             |  2 +-
> >>   src/ipa/rpi/controller/rpi/af.h               |  2 +-
> >>   src/ipa/rpi/controller/rpi/alsc.cpp           |  2 +-
> >>   src/ipa/rpi/pisp/pisp.cpp                     | 12 +++--
> >>   src/ipa/rpi/vc4/vc4.cpp                       | 48 ++++++++++---------
> >>   src/libcamera/base/backtrace.cpp              |  8 ++--
> >>   src/libcamera/base/file.cpp                   |  6 +--
> >>   src/libcamera/base/thread.cpp                 |  2 +-
> >>   src/libcamera/byte_stream_buffer.cpp          |  4 +-
> >>   src/libcamera/camera.cpp                      |  2 +-
> >>   src/libcamera/control_serializer.cpp          |  2 +-
> >>   src/libcamera/controls.cpp                    | 22 ++++-----
> >>   src/libcamera/converter/converter_dw100.cpp   |  2 +-
> >>   .../converter/converter_dw100_vertexmap.cpp   |  4 +-
> >>   src/libcamera/egl.cpp                         |  6 +--
> >>   src/libcamera/framebuffer.cpp                 |  6 +--
> >>   src/libcamera/ipa_manager.cpp                 |  2 +-
> >>   src/libcamera/ipa_module.cpp                  | 16 +++----
> >>   src/libcamera/mapped_framebuffer.cpp          |  2 +-
> >>   src/libcamera/matrix.cpp                      | 26 +++++-----
> >>   src/libcamera/pipeline/imx8-isi/imx8-isi.cpp  |  4 +-
> >>   src/libcamera/pipeline/ipu3/ipu3.cpp          |  6 +--
> >>   src/libcamera/pipeline/mali-c55/mali-c55.cpp  |  6 +--
> >>   src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  6 +--
> >>   src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |  2 +-
> >>   src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  6 +--
> >>   .../pipeline/rpi/common/pipeline_base.cpp     | 12 ++---
> >>   .../pipeline/rpi/common/pipeline_base.h       |  2 +-
> >>   src/libcamera/pipeline/rpi/pisp/pisp.cpp      |  4 +-
> >>   src/libcamera/pipeline/rpi/vc4/vc4.cpp        |  2 +-
> >>   src/libcamera/pipeline/simple/simple.cpp      |  4 +-
> >>   src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  6 +--
> >>   src/libcamera/pipeline/vimc/vimc.cpp          |  6 +--
> >>   src/libcamera/pipeline/virtual/virtual.cpp    |  6 +--
> >>   src/libcamera/process.cpp                     |  4 +-
> >>   src/libcamera/pub_key.cpp                     |  6 +--
> >>   src/libcamera/sensor/camera_sensor_legacy.cpp |  8 ++--
> >>   src/libcamera/sensor/camera_sensor_raw.cpp    |  8 ++--
> >>   src/libcamera/shared_mem_object.cpp           |  2 +-
> >>   src/libcamera/v4l2_device.cpp                 | 14 +++---
> >>   src/libcamera/v4l2_videodevice.cpp            |  6 +--
> >>   src/libcamera/vector.cpp                      |  2 +-
> >>   src/libcamera/yaml_parser.cpp                 |  2 +-
> >>   src/py/libcamera/py_helpers.cpp               |  2 +-
> >>   src/py/libcamera/py_main.cpp                  |  4 +-
> >>   src/v4l2/v4l2_camera_proxy.cpp                |  2 +-
> >>   src/v4l2/v4l2_compat_manager.cpp              |  4 +-
> >>   test/controls/control_value.cpp               | 28 +++++------
> >>   test/file.cpp                                 |  2 +-
> >>   test/utils.cpp                                |  4 +-
> >>   test/v4l2_videodevice/controls.cpp            |  4 +-
> >>   utils/codegen/controls.py                     |  4 +-
> >>   utils/gen-debug-controls.py                   |  4 +-
> >>   142 files changed, 448 insertions(+), 436 deletions(-)
> > 
> > There are still a few occurrences of Span in the code base that I think
> > need to be addressed. The following occurrences can I think just be
> > replaced with 'std::span':
> 
> Oops, you're right. I made the suggested changes. I should do something so that
> `awb_nn.cpp` is built...

It would be great to ensure it gets built in CI.

> > src/ipa/rpi/controller/rpi/awb_nn.cpp:  return "[" + utils::join(Span(dims, dimsSize), ",") + "]";
> > src/libcamera/ipa_data_serializer.cpp: * \todo Switch to Span instead of byte and fd vector
> > src/libcamera/mapped_framebuffer.cpp: * The MappedBuffer::Plane uses the Span interface to describe the mapped memory
> > src/libcamera/matrix.cpp: * \return Row \a i from the matrix, as a Span
> > utils/gen-debug-controls.py:                    if m.type is not None and m.type.startswith('Span'):
> > 
> > The following ones could be replaced by either 'std::span' or 'span':
> > 
> > src/libcamera/matrix.cpp: * \a data is a one-dimensional Span and will be turned into a matrix in
> > src/libcamera/matrix.cpp: * This operator[] returns a Span, which can then be indexed into again with
> > src/libcamera/matrix.cpp: * matrix. Note that the lifetime of the Span returned by this first-level
> > src/libcamera/matrix.cpp: * to save the Span that is the result of this operator[].
> > src/libcamera/shared_mem_object.cpp: * fails, the function returns an empty Span. This can be also checked using the
> > src/libcamera/shared_mem_object.cpp: * \return The memory buffer, or an empty Span if allocation failed
> > 
> > These should probably drop the type name as they're redundant (doxygen
> > shows types in the generated documentation):
> > 
> > src/libcamera/byte_stream_buffer.cpp: * \brief Read data from the managed memory buffer into Span \a data
> > src/libcamera/byte_stream_buffer.cpp: * \param[out] data Span representing the destination memory
> > src/libcamera/egl.cpp: * \param[in] shaderEnv Span of preprocessor definitions to prepend
> > src/libcamera/egl.cpp: * \param[in] shaderEnv Span of preprocessor definitions to prepend
> > src/libcamera/egl.cpp: * \param[in] shaderEnv Span of preprocessor definitions to prepend
> > 
> > would become
> > 
> > src/libcamera/byte_stream_buffer.cpp: * \brief Read data from the managed memory buffer into \a data
> > src/libcamera/byte_stream_buffer.cpp: * \param[out] data The destination memory
> > src/libcamera/egl.cpp: * \param[in] shaderEnv Preprocessor definitions to prepend
> > src/libcamera/egl.cpp: * \param[in] shaderEnv Preprocessor definitions to prepend
> > src/libcamera/egl.cpp: * \param[in] shaderEnv Preprocessor definitions to prepend
> > 
> > Finally, thare are two occurrences in control yaml files:
> > 
> > src/libcamera/control_ids_rpi.yaml:        Span of the BCM2835 ISP generated statistics for the current frame.
> > src/libcamera/control_ids_rpi.yaml:        Span of the PiSP Frontend ISP generated statistics for the current
> > 
> > I'd just drop "Span of" here too.
Kieran Bingham March 27, 2026, 12:16 p.m. UTC | #6
Quoting Barnabás Pőcze (2026-03-27 08:28:36)
> 2026. 03. 23. 18:10 keltezéssel, Kieran Bingham írta:
> > Quoting Barnabás Pőcze (2026-03-23 10:27:17)
> >> With gcc 16 switching C++20 by default, and it being released for more
> >> than five years now, this is a proof of concept patch set containing the
> >> changes needed to make the current CI jobs succeed with cpp_std=c++20.
> >>
> >> There is still at least one issue that seemingly only appears in C++20:
> >> https://gitlab.freedesktop.org/camera/libcamera/-/issues/267
> >> the cause is not known, but a potential workaround has been merged.
> >>
> >> The last two patches drop the use of `libcamera::Span` in favor of
> >> `std::span`. However, gcc 9 does not have an implementation, so those
> >> two cannot be merged as is.
> > 
> > Perhaps we should consider merging the first 5 patches already then to
> > support with the migration?
> > 
> > Can we in anyway 'alias' std::span to libcamera::Span for gcc-9, so we
> > could already move forwards ? or would that get too messy ?
> 
> I am a bit worried it would create more issues than it solves.

Ok, don't worry then.

--
Kieran