From patchwork Wed May 14 06:29: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: 4172981 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 1CAA5BFF02 for ; Wed, 14 May 2014 06:30:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 47C482035D for ; Wed, 14 May 2014 06:30:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57DAA2035C for ; Wed, 14 May 2014 06:30:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750762AbaENGaG (ORCPT ); Wed, 14 May 2014 02:30:06 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:32912 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750716AbaENGaE (ORCPT ); Wed, 14 May 2014 02:30:04 -0400 Received: by mail-pa0-f47.google.com with SMTP id lf10so1274053pab.34 for ; Tue, 13 May 2014 23:30:04 -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; bh=+qgjDLSLdew73JVFafN4hcmeUVPP9dv51Uv+en3AKBY=; b=ZVqFEpZ93DBFR03wGMo0QMdBVwFFUPONzyuVkdUIDM/Nr6TJ4Jb0MfneyAVJGcEGk3 jqSme/+NZuTT+y/NsFcwlGdTymWVwl28WzniAlCf64QjXC23z9uGsHlGLhlBgQEKFZEs Xfy1ZQF6F6ta+5FVcbx0WNq3JMKwxOdo+pf2UYzvKX3cQW4llfH0A6OfgUsKIyKId+RK MD+CdO8avhDV4QVQHIn/aM6a5g0YW6k7LcDN85bX6IHSrAyTqoajCBi36R+p6WpLYwer qju4uYl0/5PMaIJ2/v74M9WkSU8IMXSAzbcs20ppIvPSybRMdhpHZjRGvXPPId8gTGf5 sNKQ== X-Received: by 10.68.130.6 with SMTP id oa6mr2027642pbb.102.1400049004197; Tue, 13 May 2014 23:30:04 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id x5sm1531765pbw.26.2014.05.13.23.30.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 23:30:03 -0700 (PDT) From: Arun Kumar K To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: k.debski@samsung.com, s.nawrocki@samsung.com, sachin.kamat@linaro.org, arunkk.samsung@gmail.com Subject: [PATCH v2] [media] s5p-mfc: Dequeue sequence header after STREAMON Date: Wed, 14 May 2014 11:59:56 +0530 Message-Id: <1400048996-726-1-git-send-email-arun.kk@samsung.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 MFCv6 encoder needs specific minimum number of buffers to be queued in the CAPTURE plane. This minimum number will be known only when the sequence header is generated. So we used to allow STREAMON on the CAPTURE plane only after sequence header is generated and checked with the minimum buffer requirement. But this causes a problem that we call a vb2_buffer_done for the sequence header buffer before doing a STREAON on the CAPTURE plane. This used to still work fine until this patch was merged - b3379c6 : vb2: only call start_streaming if sufficient buffers are queued This problem should also come in earlier MFC firmware versions if the application calls STREAMON on CAPTURE with some delay after doing STREAMON on OUTPUT. So this patch keeps the header buffer until the other frame buffers are ready and dequeues it just before the first frame is ready. Signed-off-by: Arun Kumar K --- Changes from v1 - Addressed review comments from Sachin https://patchwork.linuxtv.org/patch/23839/ --- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 ++ drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index f5404a6..cc2b96e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -523,6 +523,7 @@ struct s5p_mfc_codec_ops { * @output_state: state of the output buffers queue * @src_bufs: information on allocated source buffers * @dst_bufs: information on allocated destination buffers + * @header_mb: buffer pointer of the encoded sequence header * @sequence: counter for the sequence number for v4l2 * @dec_dst_flag: flags for buffers queued in the hardware * @dec_src_buf_size: size of the buffer for source buffers in decoding @@ -607,6 +608,7 @@ struct s5p_mfc_ctx { int src_bufs_cnt; struct s5p_mfc_buf dst_bufs[MFC_MAX_BUFFERS]; int dst_bufs_cnt; + struct s5p_mfc_buf *header_mb; unsigned int sequence; unsigned long dec_dst_flag; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index f8c7053..0c8d593e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -787,7 +787,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) ctx->dst_queue_cnt--; vb2_set_plane_payload(dst_mb->b, 0, s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev)); - vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE); + ctx->header_mb = dst_mb; spin_unlock_irqrestore(&dev->irqlock, flags); } @@ -845,6 +845,10 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) unsigned int strm_size; unsigned long flags; + if (ctx->header_mb) { + vb2_buffer_done(ctx->header_mb->b, VB2_BUF_STATE_DONE); + ctx->header_mb = NULL; + } slice_type = s5p_mfc_hw_call(dev->mfc_ops, get_enc_slice_type, dev); strm_size = s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev); mfc_debug(2, "Encoded slice type: %d\n", slice_type);