Re: [PATCH v2 05/15] staging: mmal-vchiq: Use vc-sm-cma to support zero copy

From: Laurent Pinchart
Date: Wed Nov 15 2023 - 14:27:16 EST


On Wed, Nov 15, 2023 at 08:03:47PM +0100, Stefan Wahren wrote:
> Hi Umang,
>
> Am 09.11.23 um 22:02 schrieb Umang Jain:
> > From: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>
> >
> > With the vc-sm-cma driver we can support zero copy of buffers between
> > the kernel and VPU. Add this support to mmal-vchiq.
> >
> > Signed-off-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>
> > Signed-off-by: Umang Jain <umang.jain@xxxxxxxxxxxxxxxx>
> > ---
> > .../staging/vc04_services/vchiq-mmal/Kconfig | 1 +
> > .../vc04_services/vchiq-mmal/mmal-common.h | 4 +
> > .../vc04_services/vchiq-mmal/mmal-vchiq.c | 84 +++++++++++++++++--
> > .../vc04_services/vchiq-mmal/mmal-vchiq.h | 1 +
> > 4 files changed, 83 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/staging/vc04_services/vchiq-mmal/Kconfig b/drivers/staging/vc04_services/vchiq-mmal/Kconfig
> > index c99525a0bb45..a7c1a7bf516e 100644
> > --- a/drivers/staging/vc04_services/vchiq-mmal/Kconfig
> > +++ b/drivers/staging/vc04_services/vchiq-mmal/Kconfig
> > @@ -1,6 +1,7 @@
> > config BCM2835_VCHIQ_MMAL
> > tristate "BCM2835 MMAL VCHIQ service"
> > depends on BCM2835_VCHIQ
> > + select BCM_VC_SM_CMA
>
> i think we need more explanation in the commit message of the relation
> between these both modules.
>
> On the one side BCM_VC_SM_CMA should be a driver, but it's not a driver
> for a specific hardware. It looks like more an extension of VCHIQ MMAL
> or does other (maybe not yet imported) vc04 driver make also use of this.
>
> My question is: is BCM_VC_SM_CMA a real member on the VCHIQ bus and why?

The vchiq_device pointer passed to the vc_sm_cma probe function is used
in the driver for the sole purpose of accessing the underlying struct
device, which, beside being used for dev_*() log calls, is just passed
to dma_buf_attach(). It does indeed appear to be more of a service than
a device.

--
Regards,

Laurent Pinchart