From patchwork Wed Oct 7 10:13:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 7343561 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DAD989F302 for ; Wed, 7 Oct 2015 10:14:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0389E2062A for ; Wed, 7 Oct 2015 10:14:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0704C20623 for ; Wed, 7 Oct 2015 10:14:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752152AbbJGKN7 (ORCPT ); Wed, 7 Oct 2015 06:13:59 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:58164 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750963AbbJGKN6 (ORCPT ); Wed, 7 Oct 2015 06:13:58 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NVU006MOHR7RN50@mailout1.w1.samsung.com>; Wed, 07 Oct 2015 11:13:55 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-56-5614f063c120 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 20.30.05269.360F4165; Wed, 7 Oct 2015 11:13:55 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NVU00GRBHR4OB50@eusync2.samsung.com>; Wed, 07 Oct 2015 11:13:55 +0100 (BST) From: Andrzej Hajda To: linux-media@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , Kyungmin Park , Kamil Debski , Jeongtae Park , Mauro Carvalho Chehab , linux-samsung-soc@vger.kernel.org Subject: [PATCH v3 2/2] s5p-mfc: use MFC_BUF_FLAG_EOS to identify last buffers in decoder capture queue Date: Wed, 07 Oct 2015 12:13:45 +0200 Message-id: <1444212825-10727-1-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1443787779-18458-2-git-send-email-a.hajda@samsung.com> References: <1443787779-18458-2-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMLMWRmVeSWpSXmKPExsVy+t/xK7rJH0TCDGZ2ylrcWneO1WLjjPWs FkfWXmWy+PH6ApvF2aY37BY9G7ayWsw4v4/JYu2Ru+wWq59VOHB6bOm/y+7Rt2UVo8fnTXIB zFFcNimpOZllqUX6dglcGauOrmUpuCNU8W33ZbYGxkf8XYycHBICJhJ7F75hgbDFJC7cW8/W xcjFISSwlFGi6coeVginiUmiadkEVpAqNgFNib+bb7KB2CIC8hJPem+AdTALPGCSePqnlxEk ISyQKfHoxSv2LkYODhYBVYlfl91AwrwCzhKrXk1hhtgmJ3Hy2GSwmZwCLhI9ly+AtQoB1dya 080ygZF3ASPDKkbR1NLkguKk9FwjveLE3OLSvHS95PzcTYyQoPq6g3HpMatDjAIcjEo8vD+M RcKEWBPLiitzDzFKcDArifBOeQUU4k1JrKxKLcqPLyrNSS0+xCjNwaIkzjtz1/sQIYH0xJLU 7NTUgtQimCwTB6dUA2PtnYsrNjzQ1Jtoc/R2lvuMC9G3ODtXTZsbY+T+tU4jISXrZd+fOS+d GAtrFVuSApnPX3we0lwvPjkxlEM92bDwN988k4fME3W6nbbtbK1cXvakxXt28i3vhT4KR28q OUye+Gdp5oHKiRqLZjT6Xp632UZEYd5fM5mHiV7brQ/Ix6eJ/wu/n6PEUpyRaKjFXFScCAAu RGqhJgIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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 MFC driver never delivered EOS event to apps feeding constantly its capture buffer with fresh buffers. The patch fixes it by marking last buffers returned by MFC with MFC_BUF_FLAG_EOS flag and firing EOS event on de-queuing such buffers. Signed-off-by: Andrzej Hajda --- Hi Kamil, Commit message fixed. Regards Andrzej --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 1 + drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 05a31ee..3ffe2ec 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -196,6 +196,7 @@ static void s5p_mfc_handle_frame_all_extracted(struct s5p_mfc_ctx *ctx) vb2_set_plane_payload(&dst_buf->b->vb2_buf, 0, 0); vb2_set_plane_payload(&dst_buf->b->vb2_buf, 1, 0); list_del(&dst_buf->list); + dst_buf->flags |= MFC_BUF_FLAG_EOS; ctx->dst_queue_cnt--; dst_buf->b->sequence = (ctx->sequence++); diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 1734775..8d3d40c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -645,17 +645,22 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) mfc_err("Call on DQBUF after unrecoverable error\n"); return -EIO; } - if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) - ret = vb2_dqbuf(&ctx->vq_src, buf, file->f_flags & O_NONBLOCK); - else if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { + + switch (buf->type) { + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: + return vb2_dqbuf(&ctx->vq_src, buf, file->f_flags & O_NONBLOCK); + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: ret = vb2_dqbuf(&ctx->vq_dst, buf, file->f_flags & O_NONBLOCK); - if (ret == 0 && ctx->state == MFCINST_FINISHED && - list_empty(&ctx->vq_dst.done_list)) + if (ret) + return ret; + + if (ctx->state == MFCINST_FINISHED && + (ctx->dst_bufs[buf->index].flags & MFC_BUF_FLAG_EOS)) v4l2_event_queue_fh(&ctx->fh, &ev); - } else { - ret = -EINVAL; + return 0; + default: + return -EINVAL; } - return ret; } /* Export DMA buffer */