From patchwork Thu Jun 26 14:14:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ayaka X-Patchwork-Id: 4427881 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 09DE59F333 for ; Thu, 26 Jun 2014 14:24:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBC7E2038C for ; Thu, 26 Jun 2014 14:24:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C36F020397 for ; Thu, 26 Jun 2014 14:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755485AbaFZOYE (ORCPT ); Thu, 26 Jun 2014 10:24:04 -0400 Received: from kozue.soulik.info ([108.61.222.116]:41018 "EHLO kozue.soulik.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752758AbaFZOYD (ORCPT ); Thu, 26 Jun 2014 10:24:03 -0400 X-Greylist: delayed 560 seconds by postgrey-1.27 at vger.kernel.org; Thu, 26 Jun 2014 10:24:03 EDT Received: from [192.168.6.3] (unknown [222.76.205.131]) by kozue.soulik.info (Postfix) with ESMTPSA id 60C3A2067B; Thu, 26 Jun 2014 09:14:39 -0500 (CDT) Message-ID: <53AC2ACA.7080106@soulik.info> Date: Thu, 26 Jun 2014 22:14:34 +0800 From: ayaka User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: linux-media@vger.kernel.org CC: kyungmin.park@samsung.com, jtp.park@samsung.com, m.chehab@samsung.com Subject: [PATCH] s5p-mfc: encoder could free buffers 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=ham 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 [PATCH] s5p-mfc: encoder could free buffers The patch is necessary or the buffers could be freeed but it would break the state of encoder in s5p-mfc. It is also need by some application which would detect the buffer allocation way, like gstreamer. --- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 8 ++++++++ 1 file changed, 8 insertions(+) ret = s5p_mfc_hw_call(ctx->dev->mfc_ops, @@ -1200,6 +1204,10 @@ static int vidioc_reqbufs(struct file *file, void *priv, mfc_err("error in vb2_reqbufs() for E(S)\n"); return ret; } + if (reqbufs->count == 0) { + mfc_debug(2, "Freeing buffers\n"); + return ret; + } ctx->output_state = QUEUE_BUFS_REQUESTED; } else { mfc_err("invalid buf type\n"); diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index d26b248..1a7518f 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1166,6 +1166,10 @@ static int vidioc_reqbufs(struct file *file, void *priv, mfc_err("error in vb2_reqbufs() for E(D)\n"); return ret; } + if (reqbufs->count == 0) { + mfc_debug(2, "Freeing buffers\n"); + return ret; + } ctx->capture_state = QUEUE_BUFS_REQUESTED;