From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Changhuang Liang <changhuang.liang@starfivetech.com>
Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,
Benjamin Gaignard <benjamin.gaignard@collabora.com>,
Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>,
Mingjia Zhang <mingjia.zhang@mediatek.com>,
Jack Zhu <jack.zhu@starfivetech.com>,
Keith Zhao <keith.zhao@starfivetech.com>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>
Subject: Re: 回复: 回复: [PATCH v5 01/14] media: starfive: Add JH7110 ISP module definitions
Date: Sun, 15 Sep 2024 12:47:54 +0300 [thread overview]
Message-ID: <20240915094754.GK22087@pendragon.ideasonboard.com> (raw)
In-Reply-To: <ZQ0PR01MB1302C27EDC14BC0C0468FF83F2662@ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn>
Hello Changhuang,
On Sat, Sep 14, 2024 at 11:53:31AM +0000, Changhuang Liang wrote:
> > On Wed, Jul 24, 2024 at 02:20:17AM +0000, Changhuang Liang wrote:
> > > > On Wed, Jul 10, 2024 at 11:11:57AM +0200, Jacopo Mondi wrote:
> > > > > On Tue, Jul 09, 2024 at 01:38:11AM GMT, Changhuang Liang wrote:
> > > > > > Add JH7110 ISP module definitions for user space.
> > > > > >
> > > > > > Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
> > > > > > Signed-off-by: Zejian Su <zejian.su@starfivetech.com>
> > > > > > ---
> > > > > > MAINTAINERS | 1 +
> > > > > > include/uapi/linux/jh7110-isp.h | 739 ++++++++++++++++++++++++++++++++
> > > > >
> > > > > With the recently merged support for the RaspberryPi PiSP BE we
> > > > > have introduced include/uapi/linux/media/raspberry.
> > > > >
> > > > > Would you consider placing this in
> > > > > include/uapi/linux/media/startfive/ ?
> > > >
> > > > That sounds like a good idea.
> > > >
> > > > > > 2 files changed, 740 insertions(+) create mode 100644
> > > > > > include/uapi/linux/jh7110-isp.h
> > > > > >
> > > > > > diff --git a/MAINTAINERS b/MAINTAINERS index
> > > > > > 507f04a80499..890604eb0d64 100644
> > > > > > --- a/MAINTAINERS
> > > > > > +++ b/MAINTAINERS
> > > > > > @@ -21305,6 +21305,7 @@ S: Maintained
> > > > > > F: Documentation/admin-guide/media/starfive_camss.rst
> > > > > > F: Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
> > > > > > F: drivers/staging/media/starfive/camss
> > > > > > +F: include/uapi/linux/jh7110-isp.h
> > > > > >
> > > > > > STARFIVE CRYPTO DRIVER
> > > > > > M: Jia Jie Ho <jiajie.ho@starfivetech.com>
> > > > > > diff --git a/include/uapi/linux/jh7110-isp.h b/include/uapi/linux/jh7110-isp.h
> > > > > > new file mode 100644 index 000000000000..4939cd63e771
> > > > > > --- /dev/null
> > > > > > +++ b/include/uapi/linux/jh7110-isp.h
> > > > > > @@ -0,0 +1,739 @@
> > > > > > +/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
> > > > > > +/*
> > > > > > + * jh7110-isp.h
> > > > > > + *
> > > > > > + * JH7110 ISP driver - user space header file.
> > > > > > + *
> > > > > > + * Copyright © 2023 StarFive Technology Co., Ltd.
> > > > > > + *
> > > > > > + * Author: Zejian Su <zejian.su@starfivetech.com>
> > > > > > + *
> > > > > > + */
> > > > > > +
> > > > > > +#ifndef __JH7110_ISP_H_
> > > > > > +#define __JH7110_ISP_H_
> > > > > > +
> > > > >
> > > > > Do you need to include
> > > > >
> > > > > #include <linux/types.h>
> > > > >
> > > > > > +/**
> > > > >
> > > > > Is this kernel-doc or a single * would do ?
> > > > >
> > > > > > + * ISP Module Diagram
> > > > > > + * ------------------
> > > > > > + *
> > > > > > + * Raw +-----+ +------+ +------+ +----+
> > > > > > + * ---->| OBC |--->| OECF |--->| LCCF |--->| WB |-----+
> > > > > > + * +-----+ +------+ +------+ +----+ |
> > > > > > + * |
> > > > > > + * +--------------------------------------------------+
> > > > > > + * |
> > > > > > + * | +-----+ +-----+ +-----+ +-----+
> > > > > > + * +--->| DBC |--->| CTC |--->| CFA |--->| CAR |------+
> > > > > > + * +-----+ +-----+ +-----+ +-----+ |
> > > > > > + * |
> > > > > > + * +--------------------------------------------------+
> > > > > > + * |
> > > > > > + * | +-----+ +--------+ +-----+ +------+
> > > > > > + * +--->| CCM |--->| GMARGB |--->| R2Y |--->| YCRV |--+
> > > > > > + * +-----+ +--------+ +-----+ +------+ |
> > > > > > + * |
> > > > > > + * +--------------------------------------------------+
> > > > > > + * |
> > > > > > + * | +-------+ +-------+ +-----+ +----+
> > > > > > + * +--->| SHARP |--->| DNYUV |--->| SAT |--->| SC |
> > > > > > + * +-------+ +-------+ +-----+ +----+
> > > > > > + *
> > > >
> > > > The diagram is useful, thank you. A glossary would also be nice,
> > > > maybe as
> > > >
> > > > * - OBC: Optical Black Correction
> > > > * - OECF: Opto-Electric Conversion Function
> > > > * ...
> > > >
> > > > I think that would be easier to read than the comments above each
> > > > macro below. Up to you.
> > > >
> > > > > > + */
> > > > > > +
> > > > > > +/* Auto White Balance */
> > > > > > +#define JH7110_ISP_MODULE_WB_SETTING (1U << 0)
> > > > > > +/* Color Artifact Removal */
> > > > > > +#define JH7110_ISP_MODULE_CAR_SETTING (1U << 1)
> > > > > > +/* Color Correction Matrix */
> > > > > > +#define JH7110_ISP_MODULE_CCM_SETTING (1U << 2)
> > > > > > +/* Color Filter Arrays */
> > > > > > +#define JH7110_ISP_MODULE_CFA_SETTING (1U << 3)
> > > > > > +/* Crosstalk Correction */
> > > > > > +#define JH7110_ISP_MODULE_CTC_SETTING (1U << 4)
> > > > > > +/* Defect Bad Pixel Correction */
> > > > > > +#define JH7110_ISP_MODULE_DBC_SETTING (1U << 5)
> > > > > > +/* Denoise YUV */
> > > > > > +#define JH7110_ISP_MODULE_DNYUV_SETTING (1U << 6)
> > > > > > +/* RGB Gamma */
> > > > > > +#define JH7110_ISP_MODULE_GMARGB_SETTING (1U << 7)
> > > > > > +/* Lens Correction Cosine Fourth */
> > > > > > +#define JH7110_ISP_MODULE_LCCF_SETTING (1U << 8)
> > > > > > +/* Optical Black Correction */
> > > > > > +#define JH7110_ISP_MODULE_OBC_SETTING (1U << 9)
> > > > > > +/* Opto-Electric Conversion Function */
> > > > > > +#define JH7110_ISP_MODULE_OECF_SETTING (1U << 10)
> > > > > > +/* RGB To YUV */
> > > > > > +#define JH7110_ISP_MODULE_R2Y_SETTING (1U << 11)
> > > > > > +/* Saturation */
> > > > > > +#define JH7110_ISP_MODULE_SAT_SETTING (1U << 12)
> > > > > > +/* Sharpen */
> > > > > > +#define JH7110_ISP_MODULE_SHARP_SETTING (1U << 13)
> > > > > > +/* Y Curve */
> > > > > > +#define JH7110_ISP_MODULE_YCRV_SETTING (1U << 14)
> > > > > > +/* Statistics Collection */
> > > > > > +#define JH7110_ISP_MODULE_SC_SETTING (1U << 15)
> > > >
> > > > Unless there's a specific reason to keep the current order, maybe
> > > > you could sort those macros in the same order as in the module diagram ?
> > > >
> > > > > > +
> > > > > > +/**
> > > > > > + * struct jh7110_isp_wb_gain - auto white balance gain
> > > > > > + *
> > > > > > + * @gain_r: gain value for red component.
> > > > > > + * @gain_g: gain value for green component.
> > > > > > + * @gain_b: gain value for blue component.
> > > >
> > > > I suppose the gains are expressed as fixed-point integers. This
> > > > needs more details, what are the limits, and how many bits of
> > > > integer and fractional parts are there ?
> > > >
> > > > Same comment for all the other values below.
> > > >
> > > > > > + */
> > > > > > +struct jh7110_isp_wb_gain {
> > > > > > + __u16 gain_r;
> > > > > > + __u16 gain_g;
> > > > > > + __u16 gain_b;
> > > > > > +};
> > > > > > +
> > > > > > +/**
> > > > > > + * struct jh7110_isp_wb_setting - Configuration used by auto
> > > > > > +white balance gain
> > > > > > + *
> > > > > > + * @enabled: enabled setting flag.
> > > > > > + * @gains: auto white balance gain setting.
> > > > > > + */
> > > > > > +struct jh7110_isp_wb_setting {
> > > > > > + __u32 enabled;
> > > > > > + struct jh7110_isp_wb_gain gains; };
> > > > > > +
> > > > > > +/**
> > > > > > + * struct jh7110_isp_car_setting - Configuration used by color
> > > > > > +artifact removal
> > > > > > + *
> > > > > > + * @enabled: enabled setting flag.
> > > > > > + */
> > > > > > +struct jh7110_isp_car_setting {
> > > > > > + __u32 enabled;
> > > > > > +};
> > > > > > +
> > > > > > +/**
> > > > > > + * struct jh7110_isp_ccm_smlow - Color correction matrix
> > > > > > + *
> > > > > > + * @ccm: color transform matrix with size 3 by 3.
> > > > > > + * @offsets: the offsets of R, G, B after the transform by the ccm.
> > > > > > + */
> > > > > > +struct jh7110_isp_ccm_smlow {
> > > > > > + __s32 ccm[3][3];
> > > > > > + __s32 offsets[3];
> > > > > > +};
> > > > > > +
> > > > > > +/**
> > > > > > + * struct jh7110_isp_ccm_setting - Configuration used by color
> > > > > > +correction matrix
> > > > > > + *
> > > > > > + * @enabled: enabled setting flag.
> > > > > > + * @ccm_smlow: Color correction matrix.
> > > > > > + */
> > > > > > +struct jh7110_isp_ccm_setting {
> > > > > > + __u32 enabled;
> > > > > > + struct jh7110_isp_ccm_smlow ccm_smlow; };
> > > > > > +
> > > > > > +/**
> > > > > > + * struct jh7110_isp_cfa_params - demosaic parameters
> > > > > > + *
> > > > > > + * @hv_width: detail smooth factor
> > > > > > + * @cross_cov: Cross covariance weighting.
> > > >
> > > > This documentation doesn't tell how to use those paraemeters. This
> > > > comment applies to many other parameters below. There are three main
> > > > options to improve that:
> > > >
> > > > - Expanding the documentation in this header file to clearly explain how
> > > > to compute the parameters values.
> > > >
> > > > - Providing an open userspace implementation of ISP algorithms that
> > > > showcase how to calculate the values.
> > > >
> > > > - Providing detailed hardware documentation for the ISP. This is usually
> > > > not favoured by ISP vendors, and we are not pushing for this, but I
> > > > wanted to mention it for completeness.
> > >
> > > We prefer the first option. It will take a lot of time for us to
> > > supplement the documentation.
> >
> > That is fine. Very broadly speaking, the level of documentation we are aiming
> > for should be enough for a third party developer to implement support for the
> > ISP control algorithms in libcamera. Please let me know if you would like to
> > discuss this in more details, to make sure there's no misunderstanding in the
> > expectations.
>
> After the discussion at our company, our company is not going to open source the ISP algorithm section in the short term.
> That's why I selected the first option at the first time.
>
> As you said, more ISP information is needed, however, due to the suspension of ISP and the dissolution of the team, we
> actually lack ISP information ourselves.
>
> So now we can only get more information about the ISP from the source code.
>
> Therefore, we can only provide the libcamera repository that is not open source ISP algorithm.
> https://github.com/changhuangliang/libcamera/tree/starfive_isp_3a
> (At the beginning, I was responsible for implementing the drivers part, and Zejian was responsible
> for implementing the libcamera, but after zejian left the company, I took over the libcamera part,
> but I am not familiar with this part)
>
> We won't open source in the short term, But we'll probably consider open source later when ISP
> has no commercial value.
>
> So I am confused whether to continue the next version.
A kernel driver must be usable by open and closed userspace alike. With
neither of documentation of the ISP or a reference open-source userspace
implementation being available, this is not possible. Therefore, I'm
afraid we won't be able to accept ISP support in the mainline kernel.
> > > > If you would prefer the second option, any open-source camera
> > > > framework would be acceptable, but in practice the only real option is
> > > > likely libcamera.
> > > >
> > > > This does not mean that you have to open-source all your ISP control
> > > > algorithms. Only the code needed to explain how ISP parameters are
> > > > applied to the image and are computed is needed. Other parts, such
> > > > as for instance AI-based computation of white balance gains, or
> > > > complex AGC calculations, don't need to be open-source.
> > > >
> > > > The explain this requirement different and perhaps more clearly, the
> > > > goal is to make sure that developers who have access to only
> > > > open-source code (ISP kernel driver, this header, any open-source
> > > > userspace code,
> > > > ...) will have enough information to configure and control the ISP.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2024-09-15 9:48 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 8:38 [PATCH v5 00/14] Add ISP 3A for StarFive Changhuang Liang
2024-07-09 8:38 ` [PATCH v5 01/14] media: starfive: Add JH7110 ISP module definitions Changhuang Liang
2024-07-10 9:11 ` Jacopo Mondi
2024-07-22 14:27 ` Laurent Pinchart
2024-07-22 14:33 ` Laurent Pinchart
2024-07-24 2:20 ` 回复: " Changhuang Liang
2024-07-26 23:46 ` Laurent Pinchart
2024-09-14 11:53 ` 回复: " Changhuang Liang
2024-09-15 9:47 ` Laurent Pinchart [this message]
2024-09-18 1:56 ` 回复: " Changhuang Liang
2024-07-09 8:38 ` [PATCH v5 02/14] media: Documentation: Add description for StarFive ISP metadata formats Changhuang Liang
2024-07-10 9:22 ` Jacopo Mondi
2024-07-16 12:31 ` 回复: " Changhuang Liang
2024-07-16 14:25 ` Jacopo Mondi
2024-07-17 2:37 ` 回复: " Changhuang Liang
2024-07-17 7:11 ` Jacopo Mondi
2024-07-09 8:38 ` [PATCH v5 03/14] media: videodev2.h, v4l2-ioctl: Add StarFive ISP meta buffer format Changhuang Liang
2024-07-22 14:35 ` Laurent Pinchart
2024-07-09 8:38 ` [PATCH v5 04/14] staging: media: starfive: Add a params sink pad and a scd source pad for ISP Changhuang Liang
2024-07-10 9:51 ` Jacopo Mondi
2024-07-10 13:04 ` 回复: " Changhuang Liang
2024-07-22 14:51 ` Laurent Pinchart
2024-07-09 8:38 ` [PATCH v5 05/14] staging: media: starfive: Separate buffer from ISP hardware operation Changhuang Liang
2024-07-09 8:38 ` [PATCH v5 06/14] staging: media: starfive: Separate buffer be a common file Changhuang Liang
2024-07-09 8:38 ` [PATCH v5 07/14] staging: media: starfive: Separate ISP hardware from capture device Changhuang Liang
2024-07-09 8:38 ` [PATCH v5 08/14] staging: media: starfive: Add for StarFive ISP 3A SC Changhuang Liang
2024-07-10 11:57 ` Jacopo Mondi
2024-07-11 6:48 ` 回复: " Changhuang Liang
2024-07-11 8:26 ` Jacopo Mondi
2024-07-12 8:36 ` 回复: " Changhuang Liang
2024-07-12 11:37 ` Jacopo Mondi
2024-07-12 13:00 ` 回复: " Changhuang Liang
2024-07-12 13:27 ` Jacopo Mondi
2024-07-12 13:37 ` 回复: " Changhuang Liang
2024-07-12 16:25 ` Jacopo Mondi
2024-07-12 16:33 ` Jacopo Mondi
2024-07-15 1:52 ` 回复: " Changhuang Liang
2024-07-09 8:38 ` [PATCH v5 09/14] staging: media: starfive: Update ISP initialise config for 3A Changhuang Liang
2024-07-22 14:53 ` Laurent Pinchart
2024-07-09 8:38 ` [PATCH v5 10/14] staging: media: starfive: Add V4L2_CAP_IO_MC capability Changhuang Liang
2024-07-10 12:18 ` Jacopo Mondi
2024-07-10 13:10 ` 回复: " Changhuang Liang
2024-07-09 8:38 ` [PATCH v5 11/14] staging: media: starfive: Add ISP params video device Changhuang Liang
2024-07-10 13:07 ` Jacopo Mondi
2024-07-15 7:12 ` Hans Verkuil
2024-07-09 8:38 ` [PATCH v5 12/14] staging: media: starfive: Add ISP parameters hardware configure Changhuang Liang
2024-07-10 13:17 ` Jacopo Mondi
2024-07-12 13:14 ` 回复: " Changhuang Liang
2024-07-09 8:38 ` [PATCH v5 13/14] staging: media: starfive: Drop read support for video capture devices Changhuang Liang
2024-07-22 14:54 ` Laurent Pinchart
2024-07-09 8:38 ` [PATCH v5 14/14] admin-guide: media: Update documents for StarFive Camera Subsystem Changhuang Liang
2024-07-22 14:56 ` Laurent Pinchart
2024-07-24 1:40 ` 回复: " Changhuang Liang
2024-07-10 13:22 ` [PATCH v5 00/14] Add ISP 3A for StarFive Jacopo Mondi
2024-07-11 1:42 ` 回复: " Changhuang Liang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240915094754.GK22087@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=benjamin.gaignard@collabora.com \
--cc=changhuang.liang@starfivetech.com \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jack.zhu@starfivetech.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=jeanmichel.hautbois@ideasonboard.com \
--cc=keith.zhao@starfivetech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=mingjia.zhang@mediatek.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tomi.valkeinen+renesas@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox