[PATCH 00/27] RFC: Add in a eGL based GPUISP in libcamera

Bryan O'Donoghue bryan.odonoghue at linaro.org
Tue Apr 22 23:58:53 CEST 2025


This series takes the existing debayer shaders we have for qcam and
repurposes those to operate inside of libcamera/softisp.

EGL based to support the widest range of hardware. This code integrates
with the stastics and parameters code in softisp with CCM an additional WIP
on top.

We've been doing this project on the back burner for ~ 12 months with alot
of fun and learning on my end in the process.

I've tidied up the code somewhat and gotten it to the stage of producing a
pretty OK picture.

Still todo here:

- CCM
- DMA for input and output
- Adding something on the algorithms side that cannot be done in CPU.

This code isn't ready for merge but, its certainly ready for comment and
test.

Bryan O'Donoghue (21):
  libcamera: MappedFrameBuffer: Add tracking of mmap file descriptors to
    MappedFrameBuffer
  libcamera: MappedFrameBuffer: Add accessor for MappedFrameBuffer plane
    maps
  libcamera: dma_buf_allocator: Favour udmabuf over cma heap allocations
  libcamera: software_isp: Start the ISP thread in configure
  libcamera: software_isp: Move configure to worker thread
  libcamera: software_isp: Virtual base class reference in invokeMethod
  libcamera: software_isp: gbm: Add in a GBM helper class for GPU
    surface access
  libcamera: software_isp: egl: Introduce an eGL base helper class
  libcamera: software_isp: Move useful items from DebayerCpu to Debayer
    base class
  libcamera: software_isp: Move param select code to Debayer base class
  libcamera: software_isp: Move DMA sync code to common place in Debayer
    base
  libcamera: software_isp: Make the debayer_ object of type class
    Debayer not DebayerCpu
  libcamera: software_isp: debayer_egl: Add an eGL debayer class
  libcamera: software_isp: debayer_egl: Extend logic to enable
    application of softISP RGB debayer params
  libcamera: software_isp: debayer_egl: Make DebayerEGL the default
    debayer method
  libcamera: software_isp: egl: Bind each eglImage to its own texture
    unit
  libcamera: shaders: Use highp not mediump for float precision
  libcamera: shaders: Move GL shader programs to
    src/libcamera/assets/shader
  utils: gen-shader-headers: Add a utility to generate headers from
    shaders
  meson: Automatically generate glsl_shaders.h from specified shader
    programs
  shaders: Extend debayer shaders to apply RGB gain values on output

Hans de Goede (6):
  libcamera: swstats_cpu: Update statsProcessFn() / processLine0()
    documentation
  libcamera: swstats_cpu: Drop patternSize_ documentation
  libcamera: software_isp: Move benchmark code to its own class
  libcamera: swstats_cpu: Add processFrame() method
  libcamera: swstats_cpu: Add support for YUV420
  libcamera: swstats_cpu: Move header to libcamera/internal/software_isp

 .../libcamera/internal/mapped_framebuffer.h   |   3 +
 include/libcamera/internal/meson.build        |  10 +
 .../libcamera/internal/shaders}/RGB.frag      |   2 +-
 .../internal/shaders}/YUV_2_planes.frag       |   2 +-
 .../internal/shaders}/YUV_3_planes.frag       |   2 +-
 .../internal/shaders}/YUV_packed.frag         |   2 +-
 .../internal/shaders}/bayer_1x_packed.frag    |  12 +-
 .../libcamera/internal/shaders}/bayer_8.frag  |  18 +-
 .../libcamera/internal/shaders}/bayer_8.vert  |   0
 .../libcamera/internal/shaders}/identity.vert |   0
 .../libcamera/internal/shaders/meson.build    |  10 +
 .../internal/software_isp/benchmark.h         |  36 ++
 .../internal/software_isp/meson.build         |   2 +
 .../internal/software_isp/software_isp.h      |   5 +-
 .../internal}/software_isp/swstats_cpu.h      |  18 +
 src/apps/qcam/assets/shader/shaders.qrc       |  16 +-
 src/apps/qcam/viewfinder_gl.cpp               |  70 +--
 src/libcamera/dma_buf_allocator.cpp           |   2 +-
 src/libcamera/mapped_framebuffer.cpp          |   1 +
 src/libcamera/software_isp/benchmark.cpp      |  93 +++
 src/libcamera/software_isp/debayer.cpp        |  40 ++
 src/libcamera/software_isp/debayer.h          |  41 +-
 src/libcamera/software_isp/debayer_cpu.cpp    |  65 +-
 src/libcamera/software_isp/debayer_cpu.h      |  39 +-
 src/libcamera/software_isp/debayer_egl.cpp    | 571 ++++++++++++++++++
 src/libcamera/software_isp/debayer_egl.h      | 175 ++++++
 src/libcamera/software_isp/egl.cpp            | 347 +++++++++++
 src/libcamera/software_isp/egl.h              | 110 ++++
 src/libcamera/software_isp/gbm.cpp            | 136 +++++
 src/libcamera/software_isp/gbm.h              |  52 ++
 src/libcamera/software_isp/meson.build        |  31 +
 src/libcamera/software_isp/software_isp.cpp   |  25 +-
 src/libcamera/software_isp/swstats_cpu.cpp    | 178 +++++-
 utils/gen-shader-header.py                    |  38 ++
 utils/gen-shader-headers.sh                   |  41 ++
 utils/meson.build                             |   2 +
 36 files changed, 2016 insertions(+), 179 deletions(-)
 rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/RGB.frag (93%)
 rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/YUV_2_planes.frag (97%)
 rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/YUV_3_planes.frag (96%)
 rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/YUV_packed.frag (99%)
 rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/bayer_1x_packed.frag (95%)
 rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/bayer_8.frag (89%)
 rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/bayer_8.vert (100%)
 rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/identity.vert (100%)
 create mode 100644 include/libcamera/internal/shaders/meson.build
 create mode 100644 include/libcamera/internal/software_isp/benchmark.h
 rename {src/libcamera => include/libcamera/internal}/software_isp/swstats_cpu.h (79%)
 create mode 100644 src/libcamera/software_isp/benchmark.cpp
 create mode 100644 src/libcamera/software_isp/debayer_egl.cpp
 create mode 100644 src/libcamera/software_isp/debayer_egl.h
 create mode 100644 src/libcamera/software_isp/egl.cpp
 create mode 100644 src/libcamera/software_isp/egl.h
 create mode 100644 src/libcamera/software_isp/gbm.cpp
 create mode 100644 src/libcamera/software_isp/gbm.h
 create mode 100755 utils/gen-shader-header.py
 create mode 100755 utils/gen-shader-headers.sh

-- 
2.49.0



More information about the libcamera-devel mailing list