From patchwork Mon May 19 12:33:02 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: 23978 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 1WmMlA-00055V-O0; Mon, 19 May 2014 14:33:40 +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-6) with esmtp id 1WmMl8-0002OV-3m; Mon, 19 May 2014 14:33:40 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932099AbaESMdd (ORCPT + 1 other); Mon, 19 May 2014 08:33:33 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:50304 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932096AbaESMdb (ORCPT ); Mon, 19 May 2014 08:33:31 -0400 Received: by mail-pa0-f43.google.com with SMTP id hz1so5702885pad.16 for ; Mon, 19 May 2014 05:33:30 -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=UsGhngMxk5Z8WQZdE6gV4IBUjd1EbD0Up1n20MSmFkA=; b=dGNAk49I4GK4G7jyyTl/11KFQi6qQBQ3dN21TznK+N5F7r7R/KrueXL4Cr1Voeapic mfcvLfhJLpJvvUd5sVPKjB4UJxJBgSJsTd4BgNEyKY87SyvbQmqQCtFm8OdsjZhzjcAK YzM09SuMk9hb/sb/d+28/8XHh+21jVXbvYbKgno9ZmoY90lV7Pc0uUojmXDMZ03meMML LOR16EmgArl9afpyDswCY+KIP+6DZHND6OVLDGv79Cy2N+tOXgEaQXfMRMpko1+dLvG3 bNpBubcNXhL8lZYYVj6EdwJG2EV/3CB9m0C7YTHCeltDiOuHQ/upeh+A4p2sX7KF0/7V E7VQ== X-Received: by 10.66.146.105 with SMTP id tb9mr10706600pab.157.1400502810735; Mon, 19 May 2014 05:33:30 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id bz4sm29931786pbb.12.2014.05.19.05.33.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 May 2014 05:33:30 -0700 (PDT) From: Arun Kumar K To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: k.debski@samsung.com, posciak@chromium.org, avnd.kiran@samsung.com, arunkk.samsung@gmail.com Subject: [PATCH 06/10] [media] s5p-mfc: Don't try to resubmit VP8 bitstream buffer for decode. Date: Mon, 19 May 2014 18:03:02 +0530 Message-Id: <1400502786-4826-7-git-send-email-arun.kk@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400502786-4826-1-git-send-email-arun.kk@samsung.com> References: <1400502786-4826-1-git-send-email-arun.kk@samsung.com> 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.19.122419 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 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, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' From: Pawel Osciak Currently, for formats that are not H264, MFC driver will check the consumed stream size returned by the firmware and, based on that, will try to decide whether the bitstream buffer contained more than one frame. If the size of the buffer is larger than the consumed stream, it assumes that there are more frames in the buffer and that the buffer should be resubmitted for decode. This rarely works though and actually introduces problems, because: - v7 firmware will always return consumed stream size equal to whatever the driver passed to it when running decode (which is the size of the whole buffer), which means we will never try to resubmit, because the firmware will always tell us that it consumed all the data we passed to it; - v6 firmware will return the number of consumed bytes, but will not include the padding ("stuffing") bytes that are allowed after the frame in VP8. Since there is no way of figuring out how many of those bytes follow the frame without getting the frame size from IVF headers (or somewhere else, but not from the stream itself), the driver tries to guess that padding size is not larger than 4 bytes, which is not always true; The only way to make it work is to queue only one frame per buffer from userspace and the check in the kernel is useless and wrong for VP8. So adding VP8 also along with H264 to disallow re-submitting of buffer back to hardware for decode. Signed-off-by: Pawel Osciak Signed-off-by: Arun Kumar K --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 70f728f..297d681 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -368,6 +368,7 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx, ctx->consumed_stream += s5p_mfc_hw_call(dev->mfc_ops, get_consumed_stream, dev); if (ctx->codec_mode != S5P_MFC_CODEC_H264_DEC && + ctx->codec_mode != S5P_MFC_CODEC_VP8_DEC && ctx->consumed_stream + STUFF_BYTE < src_buf->b->v4l2_planes[0].bytesused) { /* Run MFC again on the same buffer */