From patchwork Mon Jul 2 07:44:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikash Garodia X-Patchwork-Id: 10500605 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DA42D60532 for ; Mon, 2 Jul 2018 07:44:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9BC9285ED for ; Mon, 2 Jul 2018 07:44:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD557286EB; Mon, 2 Jul 2018 07:44:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 677F2285ED for ; Mon, 2 Jul 2018 07:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933332AbeGBHoU (ORCPT ); Mon, 2 Jul 2018 03:44:20 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38464 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933055AbeGBHoS (ORCPT ); Mon, 2 Jul 2018 03:44:18 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8B33660B13; Mon, 2 Jul 2018 07:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530517457; bh=kwjdomwJ8eCm4yLXX3FoyXKbJRyqrHN+jIm6LRWq8rI=; h=From:To:Cc:Subject:Date:From; b=DfxRtaYiSLQgkJd9BJRKBvZXkazTqKwXb94MWS3gvpHl3W+UllojrNzj/dsi7i/eX k/K6XIBcdUjB205xbX9WAXB4G4auonHUgVCs2FiEzNTB3JY/xj3hx6NV061dBfyUwh uEJfT2sEtT81Ct9hLuXa00S2lz85+vc5B7nZYRc8= Received: from vgarodia-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vgarodia@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 23ADA602A7; Mon, 2 Jul 2018 07:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530517457; bh=kwjdomwJ8eCm4yLXX3FoyXKbJRyqrHN+jIm6LRWq8rI=; h=From:To:Cc:Subject:Date:From; b=DfxRtaYiSLQgkJd9BJRKBvZXkazTqKwXb94MWS3gvpHl3W+UllojrNzj/dsi7i/eX k/K6XIBcdUjB205xbX9WAXB4G4auonHUgVCs2FiEzNTB3JY/xj3hx6NV061dBfyUwh uEJfT2sEtT81Ct9hLuXa00S2lz85+vc5B7nZYRc8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 23ADA602A7 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vgarodia@codeaurora.org From: Vikash Garodia To: stanimir.varbanov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, acourbot@chromium.org, vgarodia@codeaurora.org Subject: [PATCH] venus: vdec: fix decoded data size Date: Mon, 2 Jul 2018 13:14:07 +0530 Message-Id: <1530517447-29296-1-git-send-email-vgarodia@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Exisiting code returns the max of the decoded size and buffer size. It turns out that buffer size is always greater due to hardware alignment requirement. As a result, payload size given to client is incorrect. This change ensures that the bytesused is assigned to actual payload size. Change-Id: Ie6f3429c0cb23f682544748d181fa4fa63ca2e28 Signed-off-by: Vikash Garodia --- drivers/media/platform/qcom/venus/vdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index d079aeb..ada1d2f 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -890,7 +890,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type, vb = &vbuf->vb2_buf; vb->planes[0].bytesused = - max_t(unsigned int, opb_sz, bytesused); + min_t(unsigned int, opb_sz, bytesused); vb->planes[0].data_offset = data_offset; vb->timestamp = timestamp_us * NSEC_PER_USEC; vbuf->sequence = inst->sequence_cap++;