Message ID | 1364798447-32224-3-git-send-email-sw0312.kim@samsung.com (mailing list archive) |
---|---|
State | RFC, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1UMYQC-0001SP-DP; Mon, 01 Apr 2013 08:40:48 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-2) with esmtp id 1UMYQB-0007mV-HE; Mon, 01 Apr 2013 08:40:48 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752434Ab3DAGkp (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Mon, 1 Apr 2013 02:40:45 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:11566 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856Ab3DAGkm (ORCPT <rfc822; linux-media@vger.kernel.org>); Mon, 1 Apr 2013 02:40:42 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKK00DKSD7TVEM0@mailout3.samsung.com> for linux-media@vger.kernel.org; Mon, 01 Apr 2013 15:40:41 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.43]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 83.7E.07735.9EB29515; Mon, 01 Apr 2013 15:40:41 +0900 (KST) X-AuditID: cbfee68e-b7f946d000001e37-cf-51592be9274e Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 52.DD.17838.8EB29515; Mon, 01 Apr 2013 15:40:40 +0900 (KST) Received: from localhost.localdomain ([10.90.8.56]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MKK009SND7R8G00@mmp2.samsung.com>; Mon, 01 Apr 2013 15:40:40 +0900 (KST) From: Seung-Woo Kim <sw0312.kim@samsung.com> To: linux-media@vger.kernel.org Cc: mchehab@redhat.com, m.szyprowski@samsung.com, hans.verkuil@cisco.com, pawel@osciak.com, kyungmin.park@samsung.com, sw0312.kim@samsung.com Subject: [RFC][PATCH 2/2] media: v4l2-mem2mem: return for polling if a buffer is available Date: Mon, 01 Apr 2013 15:40:47 +0900 Message-id: <1364798447-32224-3-git-send-email-sw0312.kim@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-reply-to: <1364798447-32224-1-git-send-email-sw0312.kim@samsung.com> References: <1364798447-32224-1-git-send-email-sw0312.kim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOLMWRmVeSWpSXmKPExsVy+t8zbd2X2pGBBvNWsVgs+bmLyeJs0xt2 i54NW1kt1h65y26x5+hhdospb3+yW8yY/JLNgd1jyu+NrB6Pf71k83i/7yqbR9+WVYwenzfJ BbBGcdmkpOZklqUW6dslcGXM+fCArWAaZ8WzW/kNjD/Yuxg5OSQETCT2LpnABGGLSVy4t56t i5GLQ0hgGaPEsXWHmWGK5mzbzwyRmM4osWXlWRYIp5lJ4tTaPywgVWwCOhL7l/xmBbFFBOQl nvTeABvFLNDPKNF9+hLYDmGBGInVt6eDNbAIqEpMvLQbrIFXwE3ix/LJrBDrFCQW3HvLBmJz CrhLfO06zQhiCwHVtP7YBbZZQmAeu8TG6WsZIQYJSHybfAgowQGUkJXYdADqbEmJgytusExg FF7AyLCKUTS1ILmgOCm9yEivODG3uDQvXS85P3cTIyTQ+3Yw3jxgfYgxGWjcRGYp0eR8YKTk lcQbGpsZWZiamBobmVuakSasJM6r1mIdKCSQnliSmp2aWpBaFF9UmpNafIiRiYNTqoFRN8zZ e5618Hp2pq0zr19ydVyZ+GtuSp+afMgdVt4qgUDe1V583nfi8/KWTfrNXjJP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Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2013.4.1.63328 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1300_1399 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' |
Commit Message
Seung-Woo Kim
April 1, 2013, 6:40 a.m. UTC
The v4l2_m2m_poll() does not need to wait if there is already a buffer in
done_list of source and destination queues, but current v4l2_m2m_poll() always
waits. So done_list of each queue is checked before calling poll_wait().
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
drivers/media/v4l2-core/v4l2-mem2mem.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
Comments
Hello, On 4/1/2013 8:40 AM, Seung-Woo Kim wrote: > The v4l2_m2m_poll() does not need to wait if there is already a buffer in > done_list of source and destination queues, but current v4l2_m2m_poll() always > waits. So done_list of each queue is checked before calling poll_wait(). > > Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Right now I have no idea how to fix this better than it has been proposed in your patch. I wonder what will happen if the device doesn't release both source and destination buffers at the same time, but this situation is purely hypothetical as there is no driver which does it such way, therefore: Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Sorry for a long delay, I had to find some time to analyze the code. > --- > drivers/media/v4l2-core/v4l2-mem2mem.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c > index da99cf7..b6f0316 100644 > --- a/drivers/media/v4l2-core/v4l2-mem2mem.c > +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c > @@ -458,8 +458,10 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, > if (m2m_ctx->m2m_dev->m2m_ops->unlock) > m2m_ctx->m2m_dev->m2m_ops->unlock(m2m_ctx->priv); > > - poll_wait(file, &src_q->done_wq, wait); > - poll_wait(file, &dst_q->done_wq, wait); > + if (list_empty(&src_q->done_list)) > + poll_wait(file, &src_q->done_wq, wait); > + if (list_empty(&dst_q->done_list)) > + poll_wait(file, &dst_q->done_wq, wait); > > if (m2m_ctx->m2m_dev->m2m_ops->lock) > m2m_ctx->m2m_dev->m2m_ops->lock(m2m_ctx->priv); Best regards
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index da99cf7..b6f0316 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -458,8 +458,10 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, if (m2m_ctx->m2m_dev->m2m_ops->unlock) m2m_ctx->m2m_dev->m2m_ops->unlock(m2m_ctx->priv); - poll_wait(file, &src_q->done_wq, wait); - poll_wait(file, &dst_q->done_wq, wait); + if (list_empty(&src_q->done_list)) + poll_wait(file, &src_q->done_wq, wait); + if (list_empty(&dst_q->done_list)) + poll_wait(file, &dst_q->done_wq, wait); if (m2m_ctx->m2m_dev->m2m_ops->lock) m2m_ctx->m2m_dev->m2m_ops->lock(m2m_ctx->priv);