From patchwork Tue Oct 21 11:06:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Kumar K X-Patchwork-Id: 5114061 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 B9ED8C11AC for ; Tue, 21 Oct 2014 11:07:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA34C2012F for ; Tue, 21 Oct 2014 11:07:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD68120158 for ; Tue, 21 Oct 2014 11:07:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755178AbaJULHa (ORCPT ); Tue, 21 Oct 2014 07:07:30 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:61023 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755052AbaJULHa (ORCPT ); Tue, 21 Oct 2014 07:07:30 -0400 Received: by mail-pa0-f50.google.com with SMTP id kx10so1202379pab.9 for ; Tue, 21 Oct 2014 04:07:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=lU9OTxUVbONONVX+dcXFekMF+2HvgmvIEAZ5zU4FHmw=; b=r3HxNWRfYGc6krGwKNmKutQCQt8u2qXnqJFEuefFbactMa2oVfU51SRfcYV4DAXgjw TAWNn16BRYyWABtkUEOVeghvoCkp0tN32D5LWqVa/BBTYjtv2HXKEyzAOK5V3sClXpB4 4YjGNJxWcvok+ixjzKyBZPHFg37EhQ4JuOCbyLOXkGhl+aWJfp0mT6/gkVttHjuInyMe NOt2SFG8szzFZMUoP52+wGPMnLcMfimUjQk9X9kYU2ZgWx66nht8GXZSKjCPbBiyLfXD vCqQ9Z2jIZZYA1ze9RusoZ+cizw1umGyx2d/1dtYnjoibfwHI7KW2ErS1tfwgknOxcIV wMMg== X-Received: by 10.68.109.195 with SMTP id hu3mr9096047pbb.136.1413889649595; Tue, 21 Oct 2014 04:07:29 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id s9sm11680849pdp.1.2014.10.21.04.07.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 04:07:28 -0700 (PDT) From: Arun Kumar K To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: k.debski@samsung.com, wuchengli@chromium.org, posciak@chromium.org, arun.m@samsung.com, ihf@chromium.org, prathyush.k@samsung.com, kiran@chromium.org, arunkk.samsung@gmail.com Subject: [PATCH v3 02/13] [media] s5p-mfc: Fix REQBUFS(0) for encoder. Date: Tue, 21 Oct 2014 16:36:56 +0530 Message-Id: <1413889627-8431-3-git-send-email-arun.kk@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1413889627-8431-1-git-send-email-arun.kk@samsung.com> References: <1413889627-8431-1-git-send-email-arun.kk@samsung.com> 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=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: Pawel Osciak Handle REQBUFS(0) for CAPTURE queue as well. Also use the proper queue to call it on for OUTPUT. Signed-off-by: Pawel Osciak Signed-off-by: Kiran AVND Signed-off-by: Arun Kumar K --- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 4816f31..6a1c890 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1147,6 +1147,11 @@ static int vidioc_reqbufs(struct file *file, void *priv, (reqbufs->memory != V4L2_MEMORY_USERPTR)) return -EINVAL; if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { + if (reqbufs->count == 0) { + ret = vb2_reqbufs(&ctx->vq_dst, reqbufs); + ctx->capture_state = QUEUE_FREE; + return ret; + } if (ctx->capture_state != QUEUE_FREE) { mfc_err("invalid capture state: %d\n", ctx->capture_state); @@ -1168,6 +1173,14 @@ static int vidioc_reqbufs(struct file *file, void *priv, return -ENOMEM; } } else if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { + if (reqbufs->count == 0) { + mfc_debug(2, "Freeing buffers\n"); + ret = vb2_reqbufs(&ctx->vq_src, reqbufs); + s5p_mfc_hw_call(dev->mfc_ops, release_codec_buffers, + ctx); + ctx->output_state = QUEUE_FREE; + return ret; + } if (ctx->output_state != QUEUE_FREE) { mfc_err("invalid output state: %d\n", ctx->output_state);