From patchwork Tue Dec 16 11:36:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamil Debski X-Patchwork-Id: 5500321 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 29E79BEEA8 for ; Tue, 16 Dec 2014 11:36:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A83420A22 for ; Tue, 16 Dec 2014 11:36:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DFB120A20 for ; Tue, 16 Dec 2014 11:36:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751142AbaLPLgy (ORCPT ); Tue, 16 Dec 2014 06:36:54 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:34575 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751021AbaLPLgx (ORCPT ); Tue, 16 Dec 2014 06:36:53 -0500 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NGO00HEIAXGGH40@mailout3.samsung.com> for linux-media@vger.kernel.org; Tue, 16 Dec 2014 20:36:52 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-b2-549019540819 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id D9.18.20081.45910945; Tue, 16 Dec 2014 20:36:52 +0900 (KST) Received: from AMDC1342.digital.local ([106.116.147.39]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NGO007H4AWQ3Y20@mmp2.samsung.com>; Tue, 16 Dec 2014 20:36:52 +0900 (KST) From: Kamil Debski To: linux-media@vger.kernel.org Cc: m.szyprowski@samsung.com, k.debski@samsung.com, hverkuil@xs4all.nl, nicolas.dufresne@collabora.com Subject: [PATCH 2/2] s5p-mfc: use VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag Date: Tue, 16 Dec 2014 12:36:18 +0100 Message-id: <1418729778-14480-2-git-send-email-k.debski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1418729778-14480-1-git-send-email-k.debski@samsung.com> References: <1418729778-14480-1-git-send-email-k.debski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPJMWRmVeSWpSXmKPExsVy+t9jQd0QyQkhBmfXKlmcmvyMyeLH6wts Fj0btrJarD1yl91i15d7bA6sHjvuLmH06NuyitHj8yY5j1NfP7MHsERx2aSk5mSWpRbp2yVw ZUyd289ScJG34uSCqgbG5dxdjJwcEgImEjs6vjJD2GISF+6tZ+ti5OIQEpjOKHGy+RQ7SEJI oINJYs4Kny5GDg42AU2JVfc8QMIiAvIST3pvsIHYzAIZEjs33WIBsYUF3CSunN8LFmcRUJVY /X8VK0grr4CLRPePIBBTQkBBYs4kG5AKTgFXiSnLbrKAhIWAKv5v15zAyLuAkWEVo2hqQXJB cVJ6rqFecWJucWleul5yfu4mRnCwPJPawbiyweIQowAHoxIPb0Bhf4gQa2JZcWXuIUYJDmYl Ed4t94FCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeZXs20KEBNITS1KzU1MLUotgskwcnFINjHs/ 5XZUtKdH/df5zs7oe14p1LCtePJsbo3o6Oxd6kpu0nFpwg8jChPsKl8nv3IVlZ8Q/fOamF8o 6xfmR8U51a837Xt/o/Fg39F+saiwI8mz3s/l1hRl+v/ayjutdn32T5klfB4PJn3b9c29svyg aNnSr31Rip6r9txxuLW3oyDc/Ide56YUJZbijERDLeai4kQALitcexICAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The MFC driver interprets a buffer with bytesused equal to 0 as a special case indicating end-of-stream. After vb2: fix bytesused == 0 handling (8a75ffb) patch videobuf2 modified the value of bytesused if it was 0. The VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag was added to videobuf2 to keep backward compatibility. Signed-off-by: Kamil Debski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 03204fd..89c148b 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -820,6 +820,13 @@ static int s5p_mfc_open(struct file *file) ret = -ENOENT; goto err_queue_init; } + /* One of means to indicate end-of-stream for MFC is to set the + * bytesused == 0. However by default videobuf2 handles videobuf + * equal to 0 as a special case and changes its value to the size + * of the buffer. Set the VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag so + * that videobuf2 will keep the value of bytesused intact. + */ + q->io_flags = VB2_FILEIO_ALLOW_ZERO_BYTESUSED; q->mem_ops = &vb2_dma_contig_memops; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; ret = vb2_queue_init(q); @@ -842,6 +849,10 @@ static int s5p_mfc_open(struct file *file) ret = -ENOENT; goto err_queue_init; } + /* Set the VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag, for more information + * please see the comment above. + */ + q->io_flags = VB2_FILEIO_ALLOW_ZERO_BYTESUSED; q->mem_ops = &vb2_dma_contig_memops; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; ret = vb2_queue_init(q);