media: qcom: camss: CAMSS Offline Processing Engine support
Subsystems (6)
Loic Poulain
reviewerv5 cover media: qcom: camss: CAMSS Offline Processing Engine support
This series introduces support for the Qualcomm CAMSS Offline Processing Engine (OPE), as found on Agatti-based platforms. Boards such as Arduino UNO-Q use this SoC family and will benefit from hardware-assisted image processing enabled by this work.
This represents the first step toward enabling image processing beyond raw capture on Qualcomm platforms by using hardware blocks for operations such as debayering, color correction, and scaling.
The OPE sits outside the live capture pipeline. It operates on frames fetched from system memory and writes processed results back to memory. Because of this design, the OPE is not tied to any specific capture
interface: frames may come from CAMSS RDI or PIX paths, or from any other producer capable of providing memory-backed buffers.
The hardware can sustain up to 580 megapixels per second, which is sufficient to process a 9MPix (4K) stream at 60 fps or to handle four parallel 2MPix (HD) streams at 60 fps.
The driver is designed to support multiple processing contexts. At present, however, only a single context is instantiated, which is created on the first media-pipeline open. This keeps the implementation simple while ensuring the design is ready for forthcoming multi-context support at the V4L2/media framework level.
The OPE is a standalone device, independent from the CAMSS device. It manages its own clocks and power domains (CAMSS GDSC and CX), and does not require any change to the core CAMSS driver.
Graph:ope_input ----+
+--> ope_proc --> ope_disp --> ope_disp_output
ope_params ---+
Compliance: v4l2-compliance has been executed without any error on the media and video devices.
Testing: A camss-isp-m2m tool is available at
https://github.com/loicpoulain/camss-isp-m2m-test
The tool can be used to exercise and stress-test the OPE engine, as well as to observe performance and latency behavior under various operating conditions (resolution, format, buf count, etc).
./camss-isp-m2m -s 3840x2160 -n 5
Name Device Dir Type
--------------------------------------------------------------
ope_input /dev/video10 output video ope_params /dev/video11 output meta ope_disp_output /dev/video12 capture video ope_proc /dev/v4l-subdev13 - subdev ope_disp /dev/v4l-subdev14 - subdev
Test: 3840x2160 RGGB -> 3840x2160 NV12 [5 frames] Input /dev/video10 3840x2160 RGGB bpl=3840 size=8294400 Output /dev/video12 3840x2160 NV12 bpl=5760 size=12441600
Buffers:
/dev/video10 buf[0] offset=0x00000000 length=8294400 VA=0xffffbcb87000 /dev/video11 buf[0] offset=0x00000000 length=12441600 VA=0xffffbbfa9000
Streaming 5 frames...
seq=0 buf: in=0 out=0 14.833 ms (67.4 fps) seq=1 buf: in=0 out=0 14.874 ms (67.2 fps) seq=2 buf: in=0 out=0 14.902 ms (67.1 fps) seq=3 buf: in=0 out=0 14.960 ms (66.8 fps) seq=4 buf: in=0 out=0 14.896 ms (67.1 fps)
---
Changes in v5:
- Make params definition ope specific (Bryan)
- Add pipeline/params helpers to ope driver/subdir.
- driver: fix COLOR_CORRECT base (0xa00, was 0x400) (Bryan).
- driver: fix DEMO INTERP_COEFF lambda masks (G [7:0], RB [23:16]).
- driver: map pipeline blocks individually, dump per-block HW_VERSION (Bryan).
- driver: disp subdev is pass-through, mirror sink format to source
and make source read-only.
- dt-bindings/dts: map the CDM register block and rename node to isp@5c42000 (Bryan).
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Made OPE a standalone device again, sibling of CAMSS rather than
a child node, following maintainer feedback (Bryan)
- Aligned params with ones suggested by Bryan (when possible) (Bryan)
- Correct usage of subdevice states for configuration (Hans)
- Removed the bufq and scheduling helpers (now in ope driver) (Bryan)
- Moved generic pipeline and params helpers to camms 'core'
- Fixed Green hue with some downscaling factors (reported by Hans)
- Fixed ope_enum_fmt_vid_cap (Hans)
- don't hardcode DT assigned-clock-rates for AXI (Konrad)
- Link to v3: https://lore.kernel.org/all/[email protected]
Changes in v3:
- Simplified camss_init_pm_clks()- no clk_get, no rate setting;
- Added Assigned clock rate in devicetree for CAMSS AXI clock
- Add Kernel Doc for camss-isp-bufq exported functions
- Added description explaining the 2-cell for CAMSS bus
- Reworked OPE media topology with intermediate ope_disp subdev
- Support for crop and compose in ope_proc sink/source
- Fixed Write Engine violation with some scaling config
- Fixed input/output custom-stride issue (Hans)
- Split uapi header (camss-config.h) into its own dedicated commit
- Patch reordering to respect dependency in regards to ABI/dt-bindings introduction
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Not an RFC anymore
- Move from v4l2-m2m to multi-devices design
- Support for parameters
- Helpers for pipeline, job scheduling, buf-queues
- OPE as a child node of CAMSS
To: Bryan O'Donoghue <[email protected]>
To: Vladimir Zapolskiy <[email protected]>
To: Loic Poulain <[email protected]>
To: Mauro Carvalho Chehab <[email protected]>
To: Kees Cook <[email protected]>
To: Gustavo A. R. Silva <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: Bjorn Andersson <[email protected]>
To: Konrad Dybcio <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Loic Poulain (5):
media: qcom: camss: Add V4L2 meta format for CAMSS ISP parameters
dt-bindings: media: qcom: Add CAMSS Offline Processing Engine (OPE)
media: uapi: Add CAMSS OPE ISP configuration definition
media: qcom: camss: Add CAMSS Offline Processing Engine driver
arm64: dts: qcom: agatti: Add OPE node
.../bindings/media/qcom,qcm2290-camss-ope.yaml | 151 + arch/arm64/boot/dts/qcom/agatti.dtsi | 79 + drivers/media/platform/qcom/camss/Kconfig | 2 + drivers/media/platform/qcom/camss/Makefile | 2 + drivers/media/platform/qcom/camss/ope/Kconfig | 16 + drivers/media/platform/qcom/camss/ope/Makefile | 9 + drivers/media/platform/qcom/camss/ope/core.c | 3353 ++++++++++++++++++++ drivers/media/platform/qcom/camss/ope/params.c | 75 + drivers/media/platform/qcom/camss/ope/params.h | 62 + drivers/media/platform/qcom/camss/ope/pipeline.c | 399 +++ drivers/media/platform/qcom/camss/ope/pipeline.h | 237 ++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/camss-ope-config.h | 160 + include/uapi/linux/videodev2.h | 3 + 14 files changed, 4549 insertions(+)
---
base-commit: 6b0fbf4352615cc5e542347120f1724ce31837f8
change-id: 20260427-camss-isp-ope-4b575ffec2ed
Best regards,
Signature · 1 line
Loic Poulain <[email protected]>
Loic Poulain
reviewerPATCH v5 1/5 media: qcom: camss: Add V4L2 meta format for CAMSS ISP parameters
Add a V4L2 meta format code (V4L2_META_FMT_QCOM_ISP_PARAMS) for the Qualcomm CAMSS ISP parameter buffer. This format is used by the params video node exposed by CAMSS offline ISP drivers (e.g. OPE) to carry ISP tuning data such as white balance, color correction and chroma enhancement settings.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 4 insertions(+)
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1471,6 +1471,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_C3ISP_STATS : descr ="Amlogic C3 ISP Statistics" ;break ;case V4L2_META_FMT_MALI_C55_PARAMS : descr ="ARM Mali-C55 ISP Parameters" ;break ;case V4L2_META_FMT_MALI_C55_STATS : descr ="ARM Mali-C55 ISP 3A Statistics" ;break ; +case V4L2_META_FMT_QCOM_ISP_PARAMS : descr ="Qualcomm CAMSS ISP Parameters" ;break ;case V4L2_PIX_FMT_NV12_8L128 : descr ="NV12 (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12M_8L128 : descr ="NV12M (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12_10BE_8L128 : descr ="10-bit NV12 (8x128 Linear, BE)" ;break ;
include/uapi/linux/videodev2.h +3 -0
@@ -888,6 +888,9 @@ struct v4l2_pix_format {#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P')/* ARM Mali-C55 Parameters */ #define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S')/* ARM Mali-C55 3A Statistics */ +/* Vendor specific - used for Qualcomm CAMSS offline ISP */ +#define V4L2_META_FMT_QCOM_ISP_PARAMS v4l2_fourcc('Q', 'C', 'I', 'P')/* Qualcomm CAMSS ISP */ +#ifdef __KERNEL__/* * Line-based metadata formats. Remember to update v4l_fill_fmtdesc() when
Signature · 1 line
2.34.1
Re: [PATCH v5 1/5] media: qcom: camss: Add V4L2 meta format for CAMSS ISP parameters
Hi Loic,
Quoted 29 lines · Loic Poulain
Add a V4L2 meta format code (
V4L2_META_FMT_QCOM_ISP_PARAMS) for the Qualcomm CAMSS ISP parameter buffer. This format is used by the params video node exposed by CAMSS offline ISP drivers (e.g. OPE) to carry ISP tuning data such as white balance, color correction and chroma enhancement settings.Signed-off-by Loic Poulain <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 4 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1471,6 +1471,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_C3ISP_STATS : descr ="Amlogic C3 ISP Statistics" ;break ;case V4L2_META_FMT_MALI_C55_PARAMS : descr ="ARM Mali-C55 ISP Parameters" ;break ;case V4L2_META_FMT_MALI_C55_STATS : descr ="ARM Mali-C55 ISP 3A Statistics" ;break ; +case V4L2_META_FMT_QCOM_ISP_PARAMS : descr ="Qualcomm CAMSS ISP Parameters" ;break ;case V4L2_PIX_FMT_NV12_8L128 : descr ="NV12 (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12M_8L128 : descr ="NV12M (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12_10BE_8L128 : descr ="10-bit NV12 (8x128 Linear, BE)" ;break ;include/uapi/linux/videodev2.h +0
-0
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 891
Quoted 4 lines
include/uapi/linux/videodev2.h +1
-0@@ -888,6 +888,9 @@ struct v4l2_pix_format {#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P')/* ARM Mali-C55 Parameters */ #define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S')/* ARM Mali-C55 3A Statistics */ +/* Vendor specific - used for Qualcomm CAMSS offline ISP */
It seems that this is generic format for ISP parameters, can we update the comment and remove offline. The proposal:
/* Vendor specific - used for Qualcomm CAMSS ISP */
~Gjorgji
Loic Poulain
reviewerRe: [PATCH v5 1/5] media: qcom: camss: Add V4L2 meta format for CAMSS ISP parameters
Quoted 36 lines · Gjorgji Rosikopulos (Consultant)
Hi Loic,
Quoted 32 lines · Loic Poulain
Add a V4L2 meta format code (
V4L2_META_FMT_QCOM_ISP_PARAMS) for the Qualcomm CAMSS ISP parameter buffer. This format is used by the params video node exposed by CAMSS offline ISP drivers (e.g. OPE) to carry ISP tuning data such as white balance, color correction and chroma enhancement settings.Signed-off-by Loic Poulain <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 4 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1471,6 +1471,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_C3ISP_STATS : descr ="Amlogic C3 ISP Statistics" ;break ;case V4L2_META_FMT_MALI_C55_PARAMS : descr ="ARM Mali-C55 ISP Parameters" ;break ;case V4L2_META_FMT_MALI_C55_STATS : descr ="ARM Mali-C55 ISP 3A Statistics" ;break ; +case V4L2_META_FMT_QCOM_ISP_PARAMS : descr ="Qualcomm CAMSS ISP Parameters" ;break ;case V4L2_PIX_FMT_NV12_8L128 : descr ="NV12 (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12M_8L128 : descr ="NV12M (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12_10BE_8L128 : descr ="10-bit NV12 (8x128 Linear, BE)" ;break ;include/uapi/linux/videodev2.h +0
-0@@ -888,6 +888,9 @@ struct v4l2_pix_format {#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P')/* ARM Mali-C55 Parameters */ #define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S')/* ARM Mali-C55 3A Statistics */
Quoted 4 lines
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 891
Quoted 1 line
include/uapi/linux/videodev2.h +1
-0+/* Vendor specific - used for Qualcomm CAMSS offline ISP */ It seems that this is generic format for ISP parameters, can we update the comment and remove offline. The proposal:
/* Vendor specific - used for Qualcomm CAMSS ISP */
Sure.
Loic
Bryan O'Donoghue
maintainerRe: [PATCH v5 1/5] media: qcom: camss: Add V4L2 meta format for CAMSS ISP parameters
Quoted 38 lines · Loic Poulain
Quoted 36 lines · Gjorgji Rosikopulos (Consultant)
Hi Loic,
Quoted 32 lines · Loic Poulain
Add a V4L2 meta format code (
V4L2_META_FMT_QCOM_ISP_PARAMS) for the Qualcomm CAMSS ISP parameter buffer. This format is used by the params video node exposed by CAMSS offline ISP drivers (e.g. OPE) to carry ISP tuning data such as white balance, color correction and chroma enhancement settings.Signed-off-by Loic Poulain <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 4 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1471,6 +1471,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_C3ISP_STATS : descr ="Amlogic C3 ISP Statistics" ;break ;case V4L2_META_FMT_MALI_C55_PARAMS : descr ="ARM Mali-C55 ISP Parameters" ;break ;case V4L2_META_FMT_MALI_C55_STATS : descr ="ARM Mali-C55 ISP 3A Statistics" ;break ; +case V4L2_META_FMT_QCOM_ISP_PARAMS : descr ="Qualcomm CAMSS ISP Parameters" ;break ;case V4L2_PIX_FMT_NV12_8L128 : descr ="NV12 (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12M_8L128 : descr ="NV12M (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12_10BE_8L128 : descr ="10-bit NV12 (8x128 Linear, BE)" ;break ;include/uapi/linux/videodev2.h +0
-0@@ -888,6 +888,9 @@ struct v4l2_pix_format {#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P')/* ARM Mali-C55 Parameters */ #define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S')/* ARM Mali-C55 3A Statistics */
Quoted 7 lines
Quoted 4 lines
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 891
Quoted 1 line
include/uapi/linux/videodev2.h +1
-0+/* Vendor specific - used for Qualcomm CAMSS offline ISP */ It seems that this is generic format for ISP parameters, can we update the comment and remove offline. The proposal:
/* Vendor specific - used for Qualcomm CAMSS ISP */Sure.
Loic
Since these are not the full list and as I understand them not the full structures for OPE - qcom restricting the full formats ? - I'd request to move these to an OPE specific header.
---
bod
Loic Poulain
reviewerRe: [PATCH v5 1/5] media: qcom: camss: Add V4L2 meta format for CAMSS ISP parameters
Quoted 45 lines · Bryan O'Donoghue
Quoted 43 lines · Loic Poulain
Quoted 40 lines · Gjorgji Rosikopulos (Consultant)
Hi Loic,
Quoted 29 lines · Loic Poulain
Add a V4L2 meta format code (
V4L2_META_FMT_QCOM_ISP_PARAMS) for the Qualcomm CAMSS ISP parameter buffer. This format is used by the params video node exposed by CAMSS offline ISP drivers (e.g. OPE) to carry ISP tuning data such as white balance, color correction and chroma enhancement settings.Signed-off-by Loic Poulain <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 4 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1471,6 +1471,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_C3ISP_STATS : descr ="Amlogic C3 ISP Statistics" ;break ;case V4L2_META_FMT_MALI_C55_PARAMS : descr ="ARM Mali-C55 ISP Parameters" ;break ;case V4L2_META_FMT_MALI_C55_STATS : descr ="ARM Mali-C55 ISP 3A Statistics" ;break ; +case V4L2_META_FMT_QCOM_ISP_PARAMS : descr ="Qualcomm CAMSS ISP Parameters" ;break ;case V4L2_PIX_FMT_NV12_8L128 : descr ="NV12 (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12M_8L128 : descr ="NV12M (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12_10BE_8L128 : descr ="10-bit NV12 (8x128 Linear, BE)" ;break ;include/uapi/linux/videodev2.h +0
-0include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 891
Quoted 4 lines
include/uapi/linux/videodev2.h +1
-0@@ -888,6 +888,9 @@ struct v4l2_pix_format {#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P')/* ARM Mali-C55 Parameters */ #define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S')/* ARM Mali-C55 3A Statistics */ +/* Vendor specific - used for Qualcomm CAMSS offline ISP */ It seems that this is generic format for ISP parameters, can we update the comment and remove offline. The proposal:
/* Vendor specific - used for Qualcomm CAMSS ISP */
Quoted 6 lines
Quoted 2 lines
Sure.
LoicSince these are not the full list and as I understand them not the full structures for OPE - qcom restricting the full formats ? - I'd request to move these to an OPE specific header.
Yes, I think the params struct can be OPE-specific and defined in an OPE-specific header. However, could we keep the enum in a generic header so that we only have a single enum definition? We could then extend it later with OPE-specific or non-OPE-specific parameters as needed.
Regards,
Loic
Re: [PATCH v5 1/5] media: qcom: camss: Add V4L2 meta format for CAMSS ISP parameters
Quoted 53 lines · Loic Poulain
Quoted 45 lines · Bryan O'Donoghue
Quoted 43 lines · Loic Poulain
Quoted 40 lines · Gjorgji Rosikopulos (Consultant)
Hi Loic,
Quoted 29 lines · Loic Poulain
Add a V4L2 meta format code (
V4L2_META_FMT_QCOM_ISP_PARAMS) for the Qualcomm CAMSS ISP parameter buffer. This format is used by the params video node exposed by CAMSS offline ISP drivers (e.g. OPE) to carry ISP tuning data such as white balance, color correction and chroma enhancement settings.Signed-off-by Loic Poulain <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 4 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1471,6 +1471,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_C3ISP_STATS : descr ="Amlogic C3 ISP Statistics" ;break ;case V4L2_META_FMT_MALI_C55_PARAMS : descr ="ARM Mali-C55 ISP Parameters" ;break ;case V4L2_META_FMT_MALI_C55_STATS : descr ="ARM Mali-C55 ISP 3A Statistics" ;break ; +case V4L2_META_FMT_QCOM_ISP_PARAMS : descr ="Qualcomm CAMSS ISP Parameters" ;break ;case V4L2_PIX_FMT_NV12_8L128 : descr ="NV12 (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12M_8L128 : descr ="NV12M (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12_10BE_8L128 : descr ="10-bit NV12 (8x128 Linear, BE)" ;break ;include/uapi/linux/videodev2.h +0
-0include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 891
Quoted 4 lines
include/uapi/linux/videodev2.h +1
-0@@ -888,6 +888,9 @@ struct v4l2_pix_format {#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P')/* ARM Mali-C55 Parameters */ #define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S')/* ARM Mali-C55 3A Statistics */ +/* Vendor specific - used for Qualcomm CAMSS offline ISP */ It seems that this is generic format for ISP parameters, can we update the comment and remove offline. The proposal:
/* Vendor specific - used for Qualcomm CAMSS ISP */Quoted 6 lines
Quoted 2 lines
Sure.
LoicSince these are not the full list and as I understand them not the full structures for OPE - qcom restricting the full formats ? - I'd request to move these to an OPE specific header.
Quoted 5 lines
Yes, I think the params struct can be OPE-specific and defined in an OPE-specific header. However, could we keep the enum in a generic header so that we only have a single enum definition? We could then extend it later with OPE-specific or non-OPE-specific parameters as needed.
The format V4L2_META_FMT_QCOM_ISP_PARAMS will be common (based on its name) across all ISP versions.
This will make it confusing for userspace to know which header to use for a given ISP version.
It would be better to have at least some protection in place to reject param types that aren't supported by a specific version. I think the simpler approach is to keep these as generic Qcom-specific params for now,
and only split them out if we actually end up with the same blocks using different parameters across versions. But for sure that can be done latter when new params and ISP's are introduced. It was just an proposal.
~Gjorgji
Quoted 3 lines
Regards,
Loic
Loic Poulain
reviewerPATCH v5 2/5 dt-bindings: media: qcom: Add CAMSS Offline Processing Engine (OPE)
In reply to Loic PoulainAdd Devicetree binding documentation for the Qualcomm Camera Subsystem Offline Processing Engine (OPE) found on platforms such as Agatti. The OPE is a memory-to-memory image processing block which operates on frames read from and written back to system memory.
--- .../bindings/media/qcom,qcm2290-camss-ope.yaml | 151 +++++++++++++++++++++ 1 file changed, 151 insertions(+)
Documentation/devicetree/bindings/media/qcom,qcm2290-camss-ope.yaml new file +151 -0
@@ -0,0 +1,151 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/qcom,qcm2290-camss-ope.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Camera Subsystem Offline Processing Engine + +maintainers: + - Loic Poulain <[email protected]> + +description: + The Qualcomm Camera Subsystem (CAMSS) Offline Processing Engine (OPE) + is a memory-to-memory image processing block. It supports a range of + pixel-processing operations such as scaling, cropping, gain adjustments, + white-balancing, and various format conversions. The OPE does not + interface directly with image sensors, instead, it processes frames + sourced from and written back to system memory. + +properties: + compatible: + const: qcom,qcm2290-camss-ope + + reg: + maxItems: 6 + + reg-names: + items: + - const: cdm + - const: top + - const: qos + - const: pipeline + - const: bus_read + - const: bus_write + + clocks: + maxItems: 5 + + clock-names: + items: + - const: axi + - const: core + - const: iface + - const: nrt + - const: top + + interrupts: + maxItems: 1 + + interconnects: + maxItems: 2 + + interconnect-names: + items: + - const: config + - const: data + + iommus: + items: + - description: OPE CDM (Configuration DMA) port. + - description: OPE read (fetch engine) port. + - description: OPE write (write engine) port. + + operating-points-v2: true + + opp-table: + type: object + + power-domains: + items: + - description: GDSC CAMSS Block, Global Distributed Switch Controller. + - description: CX power domain. + + power-domain-names: + items: + - const: camss + - const: cx + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - interrupts + - interconnects + - interconnect-names + - iommus + - power-domains + - power-domain-names + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/qcom,gcc-qcm2290.h> + #include <dt-bindings/interconnect/qcom,qcm2290.h> + #include <dt-bindings/interconnect/qcom,rpm-icc.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/qcom-rpmpd.h> + + camss_ope: isp@5c42000 { + compatible = "qcom,qcm2290-camss-ope"; + + reg = <0x5c42000 0x400>, + <0x5c42400 0x200>, + <0x5c42600 0x200>, + <0x5c42800 0x4400>, + <0x5c46c00 0x190>, + <0x5c46d90 0xa00>; + reg-names = "cdm", "top", "qos", "pipeline", + "bus_read", "bus_write"; + + clocks = <&gcc GCC_CAMSS_AXI_CLK>, + <&gcc GCC_CAMSS_OPE_CLK>, + <&gcc GCC_CAMSS_OPE_AHB_CLK>, + <&gcc GCC_CAMSS_NRT_AXI_CLK>, + <&gcc GCC_CAMSS_TOP_AHB_CLK>; + clock-names = "axi", "core", "iface", "nrt", "top"; + + interrupts = <GIC_SPI 209 IRQ_TYPE_EDGE_RISING>; + + interconnects = <&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG + &config_noc SLAVE_CAMERA_CFG RPM_ACTIVE_TAG>, + <&mmnrt_virt MASTER_CAMNOC_SF RPM_ALWAYS_TAG + &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>; + interconnect-names = "config", "data"; + + iommus = <&apps_smmu 0x800 0x0>, + <&apps_smmu 0x820 0x0>, + <&apps_smmu 0x840 0x0>; + + operating-points-v2 = <&ope_opp_table>; + power-domains = <&gcc GCC_CAMSS_TOP_GDSC>, + <&rpmpd QCM2290_VDDCX>; + power-domain-names = "camss", "cx"; + + ope_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-200000000 { + opp-hz = /bits/ 64 <200000000>; + required-opps = <&rpmpd_opp_svs>; + }; + + opp-465000000 { + opp-hz = /bits/ 64 <465000000>; + required-opps = <&rpmpd_opp_nom>; + }; + }; + };
Signature · 1 line
2.34.1
Loic Poulain
reviewerPATCH v5 3/5 media: uapi: Add CAMSS OPE ISP configuration definition
In reply to Loic PoulainAdd the uapi header camss-ope-config.h defining the ISP parameter structures used by the CAMSS Offline Processing Engine (OPE) driver. This includes structures for white balance, chroma enhancement and color correction configuration.
--- include/uapi/linux/camss-ope-config.h | 160 ++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+)
include/uapi/linux/camss-ope-config.h new file +160 -0
@@ -0,0 +1,160 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* +* Qualcomm CAMSS Offline Processing Engine (OPE) ISP parameters UAPI +* +* Uses the generic V4L2 extensible ISP parameters buffer format defined in +* <uapi/linux/media/v4l2-isp.h>. +* +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +*/ + +#ifndef _UAPI_LINUX_CAMSS_OPE_CONFIG_H +#define _UAPI_LINUX_CAMSS_OPE_CONFIG_H + +#include <linux/types.h> +#include <linux/media/v4l2-isp.h> + +/** +* enum camss_ope_params_block_type - CAMSS ISP parameter block identifiers +* +* Each value identifies one ISP processing block. The value is placed in +* the @type field of &struct v4l2_isp_params_block_header. +*/ +enum camss_ope_params_block_type { +CAMSS_OPE_PARAMS_WB_GAIN =1 , +CAMSS_OPE_PARAMS_CHROMA_ENHAN =2 , +CAMSS_OPE_PARAMS_COLOR_CORRECT =3 , +}; + +/** +* struct camss_ope_params_wb_gain - White Balance gains +* +* Implements the CLC_WB pipeline module. The pipeline applies three +* sequential operations per channel: +* 1. Subtract sub-offset (black-level subtraction) +* 2. Multiply by gain (colour balance) +* 3. Add add-offset (output pedestal) +* +* Gains are 15uQ10 (15-bit unsigned, 10 fractional bits). Offsets +* are 16-bit unsigned, normalised to full input scale (65535 = 1.0) +* +* @header: block header; @header.type = CAMSS_OPE_PARAMS_WB_GAIN +* @g_gain: green channel gain (15uQ10, 1024 = 1.0) +* @b_gain: blue channel gain (15uQ10, 1024 = 1.0) +* @r_gain: red channel gain (15uQ10, 1024 = 1.0) +* @g_sub: green sub-offset, subtracted before gain (16u) +* @b_sub: blue sub-offset, subtracted before gain (16u) +* @r_sub: red sub-offset, subtracted before gain (16u) +* @g_add: green add-offset, added after gain (16u) +* @b_add: blue add-offset, added after gain (16u) +* @r_add: red add-offset, added after gain (16u) +*/ +struct camss_ope_params_wb_gain { +struct v4l2_isp_params_block_header header; +__u16 g_gain; +__u16 b_gain; +__u16 r_gain; +__u16 g_sub; +__u16 b_sub; +__u16 r_sub; +__u16 g_add; +__u16 b_add; +__u16 r_add; +__u16 _pad[3 ]; +} __attribute__((aligned (8 ))); + +/** +* struct camss_ope_params_chroma_enhan - RGB to YUV colour transfer matrix +* +* Implements the CLC_CHROMA_ENHAN pipeline module. All coefficients are +* signed 12-bit fixed-point Q3.8 (range roughly -8.0 to +7.996). +* +* RGB2Y - Luma (Y) coefficients +* Y = v0 * R + v1 * G + v2 * B +* +* @luma_v0: R-to-Y coefficient (12sQ8) +* @luma_v1: G-to-Y coefficient (12sQ8) +* @luma_v2: B-to-Y coefficient (12sQ8) +* @luma_k: Y output offset (9s, 0 = no offset) +* +* RGB2Cb - Chroma (Cb) coefficients +* Cb = a x ((B - G) + b(R - G)) + KCb +* with: +* a = ap, when (B-G) + b(R-G) > 0; a = am, when (B-G) + b(R-G) ≤ 0; +* b = bp when (R-G) > 0; b = bm when (R-G) ≤ 0 +* +* @coeff_ap: Cb positive coefficient (12sQ8) +* @coeff_am: Cb negative coefficient (12sQ8) +* @coeff_bp: Cb positive coefficient (12sQ8) +* @coeff_bm: Cb negative coefficient (12sQ8) +* @kcb: Cb output offset (11s) +* +* RGB2Cr - Chroma (Cr) coefficients: +* Cr = c x ((R - G) + d(B - G)) + KCr +* with: +* c = cp, when (R-G) + d(B-G) > 0; c = cm, when (R-G) + d(B-G) ≤ 0 +* d = dp when (B-G) > 0; d = dm when (B-G) ≤ 0 +* +* @coeff_cp: Cr positive coefficient (12sQ8) +* @coeff_cm: Cr negative coefficient (12sQ8) +* @coeff_dp: Cr positive coefficient (12sQ8) +* @coeff_dm: Cr negative coefficient (12sQ8) +* @kcr: Cr output offset (11s) +* +* @header: generic block header; @header.type = CAMSS_OPE_PARAMS_CHROMA_ENHAN +*/ +struct camss_ope_params_chroma_enhan { +struct v4l2_isp_params_block_header header; +__u16 luma_v0; +__u16 luma_v1; +__u16 luma_v2; +__u16 luma_k; +__u16 coeff_ap; +__u16 coeff_am; +__u16 coeff_bp; +__u16 coeff_bm; +__u16 coeff_cp; +__u16 coeff_cm; +__u16 coeff_dp; +__u16 coeff_dm; +__u16 kcb; +__u16 kcr; +__u16 _pad[2 ]; +} __attribute__((aligned (8 ))); + +/** +* struct camss_ope_params_color_correct - colour correction matrix +* +* Implements the CLC_CC pipeline module. The matrix computes: +* Out_ch0 (G) = a0*G + b0*B + c0*R + k0 +* Out_ch1 (B) = a1*G + b1*B + c1*R + k1 +* Out_ch2 (R) = a2*G + b2*B + c2*R + k2 +* +* @header: block header; @header.type = CAMSS_OPE_PARAMS_COLOR_CORRECT +* @a: G-input coefficients per output channel (12s; +* a[0]=Out_G, a[1]=Out_B, a[2]=Out_R) +* @b: B-input coefficients (12s) +* @c: R-input coefficients (12s) +* @k: per-output-channel offsets (typically 9s effective) +* @qfactor: Q-format selector (2u): +* 0 = 12sQ7 (range ~-16.0 .. +15.992) +* 1 = 12sQ8 (range ~-8.0 .. +7.996) +* 2 = 12sQ9 (range ~-4.0 .. +3.998) +* 3 = 12sQ10 (range ~-2.0 .. +1.999) +*/ +struct camss_ope_params_color_correct { +struct v4l2_isp_params_block_header header; +__u16 a[3 ]; +__u16 b[3 ]; +__u16 c[3 ]; +__u16 k[3 ]; +__u16 qfactor; +__u16 _pad[3 ]; +} __attribute__((aligned (8 ))); + +#define CAMSS_OPE_PARAMS_MAX_PAYLOAD \ + (sizeof(struct camss_ope_params_wb_gain) +\ + sizeof(struct camss_ope_params_chroma_enhan) +\ + sizeof(struct camss_ope_params_color_correct)) + +#endif /* _UAPI_LINUX_CAMSS_OPE_CONFIG_H */
Signature · 1 line
2.34.1
Re: [PATCH v5 3/5] media: uapi: Add CAMSS OPE ISP configuration definition
Hi Loic, et.al,
Quoted 33 lines · Loic Poulain
Add the uapi header
camss-ope-config.hdefining the ISP parameter structures used by the CAMSS Offline Processing Engine (OPE) driver. This includes structures for white balance, chroma enhancement and color correction configuration.Signed-off-by Loic Poulain <[email protected]>--- include/uapi/linux/camss-ope-config.h | 160 ++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+)include/uapi/linux/camss-ope-config.h new file +17
-0@@ -0,0 +1,160 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* +* Qualcomm CAMSS Offline Processing Engine (OPE) ISP parameters UAPI +* +* Uses the generic V4L2 extensible ISP parameters buffer format defined in +* <uapi/linux/media/v4l2-isp.h>. +* +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +*/ + +#ifndef _UAPI_LINUX_CAMSS_OPE_CONFIG_H +#define _UAPI_LINUX_CAMSS_OPE_CONFIG_H + +#include <linux/types.h> +#include <linux/media/v4l2-isp.h> + +/**
include/uapi/linux/camss-ope-config.h line 27
Quoted 10 lines
include/uapi/linux/camss-ope-config.h new file +10
-0+* enum camss_ope_params_block_type - CAMSS ISP parameter block identifiers +* +* Each value identifies one ISP processing block. The value is placed in +* the @type field of &struct v4l2_isp_params_block_header. +*/ +enum camss_ope_params_block_type { +CAMSS_OPE_PARAMS_WB_GAIN =1 , +CAMSS_OPE_PARAMS_CHROMA_ENHAN =2 , +CAMSS_OPE_PARAMS_COLOR_CORRECT =3 , +};
I don't think we want this enum to be OPE specific. The whole idea behind the extensible ISP parameters is that there is a single set of parameter definitions spanning multiple ISP generations.
There is going to be a mirroring patch for libcamera defining some C++ magic around this header:
https://patchwork.libcamera.org/patch/27430/
and this will be used in the camss libcamera IPA and we don't want to have one version of the libcamera wrapper per ISP "generation".
So I think this should all be moved back to a generic camss-config.h (or maybe camss-parameters.h ?) and then if for the planned Hamoa / Monoca inline ISP work of we need say a new version of CAMSS_PARAMS_WB_GAIN just add a CAMSS_OPE_PARAMS_WB_GAIN_V2 for that.
That is the whole idea behind the extensible params, otherwise libcamera will effectively need to have 1 IPA per ISP generation / type which is not what we want.
Regards,
Hans
Quoted 134 lines
include/uapi/linux/camss-ope-config.h new file +133
-0+ +/** +* struct camss_ope_params_wb_gain - White Balance gains +* +* Implements the CLC_WB pipeline module. The pipeline applies three +* sequential operations per channel: +* 1. Subtract sub-offset (black-level subtraction) +* 2. Multiply by gain (colour balance) +* 3. Add add-offset (output pedestal) +* +* Gains are 15uQ10 (15-bit unsigned, 10 fractional bits). Offsets +* are 16-bit unsigned, normalised to full input scale (65535 = 1.0) +* +* @header: block header; @header.type = CAMSS_OPE_PARAMS_WB_GAIN +* @g_gain: green channel gain (15uQ10, 1024 = 1.0) +* @b_gain: blue channel gain (15uQ10, 1024 = 1.0) +* @r_gain: red channel gain (15uQ10, 1024 = 1.0) +* @g_sub: green sub-offset, subtracted before gain (16u) +* @b_sub: blue sub-offset, subtracted before gain (16u) +* @r_sub: red sub-offset, subtracted before gain (16u) +* @g_add: green add-offset, added after gain (16u) +* @b_add: blue add-offset, added after gain (16u) +* @r_add: red add-offset, added after gain (16u) +*/ +struct camss_ope_params_wb_gain { +struct v4l2_isp_params_block_header header; +__u16 g_gain; +__u16 b_gain; +__u16 r_gain; +__u16 g_sub; +__u16 b_sub; +__u16 r_sub; +__u16 g_add; +__u16 b_add; +__u16 r_add; +__u16 _pad[3 ]; +} __attribute__((aligned (8 ))); + +/** +* struct camss_ope_params_chroma_enhan - RGB to YUV colour transfer matrix +* +* Implements the CLC_CHROMA_ENHAN pipeline module. All coefficients are +* signed 12-bit fixed-point Q3.8 (range roughly -8.0 to +7.996). +* +* RGB2Y - Luma (Y) coefficients +* Y = v0 * R + v1 * G + v2 * B +* +* @luma_v0: R-to-Y coefficient (12sQ8) +* @luma_v1: G-to-Y coefficient (12sQ8) +* @luma_v2: B-to-Y coefficient (12sQ8) +* @luma_k: Y output offset (9s, 0 = no offset) +* +* RGB2Cb - Chroma (Cb) coefficients +* Cb = a x ((B - G) + b(R - G)) + KCb +* with: +* a = ap, when (B-G) + b(R-G) > 0; a = am, when (B-G) + b(R-G) ≤ 0; +* b = bp when (R-G) > 0; b = bm when (R-G) ≤ 0 +* +* @coeff_ap: Cb positive coefficient (12sQ8) +* @coeff_am: Cb negative coefficient (12sQ8) +* @coeff_bp: Cb positive coefficient (12sQ8) +* @coeff_bm: Cb negative coefficient (12sQ8) +* @kcb: Cb output offset (11s) +* +* RGB2Cr - Chroma (Cr) coefficients: +* Cr = c x ((R - G) + d(B - G)) + KCr +* with: +* c = cp, when (R-G) + d(B-G) > 0; c = cm, when (R-G) + d(B-G) ≤ 0 +* d = dp when (B-G) > 0; d = dm when (B-G) ≤ 0 +* +* @coeff_cp: Cr positive coefficient (12sQ8) +* @coeff_cm: Cr negative coefficient (12sQ8) +* @coeff_dp: Cr positive coefficient (12sQ8) +* @coeff_dm: Cr negative coefficient (12sQ8) +* @kcr: Cr output offset (11s) +* +* @header: generic block header; @header.type = CAMSS_OPE_PARAMS_CHROMA_ENHAN +*/ +struct camss_ope_params_chroma_enhan { +struct v4l2_isp_params_block_header header; +__u16 luma_v0; +__u16 luma_v1; +__u16 luma_v2; +__u16 luma_k; +__u16 coeff_ap; +__u16 coeff_am; +__u16 coeff_bp; +__u16 coeff_bm; +__u16 coeff_cp; +__u16 coeff_cm; +__u16 coeff_dp; +__u16 coeff_dm; +__u16 kcb; +__u16 kcr; +__u16 _pad[2 ]; +} __attribute__((aligned (8 ))); + +/** +* struct camss_ope_params_color_correct - colour correction matrix +* +* Implements the CLC_CC pipeline module. The matrix computes: +* Out_ch0 (G) = a0*G + b0*B + c0*R + k0 +* Out_ch1 (B) = a1*G + b1*B + c1*R + k1 +* Out_ch2 (R) = a2*G + b2*B + c2*R + k2 +* +* @header: block header; @header.type = CAMSS_OPE_PARAMS_COLOR_CORRECT +* @a: G-input coefficients per output channel (12s; +* a[0]=Out_G, a[1]=Out_B, a[2]=Out_R) +* @b: B-input coefficients (12s) +* @c: R-input coefficients (12s) +* @k: per-output-channel offsets (typically 9s effective) +* @qfactor: Q-format selector (2u): +* 0 = 12sQ7 (range ~-16.0 .. +15.992) +* 1 = 12sQ8 (range ~-8.0 .. +7.996) +* 2 = 12sQ9 (range ~-4.0 .. +3.998) +* 3 = 12sQ10 (range ~-2.0 .. +1.999) +*/ +struct camss_ope_params_color_correct { +struct v4l2_isp_params_block_header header; +__u16 a[3 ]; +__u16 b[3 ]; +__u16 c[3 ]; +__u16 k[3 ]; +__u16 qfactor; +__u16 _pad[3 ]; +} __attribute__((aligned (8 ))); + +#define CAMSS_OPE_PARAMS_MAX_PAYLOAD \ + (sizeof(struct camss_ope_params_wb_gain) +\ + sizeof(struct camss_ope_params_chroma_enhan) +\ + sizeof(struct camss_ope_params_color_correct)) + +#endif /* _UAPI_LINUX_CAMSS_OPE_CONFIG_H */
Re: [PATCH v5 3/5] media: uapi: Add CAMSS OPE ISP configuration definition
Hi Loic, Hans,
Quoted 59 lines · On 7/29/2026 4:27 PM, [email protected] wrote:
Hi Loic, et.al,
Quoted 33 lines · Loic Poulain
Add the uapi header
camss-ope-config.hdefining the ISP parameter structures used by the CAMSS Offline Processing Engine (OPE) driver. This includes structures for white balance, chroma enhancement and color correction configuration.Signed-off-by Loic Poulain <[email protected]>--- include/uapi/linux/camss-ope-config.h | 160 ++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+)include/uapi/linux/camss-ope-config.h new file +17
-0@@ -0,0 +1,160 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* +* Qualcomm CAMSS Offline Processing Engine (OPE) ISP parameters UAPI +* +* Uses the generic V4L2 extensible ISP parameters buffer format defined in +* <uapi/linux/media/v4l2-isp.h>. +* +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +*/ + +#ifndef _UAPI_LINUX_CAMSS_OPE_CONFIG_H +#define _UAPI_LINUX_CAMSS_OPE_CONFIG_H + +#include <linux/types.h> +#include <linux/media/v4l2-isp.h> + +/** include/uapi/linux/camss-ope-config.h line 27
Quoted 10 lines
include/uapi/linux/camss-ope-config.h new file +10
-0+* enum camss_ope_params_block_type - CAMSS ISP parameter block identifiers +* +* Each value identifies one ISP processing block. The value is placed in +* the @type field of &struct v4l2_isp_params_block_header. +*/ +enum camss_ope_params_block_type { +CAMSS_OPE_PARAMS_WB_GAIN =1 , +CAMSS_OPE_PARAMS_CHROMA_ENHAN =2 , +CAMSS_OPE_PARAMS_COLOR_CORRECT =3 , +};I don't think we want this enum to be OPE specific. The whole idea behind the extensible ISP parameters is that there is a single set of parameter definitions spanning multiple ISP generations.
There is going to be a mirroring patch for libcamera defining some C++ magic around this header:
https://patchwork.libcamera.org/patch/27430/
and this will be used in the camss libcamera IPA and we don't want to have one version of the libcamera wrapper per ISP "generation".
Quoted 8 lines
So I think this should all be moved back to a generic
camss-config.h(or maybecamss-parameters.h?) and then if for the planned Hamoa / Monoca inline ISP work of we need say a new version ofCAMSS_PARAMS_WB_GAINjust add aCAMSS_OPE_PARAMS_WB_GAIN_V2for that.That is the whole idea behind the extensible params, otherwise libcamera will effectively need to have 1 IPA per ISP generation / type which is not what we want.
Can we change the name of the header to not be OPE specific. An proposal will be camss-config.h, i believe most of the parameters will be the same for other ISP versions.
~Gjorgji
Loic Poulain
reviewerPATCH v5 4/5 media: qcom: camss: Add CAMSS Offline Processing Engine driver
In reply to Loic PoulainAdd an image processing driver for the Qualcomm Offline Processing Engine (OPE). OPE is a memory-to-memory ISP block that converts raw Bayer frames to YUV, performing white balance, demosaic, chroma enhancement, color correction and downscaling.
The hardware architecture consists of Fetch Engines and Write Engines, connected through intermediate pipeline modules for pix processing.
The driver exposes three video nodes per pipeline instance:
- ope_input: Bayer RAW input (V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
- ope_disp_output: YUV output (V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
- ope_params: ISP parameters (V4L2_BUF_TYPE_META_OUTPUT)
Hardware features:
- Stripe-based processing (up to 336 pixels wide per stripe)
- White balance (CLC_WB)
- Demosaic / Bayer-to-RGB (CLC_DEMO)
- RGB-to-YUV conversion (CLC_CHROMA_ENHAN)
- Color correction matrix (CLC_CC)
- MN downscaler for chroma and luma planes
Default configuration values are based on public standards such as BT.601.
Processing Model:
OPE processes frames in stripes of up to 336 pixels. Therefore, frames must be split into stripes for processing. Each stripe is configured after the previous one has been acquired (double buffered registers). To minimize inter-stripe latency, stripe configurations are generated ahead of time.
The driver is split into three source files under the ope/ directory:
- core.c: the OPE m2m driver itself: probe, power management, V4L2/media device setup, format handling, stripe generation and hardware programming.
- pipeline.c/.h: a small declarative media-controller topology builder. Drivers describe their entire media graph, entities (video devices, subdevs, or base entities), their pads, and the links between them, in a static descriptor table. The builder validates the table, allocates and registers all entities, and creates all MC pad links. It is kept generic but currently only used by OPE.
- params.c/.h: V4L2 ISP parameter buffer validation and dispatch. It wraps the extensible V4L2 ISP parameters buffer format, validating the buffer size and each per-block header before forwarding every block to its driver-supplied handler.
--- drivers/media/platform/qcom/camss/Kconfig | 2 + drivers/media/platform/qcom/camss/Makefile | 2 + drivers/media/platform/qcom/camss/ope/Kconfig | 16 + drivers/media/platform/qcom/camss/ope/Makefile | 9 + drivers/media/platform/qcom/camss/ope/core.c | 3353 ++++++++++++++++++++++ drivers/media/platform/qcom/camss/ope/params.c | 75 + drivers/media/platform/qcom/camss/ope/params.h | 62 + drivers/media/platform/qcom/camss/ope/pipeline.c | 399 +++ drivers/media/platform/qcom/camss/ope/pipeline.h | 237 ++ 9 files changed, 4155 insertions(+)
drivers/media/platform/qcom/camss/Kconfig +2 -0
@@ -7,3 +7,5 @@ config VIDEO_QCOM_CAMSS select VIDEO_V4L2_SUBDEV_API select VIDEOBUF2_DMA_SG select V4L2_FWNODE + +source "drivers/media/platform/qcom/camss/ope/Kconfig"
drivers/media/platform/qcom/camss/Makefile +2 -0
@@ -29,3 +29,5 @@ qcom-camss-objs += \ camss-format.o \ obj-$(CONFIG_VIDEO_QCOM_CAMSS) += qcom-camss.o + +obj-$(CONFIG_VIDEO_QCOM_CAMSS_OPE) += ope/
drivers/media/platform/qcom/camss/ope/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +config VIDEO_QCOM_CAMSS_OPE + tristate "Qualcomm Offline Processing Engine (OPE) driver" + depends on V4L_PLATFORM_DRIVERS + depends on VIDEO_DEV + depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST + select V4L2_ISP + select VIDEOBUF2_DMA_CONTIG + select VIDEOBUF2_VMALLOC + help + Enable support for the Qualcomm Offline Processing Engine (OPE). + OPE is a memory-to-memory ISP block that converts raw Bayer frames + to YUV, performing white balance, demosaic, chroma enhancement and + downscaling. Found on QCM2290 and related SoCs. + + To compile this driver as a module, choose M here: the module + will be called qcom-camss-ope.
drivers/media/platform/qcom/camss/ope/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Makefile for Qualcomm CAMSS Offline Processing Engine (OPE) driver + +qcom-camss-ope-objs := \ + core.o \ + pipeline.o \ + params.o + +obj-$(CONFIG_VIDEO_QCOM_CAMSS_OPE) += qcom-camss-ope.o
drivers/media/platform/qcom/camss/ope/core.c new file +3353 -0
2,965 lines not on this page · raw message
drivers/media/platform/qcom/camss/ope/params.c new file +75 -0
75 lines not on this page · raw message
drivers/media/platform/qcom/camss/ope/params.h new file +62 -0
62 lines not on this page · raw message
drivers/media/platform/qcom/camss/ope/pipeline.c new file +399 -0
399 lines not on this page · raw message
drivers/media/platform/qcom/camss/ope/pipeline.h new file +237 -0
237 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.34.1
Part of the diff is not shown here. View the raw message.
Re: [PATCH v5 4/5] media: qcom: camss: Add CAMSS Offline Processing Engine driver
Hi Loic,
Quoted 62 lines · Loic Poulain
Add an image processing driver for the Qualcomm Offline Processing Engine (OPE). OPE is a memory-to-memory ISP block that converts raw Bayer frames to YUV, performing white balance, demosaic, chroma enhancement, color correction and downscaling.
The hardware architecture consists of Fetch Engines and Write Engines, connected through intermediate pipeline modules for pix processing.
The driver exposes three video nodes per pipeline instance:
-ope_input: Bayer RAW input (V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
-ope_disp_output: YUV output (V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
-ope_params: ISP parameters (V4L2_BUF_TYPE_META_OUTPUT)Hardware features:
- Stripe-based processing (up to 336 pixels wide per stripe)
- White balance (CLC_WB)
- Demosaic / Bayer-to-RGB (CLC_DEMO)
- RGB-to-YUV conversion (CLC_CHROMA_ENHAN)
- Color correction matrix (CLC_CC)
- MN downscaler for chroma and luma planesDefault configuration values are based on public standards such as BT.601.
Processing Model:
OPE processes frames in stripes of up to 336 pixels. Therefore, frames must be split into stripes for processing. Each stripe is configured after the previous one has been acquired (double buffered registers). To minimize inter-stripe latency, stripe configurations are generated ahead of time.The driver is split into three source files under the ope/ directory:
-
core.c: the OPE m2m driver itself: probe, power management, V4L2/media device setup, format handling, stripe generation and hardware programming.- pipeline.c/.h: a small declarative media-controller topology builder. Drivers describe their entire media graph, entities (video devices, subdevs, or base entities), their pads, and the links between them, in a static descriptor table. The builder validates the table, allocates and registers all entities, and creates all MC pad links. It is kept generic but currently only used by OPE.
- params.c/.h: V4L2 ISP parameter buffer validation and dispatch. It wraps the extensible V4L2 ISP parameters buffer format, validating the buffer size and each per-block header before forwarding every block to its driver-supplied handler.
Signed-off-by Loic Poulain <[email protected]>Co-developed-by Hans de Goede <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- drivers/media/platform/qcom/camss/Kconfig | 2 + drivers/media/platform/qcom/camss/Makefile | 2 + drivers/media/platform/qcom/camss/ope/Kconfig | 16 + drivers/media/platform/qcom/camss/ope/Makefile | 9 + drivers/media/platform/qcom/camss/ope/core.c | 3353 ++++++++++++++++++++++ drivers/media/platform/qcom/camss/ope/params.c | 75 + drivers/media/platform/qcom/camss/ope/params.h | 62 + drivers/media/platform/qcom/camss/ope/pipeline.c | 399 +++ drivers/media/platform/qcom/camss/ope/pipeline.h | 237 ++ 9 files changed, 4155 insertions(+)
<snip>
Quoted 20 lines
drivers/media/platform/qcom/camss/ope/core.c new file +20
-0+static int ope_open (struct file *file) +{ +struct video_device *vdev =video_devdata (file); + struct ope_dev *ope = container_of(vdev->v4l2_dev, struct ope_dev, v4l2_dev); +struct ope_ctx *ctx; +struct v4l2_fh *fh; +int ret =0 ; + + fh =kzalloc (sizeof (*fh),GFP_KERNEL ); +if (!fh) +return -ENOMEM ; + +if (mutex_lock_interruptible (&ope->mutex)) { +kfree (fh); +return -ERESTARTSYS ; + } + +/* +* For now, only a single shared context is supported, +* until media multi-context support is available.
drivers/media/platform/qcom/camss/ope/core.c line 2890
Quoted 10 lines
drivers/media/platform/qcom/camss/ope/core.c new file +10
-0+*/ +if (!ope->shared_ctx) { + ctx =ope_ctx_create (ope); +if (IS_ERR (ctx)) { + ret =PTR_ERR (ctx); + goto unlock; + } + }else { + ctx = ope->shared_ctx; + }
I am sure there were multiple discussions on how to implement multi-context. But this exact implementation somehow confuses me (maybe just me).
This allows opening the same video node twice (e.g. the output node). vb2_is_busy protection is present everywhere to prevent races, but if two applications open the same video node the driver may end up in a situation where the format set by the first application is overridden by the second, but streaming somehow gets started on the first with the wrong format. The danger is not at the format-set call itself but at start_streaming, when the hardware gets programmed with whatever format is current in the shared context.
Maybe it makes sense to have a tiny wrapper on each OPE V4L2 video device that holds an open count and prevents opening the same video node twice, returning -EBUSY on a second open(), until multi-context support is available as mentioned here.
Regards,
~Gjorgji
Re: [PATCH v5 4/5] media: qcom: camss: Add CAMSS Offline Processing Engine driver
In reply to Loic Poulaindrivers/media/platform/qcom/camss/ope/core.c line 1820
Quoted 5 lines · Loic Poulain
drivers/media/platform/qcom/camss/ope/core.c new file +5
-0+ .start_streaming = ope_start_streaming, + .stop_streaming = ope_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, +};
Hi Loic,
While reviewing the series, I noticed that wait_prepare/wait_finish callbacks and their helpers were removed in:
d0730006dac2 ("media: vb2: remove vb2_ops_wait_prepare/finish helpers") b70886ff5833 ("media: vb2: drop wait_prepare/finish callbacks")
These stale lines are causing a compilation failure:
- .wait_prepare = vb2_ops_wait_prepare,
- .wait_finish = vb2_ops_wait_finish,
Please take care of this while posting next ver.
---
Regards,
Nihal Kumar Gupta
Loic Poulain
reviewerPATCH v5 5/5 arm64: dts: qcom: agatti: Add OPE node
In reply to Loic PoulainAdd the Offline Processing Engine (OPE) device tree node for the Agatti platform (QCM2290). The node describes the five register regions (top, bus_read, bus_write, pipeline, qos), clocks, interrupt, interconnects, IOMMU mappings, and OPP table.
--- arch/arm64/boot/dts/qcom/agatti.dtsi | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+)
arch/arm64/boot/dts/qcom/agatti.dtsi +79 -0
@@ -1935,6 +1935,85 @@ port@1 { }; }; + isp_ope: isp@5c42000 { + compatible = "qcom,qcm2290-camss-ope"; + + reg = <0x0 0x5c42000 0x0 0x400>, + <0x0 0x5c42400 0x0 0x200>, + <0x0 0x5c42600 0x0 0x200>, + <0x0 0x5c42800 0x0 0x4400>, + <0x0 0x5c46c00 0x0 0x190>, + <0x0 0x5c46d90 0x0 0xa00>; + reg-names = "cdm", + "top", + "qos", + "pipeline", + "bus_read", + "bus_write"; + + clocks = <&gcc GCC_CAMSS_AXI_CLK>, + <&gcc GCC_CAMSS_OPE_CLK>, + <&gcc GCC_CAMSS_OPE_AHB_CLK>, + <&gcc GCC_CAMSS_NRT_AXI_CLK>, + <&gcc GCC_CAMSS_TOP_AHB_CLK>; + clock-names = "axi", + "core", + "iface", + "nrt", + "top"; + + interrupts = <GIC_SPI 209 IRQ_TYPE_EDGE_RISING>; + + interconnects = <&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG + &config_noc SLAVE_CAMERA_CFG RPM_ACTIVE_TAG>, + <&mmnrt_virt MASTER_CAMNOC_SF RPM_ALWAYS_TAG + &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>; + interconnect-names = "config", + "data"; + + iommus = <&apps_smmu 0x800 0x0>, + <&apps_smmu 0x820 0x0>, + <&apps_smmu 0x840 0x0>; + + operating-points-v2 = <&ope_opp_table>; + power-domains = <&gcc GCC_CAMSS_TOP_GDSC>, + <&rpmpd QCM2290_VDDCX>; + power-domain-names = "camss", + "cx"; + + status = "disabled"; + + ope_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-19200000 { + opp-hz = /bits/ 64 <19200000>; + required-opps = <&rpmpd_opp_min_svs>; + }; + + opp-200000000 { + opp-hz = /bits/ 64 <200000000>; + required-opps = <&rpmpd_opp_svs>; + }; + + opp-266600000 { + opp-hz = /bits/ 64 <266600000>; + required-opps = <&rpmpd_opp_svs_plus>; + }; + + opp-465000000 { + opp-hz = /bits/ 64 <465000000>; + required-opps = <&rpmpd_opp_nom>; + }; + + opp-580000000 { + opp-hz = /bits/ 64 <580000000>; + required-opps = <&rpmpd_opp_turbo>; + turbo-mode; + }; + }; + }; + mdss: display-subsystem@5e00000 { compatible = "qcom,qcm2290-mdss"; reg = <0x0 0x05e00000 0x0 0x1000>;
Signature · 1 line
2.34.1