From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomasz Stanislawski <t.stanislaws@samsung.com>
Cc: ben@bwidawsk.net, daniel.vetter@ffwll.ch,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
kyungmin.park@samsung.com, sakari.ailus@iki.fi,
airlied@redhat.com, m.szyprowski@samsung.com
Subject: Re: [RFCv2 PATCH 1/9] v4l: vb2: fixes for DMABUF support
Date: Thu, 22 Mar 2012 08:56:58 +0100 [thread overview]
Message-ID: <3820725.9Yo0yK24vP@avalon> (raw)
In-Reply-To: <1331633827-503-2-git-send-email-t.stanislaws@samsung.com>
Hi Tomasz,
Thanks for the patch.
On Tuesday 13 March 2012 11:16:59 Tomasz Stanislawski wrote:
> This patch contains fixes to DMABUF support in vb2-core.
> - fixes number of arguments of call_memop macro
> - fixes setup of plane length
> - fixes handling of error pointers
>
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
I suppose this will be squashed with Sumit's "[RFCv1 2/4] v4l:vb2: add support
for shared buffer (dma_buf)" patch.
> ---
> drivers/media/video/videobuf2-core.c | 24 +++++++++++-------------
> include/media/videobuf2-core.h | 6 +++---
> 2 files changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/media/video/videobuf2-core.c
> b/drivers/media/video/videobuf2-core.c index 951cb56..e7df560 100644
> --- a/drivers/media/video/videobuf2-core.c
> +++ b/drivers/media/video/videobuf2-core.c
> @@ -118,7 +118,7 @@ static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb)
> void *mem_priv = vb->planes[plane].mem_priv;
>
> if (mem_priv) {
> - call_memop(q, plane, detach_dmabuf, mem_priv);
> + call_memop(q, detach_dmabuf, mem_priv);
> dma_buf_put(vb->planes[plane].dbuf);
> vb->planes[plane].dbuf = NULL;
> vb->planes[plane].mem_priv = NULL;
> @@ -905,6 +905,8 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb,
> const struct v4l2_buffer *b, }
> if (b->memory == V4L2_MEMORY_DMABUF) {
> for (plane = 0; plane < vb->num_planes; ++plane) {
> + v4l2_planes[plane].bytesused =
> + b->m.planes[plane].bytesused;
> v4l2_planes[plane].m.fd = b->m.planes[plane].m.fd;
> }
> }
> @@ -1052,17 +1054,13 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb,
> const struct v4l2_buffer *b) if (IS_ERR_OR_NULL(dbuf)) {
> dprintk(1, "qbuf: invalid dmabuf fd for "
> "plane %d\n", plane);
> - ret = PTR_ERR(dbuf);
> + ret = -EINVAL;
> goto err;
> }
>
> - /* this doesn't get filled in until __fill_vb2_buffer(),
> - * since it isn't known until after dma_buf_get()..
> - */
> - planes[plane].length = dbuf->size;
> -
> /* Skip the plane if already verified */
> if (dbuf == vb->planes[plane].dbuf) {
> + planes[plane].length = dbuf->size;
> dma_buf_put(dbuf);
> continue;
> }
> @@ -1072,7 +1070,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const
> struct v4l2_buffer *b)
>
> /* Release previously acquired memory if present */
> if (vb->planes[plane].mem_priv) {
> - call_memop(q, plane, detach_dmabuf,
> + call_memop(q, detach_dmabuf,
> vb->planes[plane].mem_priv);
> dma_buf_put(vb->planes[plane].dbuf);
> }
> @@ -1080,8 +1078,8 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const
> struct v4l2_buffer *b) vb->planes[plane].mem_priv = NULL;
>
> /* Acquire each plane's memory */
> - mem_priv = q->mem_ops->attach_dmabuf(
> - q->alloc_ctx[plane], dbuf);
> + mem_priv = call_memop(q, attach_dmabuf, q->alloc_ctx[plane],
> + dbuf, q->plane_sizes[plane], write);
> if (IS_ERR(mem_priv)) {
> dprintk(1, "qbuf: failed acquiring dmabuf "
> "memory for plane %d\n", plane);
> @@ -1089,6 +1087,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const
> struct v4l2_buffer *b) goto err;
> }
>
> + planes[plane].length = dbuf->size;
> vb->planes[plane].dbuf = dbuf;
> vb->planes[plane].mem_priv = mem_priv;
> }
> @@ -1098,8 +1097,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const
> struct v4l2_buffer *b) * the buffer(s)..
> */
> for (plane = 0; plane < vb->num_planes; ++plane) {
> - ret = q->mem_ops->map_dmabuf(
> - vb->planes[plane].mem_priv, write);
> + ret = call_memop(q, map_dmabuf, vb->planes[plane].mem_priv);
> if (ret) {
> dprintk(1, "qbuf: failed mapping dmabuf "
> "memory for plane %d\n", plane);
> @@ -1527,7 +1525,7 @@ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer
> *b, bool nonblocking) */
> if (q->memory == V4L2_MEMORY_DMABUF)
> for (plane = 0; plane < vb->num_planes; ++plane)
> - call_memop(q, plane, unmap_dmabuf,
> + call_memop(q, unmap_dmabuf,
> vb->planes[plane].mem_priv);
>
> switch (vb->state) {
> diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
> index d8b8171..412c6a4 100644
> --- a/include/media/videobuf2-core.h
> +++ b/include/media/videobuf2-core.h
> @@ -88,10 +88,10 @@ struct vb2_mem_ops {
> * in the vb2 core, and vb2_mem_ops really just need to get/put the
> * sglist (and make sure that the sglist fits it's needs..)
> */
> - void *(*attach_dmabuf)(void *alloc_ctx,
> - struct dma_buf *dbuf);
> + void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf,
> + unsigned long size, int write);
> void (*detach_dmabuf)(void *buf_priv);
> - int (*map_dmabuf)(void *buf_priv, int write);
> + int (*map_dmabuf)(void *buf_priv);
> void (*unmap_dmabuf)(void *buf_priv);
>
> void *(*vaddr)(void *buf_priv);
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2012-03-22 7:56 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 10:16 [RFCv2 PATCH 0/9] Integration of videobuf2 with dmabuf Tomasz Stanislawski
2012-03-13 10:16 ` [RFCv2 PATCH 1/9] v4l: vb2: fixes for DMABUF support Tomasz Stanislawski
2012-03-22 7:56 ` Laurent Pinchart [this message]
2012-03-13 10:17 ` [RFCv2 PATCH 2/9] v4l: vb2-dma-contig: update and code refactoring Tomasz Stanislawski
2012-03-22 9:27 ` Laurent Pinchart
2012-03-22 10:02 ` [RFCv2 PATCH 2/9 - 1/4] v4l: vb2-dma-contig: Shorten vb2_dma_contig prefix to vb2_dc Laurent Pinchart
2012-03-22 10:02 ` [RFCv2 PATCH 2/9 - 2/4] v4l: vb2-dma-contig: Reorder functions Laurent Pinchart
2012-03-22 10:02 ` [RFCv2 PATCH 2/9 - 3/4] v4l: vb2-dma-contig: Remove unneeded allocation context structure Laurent Pinchart
2012-03-22 10:02 ` [RFCv2 PATCH 2/9 - 4/4] v4l: vb2-dma-contig: update and code refactoring Laurent Pinchart
2012-03-22 10:50 ` [Linaro-mm-sig] " Laurent Pinchart
2012-03-22 13:36 ` Tomasz Stanislawski
2012-03-22 14:42 ` Laurent Pinchart
2012-03-22 14:52 ` Subash Patel
2012-03-22 16:18 ` Tomasz Stanislawski
2012-03-22 15:58 ` Tomasz Stanislawski
2012-03-27 15:01 ` Laurent Pinchart
2012-03-27 16:45 ` Jerome Glisse
2012-03-27 16:58 ` Laurent Pinchart
2012-03-22 13:42 ` [Linaro-mm-sig] [RFCv2 PATCH 2/9] " Subash Patel
2012-03-13 10:17 ` [RFCv2 PATCH 3/9] v4l: vb2: Add dma-contig allocator as dma_buf user Tomasz Stanislawski
2012-03-22 11:04 ` Laurent Pinchart
2012-03-26 15:53 ` Tomasz Stanislawski
2012-03-28 15:50 ` Laurent Pinchart
2012-03-13 10:17 ` [RFCv2 PATCH 4/9] v4l: add buffer exporting via dmabuf Tomasz Stanislawski
2012-03-18 21:47 ` Daniel Vetter
2012-03-22 11:16 ` Laurent Pinchart
2012-03-22 13:57 ` [Linaro-mm-sig] " Subash Patel
2012-03-22 14:07 ` Laurent Pinchart
2012-03-22 14:26 ` Daniel Vetter
2012-03-22 14:43 ` Laurent Pinchart
2012-03-22 14:59 ` Subash Patel
2012-03-22 15:09 ` Laurent Pinchart
2012-03-23 11:33 ` Tomasz Stanislawski
2012-03-27 10:21 ` Laurent Pinchart
2012-03-13 10:17 ` [RFCv2 PATCH 5/9] v4l: vb2: " Tomasz Stanislawski
2012-03-22 11:24 ` Laurent Pinchart
2012-03-23 11:50 ` Tomasz Stanislawski
2012-03-13 10:17 ` [RFCv2 PATCH 6/9] v4l: vb2-dma-contig: add support for DMABUF exporting Tomasz Stanislawski
2012-03-13 10:17 ` [RFCv2 PATCH 7/9] v4l: vb2-dma-contig: change map/unmap behaviour Tomasz Stanislawski
2012-03-22 12:15 ` Laurent Pinchart
2012-03-22 12:25 ` Daniel Vetter
2012-03-27 10:31 ` Laurent Pinchart
2012-03-13 10:17 ` [RFCv2 PATCH 8/9] v4l: fimc: integrate capture i-face with dmabuf Tomasz Stanislawski
2012-03-13 10:17 ` [RFCv2 PATCH 9/9] v4l: s5p-tv: mixer: integrate " Tomasz Stanislawski
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=3820725.9Yo0yK24vP@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=airlied@redhat.com \
--cc=ben@bwidawsk.net \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kyungmin.park@samsung.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=m.szyprowski@samsung.com \
--cc=sakari.ailus@iki.fi \
--cc=t.stanislaws@samsung.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox