[libcamera-devel] [PATCH v2 1/3] include: linux: Update kernel headers to version v5.16-rc7

David Plowman david.plowman at raspberrypi.com
Wed Jan 5 13:25:28 CET 2022


Hi Laurent

Thanks for the feedback. Not really sure how I got those extra bits in
there as I checked out the right tag before running the update script.
Evidently there's something I don't understand. But I'll fix it up and
make sure everything compiles before re-posting!

Best regards
David

On Wed, 5 Jan 2022 at 10:01, Laurent Pinchart
<laurent.pinchart at ideasonboard.com> wrote:
>
> Hi David,
>
> Thank you for the patch.
>
> On Wed, Jan 05, 2022 at 08:55:51AM +0000, David Plowman wrote:
> > Updated kernel headers to v5.16-rc7 using
> > utils/update-kernel-headers.sh and re-instating libcamera
> > local modifications.
> >
> > Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
> > ---
> >  include/linux/README          |   2 +-
> >  include/linux/dma-buf.h       |  50 ++++-
> >  include/linux/drm_fourcc.h    | 122 ++++++++++-
> >  include/linux/intel-ipu3.h    |  54 ++---
> >  include/linux/rkisp1-config.h |  16 +-
> >  include/linux/v4l2-controls.h | 383 ++++++++++++++++++++++++++++++++--
> >  include/linux/v4l2-subdev.h   |  12 +-
> >  include/linux/videodev2.h     |  59 +++++-
> >  8 files changed, 630 insertions(+), 68 deletions(-)
>
> [snip]
>
> > diff --git a/include/linux/intel-ipu3.h b/include/linux/intel-ipu3.h
> > index b18b28a0..0d197b12 100644
> > --- a/include/linux/intel-ipu3.h
> > +++ b/include/linux/intel-ipu3.h
> > @@ -1,4 +1,4 @@
> > -/* SPDX-License-Identifier: GPL-2.0 */
> > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> >  /* Copyright (C) 2017 - 2018 Intel Corporation */
> >
> >  #ifndef __IPU3_UAPI_H
> > @@ -9,8 +9,10 @@
> >  /* from /drivers/staging/media/ipu3/include/videodev2.h */
> >
> >  /* Vendor specific - used for IPU3 camera sub-system */
> > -#define V4L2_META_FMT_IPU3_PARAMS    v4l2_fourcc('i', 'p', '3', 'p') /* IPU3 processing parameters */
> > -#define V4L2_META_FMT_IPU3_STAT_3A   v4l2_fourcc('i', 'p', '3', 's') /* IPU3 3A statistics */
> > +/* IPU3 processing parameters */
> > +#define V4L2_META_FMT_IPU3_PARAMS    v4l2_fourcc('i', 'p', '3', 'p')
> > +/* IPU3 3A statistics */
> > +#define V4L2_META_FMT_IPU3_STAT_3A   v4l2_fourcc('i', 'p', '3', 's')
> >
> >  /* from include/uapi/linux/v4l2-controls.h */
> >  #define V4L2_CID_INTEL_IPU3_BASE     (V4L2_CID_USER_BASE + 0x10c0)
> > @@ -59,44 +61,21 @@ struct ipu3_uapi_grid_config {
>
> Changes from here...
>
> >       __u16 y_end;
> >  } __attribute__((packed));
> >
> > -/**
> > - * struct ipu3_uapi_awb_set_item - Memory layout for each cell in AWB
> > - *
> > - * @Gr_avg:  Green average for red lines in the cell.
> > - * @R_avg:   Red average in the cell.
> > - * @B_avg:   Blue average in the cell.
> > - * @Gb_avg:  Green average for blue lines in the cell.
> > - * @sat_ratio:       Percentage of pixels over a given threshold set in
> > - *           ipu3_uapi_awb_config_s, coded from 0 to 255.
> > - * @padding0:        Unused byte for padding.
> > - * @padding1:        Unused byte for padding.
> > - * @padding2:        Unused byte for padding.
> > - */
> > -struct ipu3_uapi_awb_set_item {
> > -     unsigned char Gr_avg;
> > -     unsigned char R_avg;
> > -     unsigned char B_avg;
> > -     unsigned char Gb_avg;
> > -     unsigned char sat_ratio;
> > -     unsigned char padding0;
> > -     unsigned char padding1;
> > -     unsigned char padding2;
> > -} __attribute__((packed));
> > -
> >  /*
> >   * The grid based data is divided into "slices" called set, each slice of setX
> >   * refers to ipu3_uapi_grid_config width * height_per_slice.
> >   */
> >  #define IPU3_UAPI_AWB_MAX_SETS                               60
> >  /* Based on grid size 80 * 60 and cell size 16 x 16 */
> > -#define IPU3_UAPI_AWB_SET_SIZE                               160
> > +#define IPU3_UAPI_AWB_SET_SIZE                               1280
> > +#define IPU3_UAPI_AWB_MD_ITEM_SIZE                   8
> >  #define IPU3_UAPI_AWB_SPARE_FOR_BUBBLES \
> > -     (IPU3_UAPI_MAX_BUBBLE_SIZE * IPU3_UAPI_MAX_STRIPES)
> > +     (IPU3_UAPI_MAX_BUBBLE_SIZE * IPU3_UAPI_MAX_STRIPES * \
> > +      IPU3_UAPI_AWB_MD_ITEM_SIZE)
> >  #define IPU3_UAPI_AWB_MAX_BUFFER_SIZE \
> >       (IPU3_UAPI_AWB_MAX_SETS * \
> >        (IPU3_UAPI_AWB_SET_SIZE + IPU3_UAPI_AWB_SPARE_FOR_BUBBLES))
> >
> > -
> >  /**
> >   * struct ipu3_uapi_awb_raw_buffer - AWB raw buffer
> >   *
> > @@ -104,7 +83,7 @@ struct ipu3_uapi_awb_set_item {
> >   *           the average values for each color channel.
> >   */
> >  struct ipu3_uapi_awb_raw_buffer {
> > -     struct ipu3_uapi_awb_set_item meta_data[IPU3_UAPI_AWB_MAX_BUFFER_SIZE]
> > +     __u8 meta_data[IPU3_UAPI_AWB_MAX_BUFFER_SIZE]
> >               __attribute__((aligned(32)));
> >  } __attribute__((packed));
> >
>
> ... to here are part of commit 6ab7030039241c2667f5a7ad94935878279c9370
> which is in linux-next but not in v5.16-rc7. We depend on this in
> libcamera. Could you drop those two hunks ? Could you also compile-test
> libcamera with all pipeline handlers enabled ?
>
> > @@ -255,7 +234,9 @@ struct ipu3_uapi_ae_ccm {
> >   * struct ipu3_uapi_ae_config - AE config
> >   *
> >   * @grid_cfg:        config for auto exposure statistics grid. See struct
> > - *           &ipu3_uapi_ae_grid_config
> > + *           &ipu3_uapi_ae_grid_config, as Imgu did not support output
> > + *           auto exposure statistics, so user can ignore this configuration
> > + *           and use the RGB table in auto-whitebalance statistics instead.
> >   * @weights: &IPU3_UAPI_AE_WEIGHTS is based on 32x24 blocks in the grid.
> >   *           Each grid cell has a corresponding value in weights LUT called
> >   *           grid value, global histogram is updated based on grid value and
> > @@ -266,8 +247,8 @@ struct ipu3_uapi_ae_ccm {
> >   */
> >  struct ipu3_uapi_ae_config {
> >       struct ipu3_uapi_ae_grid_config grid_cfg __attribute__((aligned(32)));
> > -     struct ipu3_uapi_ae_weight_elem weights[
> > -                     IPU3_UAPI_AE_WEIGHTS] __attribute__((aligned(32)));
> > +     struct ipu3_uapi_ae_weight_elem weights[IPU3_UAPI_AE_WEIGHTS]
> > +                                             __attribute__((aligned(32)));
> >       struct ipu3_uapi_ae_ccm ae_ccm __attribute__((aligned(32)));
> >  } __attribute__((packed));
> >
> > @@ -555,6 +536,9 @@ struct ipu3_uapi_ff_status {
> >   *
> >   * @awb_raw_buffer: auto white balance meta data &ipu3_uapi_awb_raw_buffer
> >   * @ae_raw_buffer: auto exposure raw data &ipu3_uapi_ae_raw_buffer_aligned
> > + *                 current Imgu does not output the auto exposure statistics
> > + *                 to ae_raw_buffer, the user such as 3A algorithm can use the
> > + *                 RGB table in &ipu3_uapi_awb_raw_buffer to do auto-exposure.
> >   * @af_raw_buffer: &ipu3_uapi_af_raw_buffer for auto focus meta data
> >   * @awb_fr_raw_buffer: value as specified by &ipu3_uapi_awb_fr_raw_buffer
> >   * @stats_4a_config: 4a statistics config as defined by &ipu3_uapi_4a_config.
> > @@ -652,7 +636,7 @@ struct ipu3_uapi_bnr_static_config_wb_gains_thr_config {
> >   * @cg:      Gain coefficient for threshold calculation, [0, 31], default 8.
> >   * @ci:      Intensity coefficient for threshold calculation. range [0, 0x1f]
> >   *   default 6.
> > - *   format: u3.2 (3 most significant bits represent whole number,
> > + *   format: u3.2 (3 most significant bits represent whole number,
> >   *   2 least significant bits represent the fractional part
> >   *   with each count representing 0.25)
> >   *   e.g. 6 in binary format is 00110, that translates to 1.5
>
> [snip]
>
> --
> Regards,
>
> Laurent Pinchart


More information about the libcamera-devel mailing list