From patchwork Sat Aug 13 09:25:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 36356 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYVCs-0005J0-Go; Sat, 13 Aug 2016 09:26:18 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-5) with esmtp id 1bYVCq-0002XX-7q; Sat, 13 Aug 2016 11:26:18 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752345AbcHMJZz (ORCPT + 1 other); Sat, 13 Aug 2016 05:25:55 -0400 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:50758 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752256AbcHMJZy (ORCPT ); Sat, 13 Aug 2016 05:25:54 -0400 Received: from belgarion ([109.222.82.242]) by mwinf5d12 with ME id WZRf1t00A5DhqKR03ZRixj; Sat, 13 Aug 2016 11:25:50 +0200 X-ME-Helo: belgarion X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Sat, 13 Aug 2016 11:25:50 +0200 X-ME-IP: 109.222.82.242 From: Robert Jarzmik To: Hans Verkuil Cc: Mauro Carvalho Chehab , Guennadi Liakhovetski , Jiri Kosina , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH v3 05/14] media: platform: pxa_camera: convert to vb2 References: <1470684652-16295-1-git-send-email-robert.jarzmik@free.fr> <1470684652-16295-6-git-send-email-robert.jarzmik@free.fr> X-URL: http://belgarath.falguerolles.org/ Date: Sat, 13 Aug 2016 11:25:37 +0200 In-Reply-To: <1470684652-16295-6-git-send-email-robert.jarzmik@free.fr> (Robert Jarzmik's message of "Mon, 8 Aug 2016 21:30:43 +0200") Message-ID: <87zioht3zi.fsf@belgarion.home> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.8.13.91516 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, IN_REP_TO 0, LEGITIMATE_NEGATE 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, REFERENCES 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __FORWARDED_MSG 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __REFERENCES 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NAME 0, __TO_NAME_DIFF_FROM_ACC 0, __TO_REAL_NAMES 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0, __USER_AGENT 0' Hi Hans, Robert Jarzmik writes: > Convert pxa_camera from videobuf to videobuf2. ...zip... > +static int pxac_vb2_queue_setup(struct vb2_queue *vq, > + unsigned int *nbufs, > + unsigned int *num_planes, unsigned int sizes[], > + void *alloc_ctxs[]) There is an API change here that happened since I wrote this code, ie. void *alloc_ctxs became struct device *alloc_devs. I made the incremental patch in [1] accrodingly to prepare the v4 iteration, but it triggers new errors in v4l2-compliance -s : Streaming ioctls: test read/write: OK (Not Supported) fail: v4l2-test-buffers.cpp(293): !(g_flags() & V4L2_BUF_FLAG_DONE) fail: v4l2-test-buffers.cpp(703): buf.check(q, last_seq) fail: v4l2-test-buffers.cpp(976): captureBufs(node, q, m2m_q, frame_count, false) test MMAP: FAIL fail: v4l2-test-buffers.cpp(1075): can_stream && ret != EINVAL test USERPTR: FAIL test DMABUF: Cannot test, specify --expbuf-device Total: 45, Succeeded: 43, Failed: 2, Warnings: 6 I'm a bit puzzled how this change brought this in, so in case you've already encountered this, it could save me investigating more. If nothing obvious appears to you, I'll dig in. Cheers. diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index a161b64d420d..41359a183e83 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -269,8 +269,6 @@ struct pxa_camera_dev { struct tasklet_struct task_eof; u32 save_cicr[5]; - - void *alloc_ctx; }; struct pxa_cam { @@ -1043,7 +1041,7 @@ static int pxac_vb2_init(struct vb2_buffer *vb) static int pxac_vb2_queue_setup(struct vb2_queue *vq, unsigned int *nbufs, unsigned int *num_planes, unsigned int sizes[], - void *alloc_ctxs[]) + struct device *alloc_devs[]) { struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); int size = pcdev->current_pix.sizeimage; @@ -1069,7 +1067,6 @@ static int pxac_vb2_queue_setup(struct vb2_queue *vq, return -EINVAL; } - alloc_ctxs[0] = pcdev->alloc_ctx; if (!*nbufs) *nbufs = 1; @@ -1125,6 +1122,7 @@ static int pxa_camera_init_videobuf2(struct pxa_camera_dev *pcdev) vq->drv_priv = pcdev; vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; vq->buf_struct_size = sizeof(struct pxa_buffer); + vq->dev = pcdev->v4l2_dev.dev; vq->ops = &pxac_vb2_ops; vq->mem_ops = &vb2_dma_sg_memops; @@ -1918,10 +1916,6 @@ static int pxa_camera_probe(struct platform_device *pdev) return -ENOMEM; } - pcdev->alloc_ctx = vb2_dma_sg_init_ctx(&pdev->dev); - if (IS_ERR(pcdev->alloc_ctx)) - return PTR_ERR(pcdev->alloc_ctx); - pcdev->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(pcdev->clk)) return PTR_ERR(pcdev->clk); @@ -2091,9 +2085,8 @@ static int pxa_camera_remove(struct platform_device *pdev) dma_release_channel(pcdev->dma_chans[0]); dma_release_channel(pcdev->dma_chans[1]); dma_release_channel(pcdev->dma_chans[2]); - vb2_dma_sg_cleanup_ctx(pcdev->alloc_ctx); - v4l2_clk_unregister(pcdev->mclk_clk); + v4l2_clk_unregister(pcdev->mclk_clk); v4l2_device_unregister(&pcdev->v4l2_dev); dev_info(&pdev->dev, "PXA Camera driver unloaded\n");