[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <836d600a-bb1c-fbb2-89f5-7c79c3150e8c@linux.intel.com>
Date: Wed, 15 Feb 2023 12:30:51 +0100
From: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
To: Paul Cercueil <paul@...pouillou.net>,
Sumit Semwal <sumit.semwal@...aro.org>,
Christian König <christian.koenig@....com>,
Vinod Koul <vkoul@...nel.org>
Cc: dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linux-media@...r.kernel.org
Subject: Re: Question: partial transfers of DMABUFs
Hey,
On 2023-02-15 11:48, Paul Cercueil wrote:
> Hi,
>
> I am working on adding support for DMABUFs in the IIO subsystem.
>
> One thing we want there, is the ability to specify the number of bytes
> to transfer (while still defaulting to the DMABUF size).
>
> Since dma_buf_map_attachment() returns a sg_table, I basically have two
> options, and I can't decide which one is the best (or the less ugly):
>
> - Either I add a new API function similar to dmaengine_prep_slave_sg(),
> which still takes a scatterlist as argument but also takes the number
> of bytes as argument;
>
> - Or I add a function to duplicate the scatterlist and then shrink it
> manually, which doesn't sound like a good idea either.
>
> What would be the recommended way?
Does this need an api change? If you create a DMA-BUF of size X, it has
to be of size X. You can pad with a dummy page probably if you know it
in advance. But after it has been imported, it cannot change size.
You don´t have to write the entire dma-buf either, so if you want to
create a 1GB buf and only use the first 4K, that is allowed. The
contents of the remainder of the DMA-BUF are undefined. It's up to
userspace to assign a meaning to it.
I think I'm missing something here that makes the whole question m,ake
more sense.
~Maarten
Powered by blists - more mailing lists