From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Tomasz Figa <tfiga@chromium.org>,
Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
Ricardo Ribalda <ribalda@chromium.org>,
Christoph Hellwig <hch@lst.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv4 8/8] videobuf2: handle non-contiguous DMA allocations
Date: Mon, 23 Aug 2021 19:29:46 +0900 [thread overview]
Message-ID: <YSN4ms1VoJO2CWNp@google.com> (raw)
In-Reply-To: <fd1e8bbe-4cbe-9586-7c8f-0896af043d4a@xs4all.nl>
On (21/08/03 12:15), Hans Verkuil wrote:
> > static void *vb2_dc_vaddr(struct vb2_buffer *vb, void *buf_priv)
> > {
> > struct vb2_dc_buf *buf = buf_priv;
> > - struct dma_buf_map map;
> > - int ret;
> >
> > - if (!buf->vaddr && buf->db_attach) {
> > - ret = dma_buf_vmap(buf->db_attach->dmabuf, &map);
> > - buf->vaddr = ret ? NULL : map.vaddr;
> > + if (buf->vaddr)
> > + return buf->vaddr;
> > +
> > + if (buf->db_attach) {
> > + struct dma_buf_map map;
> > +
> > + if (!dma_buf_vmap(buf->db_attach->dmabuf, &map))
> > + buf->vaddr = map.vaddr;
> > +
> > + return buf->vaddr;
> > }
> >
> > + if (!buf->coherent_mem)
> > + buf->vaddr = dma_vmap_noncontiguous(buf->dev, buf->size,
> > + buf->dma_sgt);
> > return buf->vaddr;
> > }
>
> This function really needs a bunch of comments.
>
> What I want to see here specifically is under which circumstances this function
> can return NULL.
>
> - dma_buf_vmap returns an error
> - for non-coherent memory dma_vmap_noncontiguous returns an error
> - coherent memory with DMA_ATTR_NO_KERNEL_MAPPING set.
Done.
prev parent reply other threads:[~2021-08-23 10:29 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 7:05 [PATCHv4 0/8] videobuf2: support new noncontiguous DMA API Sergey Senozhatsky
2021-07-27 7:05 ` [PATCHv4 1/8] videobuf2: rework vb2_mem_ops API Sergey Senozhatsky
2021-08-03 8:08 ` Hans Verkuil
2021-08-17 10:41 ` Sergey Senozhatsky
2021-07-27 7:05 ` [PATCHv4 2/8] videobuf2: inverse buffer cache_hints flags Sergey Senozhatsky
2021-07-27 7:05 ` [PATCHv4 3/8] videobuf2: split buffer cache_hints initialisation Sergey Senozhatsky
2021-08-03 8:10 ` Hans Verkuil
2021-08-17 10:41 ` Sergey Senozhatsky
2021-07-27 7:05 ` [PATCHv4 4/8] videobuf2: move cache_hints handling to allocators Sergey Senozhatsky
2021-08-03 8:11 ` Hans Verkuil
2021-08-17 10:42 ` Sergey Senozhatsky
2021-07-27 7:05 ` [PATCHv4 5/8] videobuf2: add V4L2_MEMORY_FLAG_NON_COHERENT flag Sergey Senozhatsky
2021-08-03 8:12 ` Hans Verkuil
2021-08-17 10:42 ` Sergey Senozhatsky
2021-07-27 7:05 ` [PATCHv4 6/8] videobuf2: add queue memory coherency parameter Sergey Senozhatsky
2021-08-03 8:29 ` Hans Verkuil
2021-08-17 10:43 ` Sergey Senozhatsky
2021-07-27 7:05 ` [PATCHv4 7/8] videobuf2: handle V4L2_MEMORY_FLAG_NON_COHERENT flag Sergey Senozhatsky
2021-08-03 8:31 ` Hans Verkuil
2021-08-17 10:43 ` Sergey Senozhatsky
2021-07-27 7:05 ` [PATCHv4 8/8] videobuf2: handle non-contiguous DMA allocations Sergey Senozhatsky
2021-08-03 8:33 ` Hans Verkuil
2021-08-03 8:39 ` Hans Verkuil
2021-08-23 10:28 ` Sergey Senozhatsky
2021-08-23 10:27 ` Sergey Senozhatsky
2021-08-03 10:15 ` Hans Verkuil
2021-08-17 11:56 ` Sergey Senozhatsky
2021-08-18 9:20 ` Tomasz Figa
2021-08-23 10:29 ` Sergey Senozhatsky [this message]
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=YSN4ms1VoJO2CWNp@google.com \
--to=senozhatsky@chromium.org \
--cc=dafna.hirschfeld@collabora.com \
--cc=hch@lst.de \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.org \
--cc=tfiga@chromium.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.