From patchwork Wed May 7 11:30:52 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: 23839 X-Patchwork-Delegate: kamil@wypas.org Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Wi040-0007Sz-1A; Wed, 07 May 2014 13:31:04 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-8) with esmtp id 1Wi03x-0002Yy-k1; Wed, 07 May 2014 13:31:03 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932222AbaEGLa6 (ORCPT + 1 other); Wed, 7 May 2014 07:30:58 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:37590 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755316AbaEGLa5 (ORCPT ); Wed, 7 May 2014 07:30:57 -0400 Received: by mail-pa0-f47.google.com with SMTP id fa1so1064641pad.6 for ; Wed, 07 May 2014 04:30:57 -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=wrbJ0eqZzrIFiBRISSH3nOqXrLrOFKixFc2VnE8PdSQ=; b=lMYCc/MoNGQdV9L2zDmdELhcaqBzo+Dbn57veP0MUcCmwqqAzBZ8k+x+dBohdoZrP+ goK07Xwn0G0emjD5P9QYp/DgBMD9/SvWGFIxS08WurnQCwRnWDifcfKCdoTFSco0NLF9 kMrk0Rjun46WBZ83sqRPwUvY9zazcRa36TxX00wN7aOd0KwZiykZypV6ro3JVHAu6l03 bHkHWsV8ffDxDfB3GxUDUqD4LQJ4rvNti/F5Vw84dODBcClky9SahujjQ+KznsveP6Nt FYHwciv+XAgLLcu115KECtBAjjreNFgc07Tip5XHBx+f4elH3oEnHK2xuORiY6s4cN6J bx0w== X-Received: by 10.66.150.169 with SMTP id uj9mr18062212pab.148.1399462256926; Wed, 07 May 2014 04:30:56 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id kt8sm111691181pab.7.2014.05.07.04.30.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 May 2014 04:30:56 -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, posciak@chromium.org, avnd.kiran@samsung.com, arunkk.samsung@gmail.com Subject: [PATCH] [media] s5p-mfc: Dequeue sequence header after STREAMON Date: Wed, 7 May 2014 17:00:52 +0530 Message-Id: <1399462252-21821-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-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.5.7.112118 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, FROM_NAME_PHRASE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' 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 b3379c6201bb3555298cdbf0aa004af260f2a6a4. 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 --- 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 d64b680..4fd1034 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: buf 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 a9a23e1..e7dddb0 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);