diff mbox series

[6/6] arm64: dts: qcom: sdm845-db845c-navigation-mezzanine: Add cma heap for libcamera softisp support

Message ID 20241025-b4-linux-next-24-10-25-camss-dts-fixups-v1-6-cdff2f1a5792@linaro.org (mailing list archive)
State Accepted
Commit d40fd02c1faf8faad57a7579b573bc5be51faabe
Headers show
Series qcom: camss: dts: Prune and tidy x13s, rb5 and rb3 CAMSS dts | expand

Commit Message

Bryan O'Donoghue Oct. 25, 2024, 3:43 p.m. UTC
libcamera softisp requires a linux,cma heap export in order to support
user-space debayering, 3a and export to other system components such as
pipewire, Firefox/Chromium - Hangouts, Zoom etc.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 .../boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso     | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Konrad Dybcio Oct. 25, 2024, 6:07 p.m. UTC | #1
On 25.10.2024 5:43 PM, Bryan O'Donoghue wrote:
> libcamera softisp requires a linux,cma heap export in order to support
> user-space debayering, 3a and export to other system components such as
> pipewire, Firefox/Chromium - Hangouts, Zoom etc.
> 
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---

Same as patch 5

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad
Rob Clark Nov. 1, 2024, 12:33 p.m. UTC | #2
On Fri, Oct 25, 2024 at 8:49 AM Bryan O'Donoghue
<bryan.odonoghue@linaro.org> wrote:
>
> libcamera softisp requires a linux,cma heap export in order to support
> user-space debayering, 3a and export to other system components such as
> pipewire, Firefox/Chromium - Hangouts, Zoom etc.

AFAIU libcamera could use udmabuf, etc, and there is no hw requirement
for CMA.  So it doesn't seem we should be adding this to dt.  And I'd
really prefer that we not be using CMA just for lolz.

BR,
-R

> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  .../boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso     | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
> index d62a20f018e7a7e1c7e77f0c927c2d9fe7ae8509..c8507afcd1e0d1f9b14b6e4edcbc646032e7b6c9 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
> +++ b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
> @@ -9,6 +9,17 @@
>  #include <dt-bindings/clock/qcom,camcc-sdm845.h>
>  #include <dt-bindings/gpio/gpio.h>
>
> +/ {
> +       reserved-memory {
> +               linux,cma {
> +                       compatible = "shared-dma-pool";
> +                       size = <0x0 0x8000000>;
> +                       reusable;
> +                       linux,cma-default;
> +               };
> +       };
> +};
> +
>  &camss {
>         vdda-phy-supply = <&vreg_l1a_0p875>;
>         vdda-pll-supply = <&vreg_l26a_1p2>;
>
> --
> 2.47.0
>
>
Kieran Bingham Nov. 1, 2024, 3:18 p.m. UTC | #3
+Cc Laurent

Quoting Rob Clark (2024-11-01 12:33:44)
> On Fri, Oct 25, 2024 at 8:49 AM Bryan O'Donoghue
> <bryan.odonoghue@linaro.org> wrote:
> >
> > libcamera softisp requires a linux,cma heap export in order to support
> > user-space debayering, 3a and export to other system components such as
> > pipewire, Firefox/Chromium - Hangouts, Zoom etc.
> 
> AFAIU libcamera could use udmabuf, etc, and there is no hw requirement
> for CMA.  So it doesn't seem we should be adding this to dt.  And I'd
> really prefer that we not be using CMA just for lolz.

I agree here. Otherwise this theoretically locks this memory to the pool
'forever'. It's not something we should define in device tree.

udmabuf provides a means to get memfd allocated memory which is not
physically contiguous - but /is/ managed by a dmabuf handle.

Presently with SoftISP being CPU only - physically contiguous memory is
not required.

Bryan, will this still be true when you have a GPU based ISP ? Will that
require physically contiguous memory ? Or will the mapping into the GPU
handle any required translations?

--
Kieran


> 
> BR,
> -R
> 
> > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> > ---
> >  .../boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso     | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
> > index d62a20f018e7a7e1c7e77f0c927c2d9fe7ae8509..c8507afcd1e0d1f9b14b6e4edcbc646032e7b6c9 100644
> > --- a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
> > +++ b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
> > @@ -9,6 +9,17 @@
> >  #include <dt-bindings/clock/qcom,camcc-sdm845.h>
> >  #include <dt-bindings/gpio/gpio.h>
> >
> > +/ {
> > +       reserved-memory {
> > +               linux,cma {
> > +                       compatible = "shared-dma-pool";
> > +                       size = <0x0 0x8000000>;
> > +                       reusable;
> > +                       linux,cma-default;
> > +               };
> > +       };
> > +};
> > +
> >  &camss {
> >         vdda-phy-supply = <&vreg_l1a_0p875>;
> >         vdda-pll-supply = <&vreg_l26a_1p2>;
> >
> > --
> > 2.47.0
> >
> >
Rob Clark Nov. 1, 2024, 4:05 p.m. UTC | #4
On Fri, Nov 1, 2024 at 8:18 AM Kieran Bingham
<kieran.bingham@ideasonboard.com> wrote:
>
> +Cc Laurent
>
> Quoting Rob Clark (2024-11-01 12:33:44)
> > On Fri, Oct 25, 2024 at 8:49 AM Bryan O'Donoghue
> > <bryan.odonoghue@linaro.org> wrote:
> > >
> > > libcamera softisp requires a linux,cma heap export in order to support
> > > user-space debayering, 3a and export to other system components such as
> > > pipewire, Firefox/Chromium - Hangouts, Zoom etc.
> >
> > AFAIU libcamera could use udmabuf, etc, and there is no hw requirement
> > for CMA.  So it doesn't seem we should be adding this to dt.  And I'd
> > really prefer that we not be using CMA just for lolz.
>
> I agree here. Otherwise this theoretically locks this memory to the pool
> 'forever'. It's not something we should define in device tree.
>
> udmabuf provides a means to get memfd allocated memory which is not
> physically contiguous - but /is/ managed by a dmabuf handle.
>
> Presently with SoftISP being CPU only - physically contiguous memory is
> not required.
>
> Bryan, will this still be true when you have a GPU based ISP ? Will that
> require physically contiguous memory ? Or will the mapping into the GPU
> handle any required translations?

GPU does not require phys contiguous.  OTOH it may/will impose some
layout constraints.

I'm kinda leaning towards teaching gbm to allocate YUV plus add a
GBO_BO_USE_CPU usage bit if softisp also needs CPU access.  (Modern
adreno can do cached-coherent buffers, at some small performance cost,
so that CPU access doesn't have to fall off a cliff.)  But that
doesn't exist yet.

BR,
-R

>
> --
> Kieran
>
>
> >
> > BR,
> > -R
> >
> > > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> > > ---
> > >  .../boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso     | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > >
> > > diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
> > > index d62a20f018e7a7e1c7e77f0c927c2d9fe7ae8509..c8507afcd1e0d1f9b14b6e4edcbc646032e7b6c9 100644
> > > --- a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
> > > +++ b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
> > > @@ -9,6 +9,17 @@
> > >  #include <dt-bindings/clock/qcom,camcc-sdm845.h>
> > >  #include <dt-bindings/gpio/gpio.h>
> > >
> > > +/ {
> > > +       reserved-memory {
> > > +               linux,cma {
> > > +                       compatible = "shared-dma-pool";
> > > +                       size = <0x0 0x8000000>;
> > > +                       reusable;
> > > +                       linux,cma-default;
> > > +               };
> > > +       };
> > > +};
> > > +
> > >  &camss {
> > >         vdda-phy-supply = <&vreg_l1a_0p875>;
> > >         vdda-pll-supply = <&vreg_l26a_1p2>;
> > >
> > > --
> > > 2.47.0
> > >
> > >
Bryan O'Donoghue Nov. 2, 2024, 11:38 a.m. UTC | #5
On 01/11/2024 15:18, Kieran Bingham wrote:
> Presently with SoftISP being CPU only - physically contiguous memory is
> not required.

Yes, I've misinterpreted what we discussed, udmabuf should be enough on 
qcom.

> Bryan, will this still be true when you have a GPU based ISP ? Will that
> require physically contiguous memory ? Or will the mapping into the GPU
> handle any required translations?

I believe it should be fine because we do glTexImage2D on the way in ATM 
and have support for eglCreateImageKHR(.., .., .., .., .., 
   EGL_DMA_BUF_PLANE0_FD_EXT, dma_fd); but in either case phys contig 
doesn't matter.

---
bod
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
index d62a20f018e7a7e1c7e77f0c927c2d9fe7ae8509..c8507afcd1e0d1f9b14b6e4edcbc646032e7b6c9 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
+++ b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso
@@ -9,6 +9,17 @@ 
 #include <dt-bindings/clock/qcom,camcc-sdm845.h>
 #include <dt-bindings/gpio/gpio.h>
 
+/ {
+	reserved-memory {
+		linux,cma {
+			compatible = "shared-dma-pool";
+			size = <0x0 0x8000000>;
+			reusable;
+			linux,cma-default;
+		};
+	};
+};
+
 &camss {
 	vdda-phy-supply = <&vreg_l1a_0p875>;
 	vdda-pll-supply = <&vreg_l26a_1p2>;